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

0.7.3-extended
Justin Clark-Casey (justincc) 2012-07-18 21:03:35 +01:00
parent 5aa9c21e7d
commit 272c3c1069
1 changed files with 25 additions and 27 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;
@ -105,24 +105,24 @@ 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]: Logins disabled for {0}",m_scene.RegionInfo.RegionName);
if(m_uri != string.Empty) m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
if (m_uri != string.Empty)
{ {
RRAlert("disabled"); RRAlert("disabled");
} }
} }
} }
void OnRezScript (uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
{ {
if (!m_ScriptRez) if (!m_ScriptRez)
{ {
@ -137,11 +137,12 @@ 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;
m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
if(m_uri != string.Empty) if (m_disable_logins)
m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
if (m_uri != string.Empty)
{ {
RRAlert("shutdown"); RRAlert("shutdown");
} }
@ -164,7 +165,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
#endregion #endregion
void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) void OnEmptyScriptCompileQueue(int numScriptsFailed, string message)
{ {
m_log.InfoFormat("[RegionReady]: Script compile queue empty!"); m_log.InfoFormat("[RegionReady]: Script compile queue empty!");
@ -221,26 +221,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
// 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.LoginLock = false;
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
m_log.InfoFormat(
"[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
if (m_uri != string.Empty)
{ {
m_scene.LoginsDisabled = false; RRAlert("enabled");
m_scene.LoginLock = false;
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName);
if ( m_uri != string.Empty )
{
RRAlert("enabled");
}
} }
} }
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
} }
public void OarLoadingAlert(string msg) public void OarLoadingAlert(string msg)