aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-19 00:09:22 +0100
committerJustin Clark-Casey (justincc)2012-07-19 00:09:22 +0100
commit6dda7c65ae1d58cac3e8dc2d9d64f56c870df39e (patch)
tree54b7ca4265df0cb65261e0dc0fb63ddd4d000513 /OpenSim
parentAdd back notification to neighbouring regions when RegionReadyModule is not a... (diff)
downloadopensim-SC_OLD-6dda7c65ae1d58cac3e8dc2d9d64f56c870df39e.zip
opensim-SC_OLD-6dda7c65ae1d58cac3e8dc2d9d64f56c870df39e.tar.gz
opensim-SC_OLD-6dda7c65ae1d58cac3e8dc2d9d64f56c870df39e.tar.bz2
opensim-SC_OLD-6dda7c65ae1d58cac3e8dc2d9d64f56c870df39e.tar.xz
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IScene.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs4
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs2
8 files changed, 47 insertions, 25 deletions
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index a9432c2..2c38e0f 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -66,6 +66,11 @@ namespace OpenSim.Framework
66 66
67 IConfigSource Config { get; } 67 IConfigSource Config { get; }
68 68
69 /// <summary>
70 /// Are logins enabled on this simulator?
71 /// </summary>
72 bool LoginsEnabled { get; set; }
73
69 float TimeDilation { get; } 74 float TimeDilation { get; }
70 75
71 bool AllowScriptCrossings { get; } 76 bool AllowScriptCrossings { get; }
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
index 553a32d..e7b1454 100644
--- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -129,18 +129,18 @@ namespace OpenSim.Region.CoreModules.World
129 switch (cmd[1]) 129 switch (cmd[1])
130 { 130 {
131 case "enable": 131 case "enable":
132 scene.LoginsDisabled = false; 132 scene.LoginsEnabled = true;
133 MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); 133 MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName));
134 break; 134 break;
135 case "disable": 135 case "disable":
136 scene.LoginsDisabled = true; 136 scene.LoginsEnabled = false;
137 MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); 137 MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName));
138 break; 138 break;
139 case "status": 139 case "status":
140 if (scene.LoginsDisabled) 140 if (scene.LoginsEnabled)
141 MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
142 else
143 MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName)); 141 MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName));
142 else
143 MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
144 break; 144 break;
145 default: 145 default:
146 MainConsole.Instance.Output("Syntax: login enable|disable|status"); 146 MainConsole.Instance.Output("Syntax: login enable|disable|status");
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index b8ae0ac..620b605 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -497,13 +497,14 @@ namespace OpenSim.Region.Framework.Scenes
497 public event RegionHeartbeatEnd OnRegionHeartbeatEnd; 497 public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
498 498
499 /// <summary> 499 /// <summary>
500 /// This should only fire in all circumstances if the RegionReady module is active. 500 /// Fired when logins to a region are enabled or disabled.
501 /// </summary> 501 /// </summary>
502 /// <remarks> 502 /// <remarks>
503 /// TODO: Fire this even when the RegionReady module is not active. 503 ///
504 /// </remarks> 504 /// </remarks>
505 public delegate void LoginsEnabled(IScene scene); 505 /// Fired
506 public event LoginsEnabled OnLoginsEnabled; 506 public event RegionLoginsStatusChange OnRegionLoginsStatusChange;
507 public delegate void RegionLoginsStatusChange(IScene scene);
507 508
508 /// <summary> 509 /// <summary>
509 /// Fired when a region is considered ready for use. 510 /// Fired when a region is considered ready for use.
@@ -512,8 +513,8 @@ namespace OpenSim.Region.Framework.Scenes
512 /// A region is considered ready when startup operations such as loading of scripts already on the region 513 /// A region is considered ready when startup operations such as loading of scripts already on the region
513 /// have been completed. 514 /// have been completed.
514 /// </remarks> 515 /// </remarks>
515 public delegate void RegionReady(IScene scene);
516 public event RegionReady OnRegionReady; 516 public event RegionReady OnRegionReady;
517 public delegate void RegionReady(IScene scene);
517 518
518 public delegate void PrimsLoaded(Scene s); 519 public delegate void PrimsLoaded(Scene s);
519 public event PrimsLoaded OnPrimsLoaded; 520 public event PrimsLoaded OnPrimsLoaded;
@@ -2486,13 +2487,13 @@ namespace OpenSim.Region.Framework.Scenes
2486 } 2487 }
2487 } 2488 }
2488 2489
2489 public void TriggerLoginsEnabled(IScene scene) 2490 public void TriggerRegionLoginsStatusChange(IScene scene)
2490 { 2491 {
2491 LoginsEnabled handler = OnLoginsEnabled; 2492 RegionLoginsStatusChange handler = OnRegionLoginsStatusChange;
2492 2493
2493 if (handler != null) 2494 if (handler != null)
2494 { 2495 {
2495 foreach (LoginsEnabled d in handler.GetInvocationList()) 2496 foreach (RegionLoginsStatusChange d in handler.GetInvocationList())
2496 { 2497 {
2497 try 2498 try
2498 { 2499 {
@@ -2500,13 +2501,13 @@ namespace OpenSim.Region.Framework.Scenes
2500 } 2501 }
2501 catch (Exception e) 2502 catch (Exception e)
2502 { 2503 {
2503 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnLoginsEnabled failed - continuing {0} - {1}", 2504 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}",
2504 e.Message, e.StackTrace); 2505 e.Message, e.StackTrace);
2505 } 2506 }
2506 } 2507 }
2507 } 2508 }
2508 } 2509 }
2509 2510
2510 public void TriggerRegionReady(IScene scene) 2511 public void TriggerRegionReady(IScene scene)
2511 { 2512 {
2512 RegionReady handler = OnRegionReady; 2513 RegionReady handler = OnRegionReady;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d4ccd41..6d8ee7b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -128,9 +128,10 @@ namespace OpenSim.Region.Framework.Scenes
128 // root agents when ACL denies access to root agent 128 // root agents when ACL denies access to root agent
129 public bool m_strictAccessControl = true; 129 public bool m_strictAccessControl = true;
130 public int MaxUndoCount = 5; 130 public int MaxUndoCount = 5;
131
131 // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; 132 // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
132 public bool LoginLock = false; 133 public bool LoginLock = false;
133 public bool LoginsDisabled = true; 134
134 public bool StartDisabled = false; 135 public bool StartDisabled = false;
135 public bool LoadingPrims; 136 public bool LoadingPrims;
136 public IXfer XferManager; 137 public IXfer XferManager;
@@ -1478,7 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes
1478 // landMS = Util.EnvironmentTickCountSubtract(ldMS); 1479 // landMS = Util.EnvironmentTickCountSubtract(ldMS);
1479 //} 1480 //}
1480 1481
1481 if (LoginsDisabled && Frame == 20) 1482 if (!LoginsEnabled && Frame == 20)
1482 { 1483 {
1483 // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); 1484 // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock);
1484 1485
@@ -1492,8 +1493,7 @@ namespace OpenSim.Region.Framework.Scenes
1492 if (!StartDisabled) 1493 if (!StartDisabled)
1493 { 1494 {
1494 m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); 1495 m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1495 LoginsDisabled = false; 1496 LoginsEnabled = true;
1496 EventManager.TriggerLoginsEnabled(this);
1497 } 1497 }
1498 1498
1499 m_sceneGridService.InformNeighborsThatRegionisUp( 1499 m_sceneGridService.InformNeighborsThatRegionisUp(
@@ -3460,7 +3460,7 @@ namespace OpenSim.Region.Framework.Scenes
3460 agent.startpos 3460 agent.startpos
3461 ); 3461 );
3462 3462
3463 if (LoginsDisabled) 3463 if (!LoginsEnabled)
3464 { 3464 {
3465 reason = "Logins Disabled"; 3465 reason = "Logins Disabled";
3466 return false; 3466 return false;
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index f50fbfc..282fc5e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -106,6 +106,24 @@ namespace OpenSim.Region.Framework.Scenes
106 106
107 protected readonly ClientManager m_clientManager = new ClientManager(); 107 protected readonly ClientManager m_clientManager = new ClientManager();
108 108
109 public bool LoginsEnabled
110 {
111 get
112 {
113 return m_loginsEnabled;
114 }
115
116 set
117 {
118 if (m_loginsEnabled != value)
119 {
120 m_loginsEnabled = value;
121 EventManager.TriggerRegionLoginsStatusChange(this);
122 }
123 }
124 }
125 private bool m_loginsEnabled;
126
109 public float TimeDilation 127 public float TimeDilation
110 { 128 {
111 get { return 1.0f; } 129 get { return 1.0f; }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index a407f01..37b5184 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -301,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
301 sp.AbsolutePosition = preTeleportPosition; 301 sp.AbsolutePosition = preTeleportPosition;
302 302
303 // Make sceneB refuse CreateAgent 303 // Make sceneB refuse CreateAgent
304 sceneB.LoginsDisabled = true; 304 sceneB.LoginsEnabled = false;
305 305
306 sceneA.RequestTeleportLocation( 306 sceneA.RequestTeleportLocation(
307 sp.ControllingClient, 307 sp.ControllingClient,
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 8d5b25f..e49ad2a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -210,15 +210,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
210 210
211 if (!m_scene.StartDisabled) 211 if (!m_scene.StartDisabled)
212 { 212 {
213 m_scene.LoginsDisabled = false; 213 m_scene.LoginsEnabled = true;
214 214
215 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", 215 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
216 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); 216 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
217 217
218 m_log.InfoFormat( 218 m_log.InfoFormat(
219 "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); 219 "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
220
221 m_scene.EventManager.TriggerLoginsEnabled(m_scene);
222 } 220 }
223 221
224 m_scene.SceneGridService.InformNeighborsThatRegionisUp( 222 m_scene.SceneGridService.InformNeighborsThatRegionisUp(
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 769de83..7598cc3 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -190,7 +190,7 @@ namespace OpenSim.Tests.Common
190 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); 190 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
191 191
192 testScene.RegionInfo.EstateSettings = new EstateSettings(); 192 testScene.RegionInfo.EstateSettings = new EstateSettings();
193 testScene.LoginsDisabled = false; 193 testScene.LoginsEnabled = true;
194 testScene.RegisterRegionWithGrid(); 194 testScene.RegisterRegionWithGrid();
195 195
196 SceneManager.Add(testScene); 196 SceneManager.Add(testScene);