Add EventManager.OnRegionLoginsStatusChange fired whenever logins are enabled or disabled at any point, not just during initial startup.
This replaces EventManager.OnLoginsEnabled which only fired when logins were first enabled and was affected by a bug where it would never fire if the region started with logins disabled.0.7.4.1
parent
64db0bcbd2
commit
6dda7c65ae
|
@ -66,6 +66,11 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
IConfigSource Config { get; }
|
IConfigSource Config { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Are logins enabled on this simulator?
|
||||||
|
/// </summary>
|
||||||
|
bool LoginsEnabled { get; set; }
|
||||||
|
|
||||||
float TimeDilation { get; }
|
float TimeDilation { get; }
|
||||||
|
|
||||||
bool AllowScriptCrossings { get; }
|
bool AllowScriptCrossings { get; }
|
||||||
|
|
|
@ -129,18 +129,18 @@ namespace OpenSim.Region.CoreModules.World
|
||||||
switch (cmd[1])
|
switch (cmd[1])
|
||||||
{
|
{
|
||||||
case "enable":
|
case "enable":
|
||||||
scene.LoginsDisabled = false;
|
scene.LoginsEnabled = true;
|
||||||
MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName));
|
MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName));
|
||||||
break;
|
break;
|
||||||
case "disable":
|
case "disable":
|
||||||
scene.LoginsDisabled = true;
|
scene.LoginsEnabled = false;
|
||||||
MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName));
|
MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName));
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
if (scene.LoginsDisabled)
|
if (scene.LoginsEnabled)
|
||||||
MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
|
|
||||||
else
|
|
||||||
MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName));
|
MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName));
|
||||||
|
else
|
||||||
|
MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MainConsole.Instance.Output("Syntax: login enable|disable|status");
|
MainConsole.Instance.Output("Syntax: login enable|disable|status");
|
||||||
|
|
|
@ -497,13 +497,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
|
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This should only fire in all circumstances if the RegionReady module is active.
|
/// Fired when logins to a region are enabled or disabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// TODO: Fire this even when the RegionReady module is not active.
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public delegate void LoginsEnabled(IScene scene);
|
/// Fired
|
||||||
public event LoginsEnabled OnLoginsEnabled;
|
public event RegionLoginsStatusChange OnRegionLoginsStatusChange;
|
||||||
|
public delegate void RegionLoginsStatusChange(IScene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when a region is considered ready for use.
|
/// Fired when a region is considered ready for use.
|
||||||
|
@ -512,8 +513,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// A region is considered ready when startup operations such as loading of scripts already on the region
|
/// A region is considered ready when startup operations such as loading of scripts already on the region
|
||||||
/// have been completed.
|
/// have been completed.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public delegate void RegionReady(IScene scene);
|
|
||||||
public event RegionReady OnRegionReady;
|
public event RegionReady OnRegionReady;
|
||||||
|
public delegate void RegionReady(IScene scene);
|
||||||
|
|
||||||
public delegate void PrimsLoaded(Scene s);
|
public delegate void PrimsLoaded(Scene s);
|
||||||
public event PrimsLoaded OnPrimsLoaded;
|
public event PrimsLoaded OnPrimsLoaded;
|
||||||
|
@ -2486,13 +2487,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TriggerLoginsEnabled(IScene scene)
|
public void TriggerRegionLoginsStatusChange(IScene scene)
|
||||||
{
|
{
|
||||||
LoginsEnabled handler = OnLoginsEnabled;
|
RegionLoginsStatusChange handler = OnRegionLoginsStatusChange;
|
||||||
|
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
foreach (LoginsEnabled d in handler.GetInvocationList())
|
foreach (RegionLoginsStatusChange d in handler.GetInvocationList())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2500,13 +2501,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnLoginsEnabled failed - continuing {0} - {1}",
|
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}",
|
||||||
e.Message, e.StackTrace);
|
e.Message, e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TriggerRegionReady(IScene scene)
|
public void TriggerRegionReady(IScene scene)
|
||||||
{
|
{
|
||||||
RegionReady handler = OnRegionReady;
|
RegionReady handler = OnRegionReady;
|
||||||
|
|
|
@ -128,9 +128,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// root agents when ACL denies access to root agent
|
// root agents when ACL denies access to root agent
|
||||||
public bool m_strictAccessControl = true;
|
public bool m_strictAccessControl = true;
|
||||||
public int MaxUndoCount = 5;
|
public int MaxUndoCount = 5;
|
||||||
|
|
||||||
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
|
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
|
||||||
public bool LoginLock = false;
|
public bool LoginLock = false;
|
||||||
public bool LoginsDisabled = true;
|
|
||||||
public bool StartDisabled = false;
|
public bool StartDisabled = false;
|
||||||
public bool LoadingPrims;
|
public bool LoadingPrims;
|
||||||
public IXfer XferManager;
|
public IXfer XferManager;
|
||||||
|
@ -1478,7 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// landMS = Util.EnvironmentTickCountSubtract(ldMS);
|
// landMS = Util.EnvironmentTickCountSubtract(ldMS);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (LoginsDisabled && Frame == 20)
|
if (!LoginsEnabled && Frame == 20)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock);
|
// m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock);
|
||||||
|
|
||||||
|
@ -1492,8 +1493,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (!StartDisabled)
|
if (!StartDisabled)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
||||||
LoginsDisabled = false;
|
LoginsEnabled = true;
|
||||||
EventManager.TriggerLoginsEnabled(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sceneGridService.InformNeighborsThatRegionisUp(
|
m_sceneGridService.InformNeighborsThatRegionisUp(
|
||||||
|
@ -3460,7 +3460,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
agent.startpos
|
agent.startpos
|
||||||
);
|
);
|
||||||
|
|
||||||
if (LoginsDisabled)
|
if (!LoginsEnabled)
|
||||||
{
|
{
|
||||||
reason = "Logins Disabled";
|
reason = "Logins Disabled";
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -106,6 +106,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected readonly ClientManager m_clientManager = new ClientManager();
|
protected readonly ClientManager m_clientManager = new ClientManager();
|
||||||
|
|
||||||
|
public bool LoginsEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_loginsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (m_loginsEnabled != value)
|
||||||
|
{
|
||||||
|
m_loginsEnabled = value;
|
||||||
|
EventManager.TriggerRegionLoginsStatusChange(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private bool m_loginsEnabled;
|
||||||
|
|
||||||
public float TimeDilation
|
public float TimeDilation
|
||||||
{
|
{
|
||||||
get { return 1.0f; }
|
get { return 1.0f; }
|
||||||
|
|
|
@ -301,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
sp.AbsolutePosition = preTeleportPosition;
|
sp.AbsolutePosition = preTeleportPosition;
|
||||||
|
|
||||||
// Make sceneB refuse CreateAgent
|
// Make sceneB refuse CreateAgent
|
||||||
sceneB.LoginsDisabled = true;
|
sceneB.LoginsEnabled = false;
|
||||||
|
|
||||||
sceneA.RequestTeleportLocation(
|
sceneA.RequestTeleportLocation(
|
||||||
sp.ControllingClient,
|
sp.ControllingClient,
|
||||||
|
|
|
@ -210,15 +210,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||||
|
|
||||||
if (!m_scene.StartDisabled)
|
if (!m_scene.StartDisabled)
|
||||||
{
|
{
|
||||||
m_scene.LoginsDisabled = false;
|
m_scene.LoginsEnabled = true;
|
||||||
|
|
||||||
// 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());
|
||||||
|
|
||||||
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.SceneGridService.InformNeighborsThatRegionisUp(
|
||||||
|
|
|
@ -190,7 +190,7 @@ namespace OpenSim.Tests.Common
|
||||||
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
|
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
|
||||||
|
|
||||||
testScene.RegionInfo.EstateSettings = new EstateSettings();
|
testScene.RegionInfo.EstateSettings = new EstateSettings();
|
||||||
testScene.LoginsDisabled = false;
|
testScene.LoginsEnabled = true;
|
||||||
testScene.RegisterRegionWithGrid();
|
testScene.RegisterRegionWithGrid();
|
||||||
|
|
||||||
SceneManager.Add(testScene);
|
SceneManager.Add(testScene);
|
||||||
|
|
Loading…
Reference in New Issue