Perform other region ready actions even if simulator is configured to leave logins disabled on startup.

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-18 23:35:05 +01:00
parent 1971b6bb4f
commit 528004d349
4 changed files with 49 additions and 48 deletions

View File

@ -25,14 +25,23 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using OpenSim.Framework;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public interface IRegionReadyModule public interface IRegionReadyModule
{ {
void OarLoadingAlert(string msg); void OarLoadingAlert(string msg);
/// <summary>
/// Trigger region ready status manually.
/// </summary>
/// <remarks>
/// This should be called by the scene if the IRegionReadyModule has set Scene.LoginLock == true
/// </remarks>
/// <param name='scene'></param>
void TriggerRegionReady(IScene scene);
} }
} }

View File

@ -702,6 +702,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
IConfig startupConfig = m_config.Configs["Startup"]; IConfig startupConfig = m_config.Configs["Startup"];
StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance);
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
if (!m_useBackup) if (!m_useBackup)
@ -1485,34 +1487,31 @@ namespace OpenSim.Region.Framework.Scenes
// allocations, and there is no more work to be done until someone logs in // allocations, and there is no more work to be done until someone logs in
GC.Collect(); GC.Collect();
IConfig startupConfig = m_config.Configs["Startup"]; if (!LoginLock)
if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
{ {
if (LoginLock) if (!StartDisabled)
{
// This handles a case of a region having no scripts for the RegionReady module
if (m_sceneGraph.GetActiveScriptsCount() == 0)
{
// XXX: need to be able to tell these have changed in RegionReady, since it will not
// detect a scenario where the region has no scripts - it's listening to the
// script compile queue.
EventManager.TriggerLoginsEnabled(this);
}
}
else
{ {
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
LoginsDisabled = false; LoginsDisabled = false;
EventManager.TriggerLoginsEnabled(this); EventManager.TriggerLoginsEnabled(this);
EventManager.TriggerRegionReady(this);
} }
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); // Region ready should always be triggered whether logins are immediately enabled or not.
EventManager.TriggerRegionReady(this);
} }
else else
{ {
StartDisabled = true; // This handles a case of a region having no scripts for the RegionReady module
LoginsDisabled = true; if (m_sceneGraph.GetActiveScriptsCount() == 0)
{
// In this case, we leave it to the IRegionReadyModule to enable logins
// LoginLock can currently only be set by a region module implementation.
// If somehow this hasn't been done then the quickest way to bugfix is to see the
// NullReferenceException
IRegionReadyModule rrm = RequestModuleInterface<IRegionReadyModule>();
rrm.TriggerRegionReady(this);
}
} }
} }
} }

View File

@ -31,16 +31,14 @@ using System.Reflection;
using System.Net; using System.Net;
using System.IO; using System.IO;
using System.Text; using System.Text;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.OptionalModules.Scripting.RegionReady namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
{ {
@ -105,7 +103,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
if (m_disable_logins) if (m_disable_logins)
{ {
m_scene.LoginLock = true; m_scene.LoginLock = true;
m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
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.Name);
@ -125,15 +122,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
if (m_disable_logins) if (m_disable_logins)
{
m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
}
if (m_uri != string.Empty) if (m_uri != string.Empty)
{
RRAlert("shutdown"); RRAlert("shutdown");
}
m_scene = null; m_scene = null;
} }
@ -186,8 +178,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); m_scene.RegionInfo.RegionName, c.Message, m_channelNotify);
m_scene.EventManager.TriggerOnChatBroadcast(this, c); m_scene.EventManager.TriggerOnChatBroadcast(this, c);
m_scene.EventManager.TriggerLoginsEnabled(m_scene);
m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo); TriggerRegionReady(m_scene);
} }
} }
@ -207,20 +199,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
} }
/// <summary> /// <summary>
/// This will be triggered by Scene directly if it contains no scripts on startup. /// This will be triggered by Scene directly if it contains no scripts on startup. Otherwise it is triggered
/// when the script compile queue is empty after initial region startup.
/// </summary> /// </summary>
/// <remarks>
/// m_ScriptsRezzing will be false if there were none
/// else it will be true and we should wait on the
/// empty compile queue
/// </remarks>
/// <param name='scene'></param> /// <param name='scene'></param>
void OnLoginsEnabled(IScene scene) public void TriggerRegionReady(IScene scene)
{ {
if (m_scene.StartDisabled == false) m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
m_scene.LoginLock = false;
if (!m_scene.StartDisabled)
{ {
m_scene.LoginsDisabled = false; m_scene.LoginsDisabled = false;
m_scene.LoginLock = false;
// 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());
@ -228,6 +218,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_log.InfoFormat( m_log.InfoFormat(
"[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
m_scene.EventManager.TriggerLoginsEnabled(m_scene);
}
m_scene.SceneGridService.InformNeighborsThatRegionisUp(
m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo);
if (m_uri != string.Empty) if (m_uri != string.Empty)
{ {
RRAlert("enabled"); RRAlert("enabled");
@ -236,9 +232,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.TriggerRegionReady(m_scene); m_scene.EventManager.TriggerRegionReady(m_scene);
} }
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
}
public void OarLoadingAlert(string msg) public void OarLoadingAlert(string msg)
{ {
// Let's bypass this for now until some better feedback can be established // Let's bypass this for now until some better feedback can be established