Only listen to LoginsEnabled event in RegionReadyModule if it has been asked to disable logins until all scripts have been compiled

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-18 21:03:35 +01:00
parent eb590becf0
commit cd6d7429f8
1 changed files with 24 additions and 28 deletions

View File

@ -56,7 +56,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
private bool m_lastOarLoadedOk; private bool m_lastOarLoadedOk;
private int m_channelNotify = -1000; private int m_channelNotify = -1000;
private bool m_enabled = false; private bool m_enabled = false;
private bool m_disable_logins = false; private bool m_disable_logins;
private string m_uri = string.Empty; private string m_uri = string.Empty;
Scene m_scene = null; Scene m_scene = null;
@ -100,15 +100,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
m_scene.EventManager.OnRezScript += OnRezScript; m_scene.EventManager.OnRezScript += OnRezScript;
m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
if (m_disable_logins == true) if (m_disable_logins)
{ {
m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
scene.LoginLock = true; scene.LoginLock = true;
scene.LoginsDisabled = true; m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
m_log.InfoFormat("[RegionReady]: Region {0} - logins disabled during initialization.",m_scene.RegionInfo.RegionName);
if (m_uri != string.Empty) if (m_uri != string.Empty)
{ {
@ -132,8 +131,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
if (!m_enabled) if (!m_enabled)
return; return;
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
if (m_disable_logins)
m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
if (m_uri != string.Empty) if (m_uri != string.Empty)
@ -159,7 +159,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
#endregion #endregion
void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) void OnEmptyScriptCompileQueue(int numScriptsFailed, string message)
{ {
m_log.DebugFormat("[RegionReady]: Script compile queue empty!"); m_log.DebugFormat("[RegionReady]: Script compile queue empty!");
@ -215,16 +214,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
// else it will be true and we should wait on the // else it will be true and we should wait on the
// empty compile queue // empty compile queue
void OnLoginsEnabled(string regionName) void OnLoginsEnabled(string regionName)
{
if (m_disable_logins == true)
{ {
if (m_scene.StartDisabled == false) if (m_scene.StartDisabled == false)
{ {
m_scene.LoginsDisabled = false; m_scene.LoginsDisabled = false;
m_scene.LoginLock = false; m_scene.LoginLock = false;
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
@ -236,7 +231,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
RRAlert("enabled"); RRAlert("enabled");
} }
} }
}
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
} }
public void OarLoadingAlert(string msg) public void OarLoadingAlert(string msg)