aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
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/Region/Framework
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 '')
-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
4 files changed, 35 insertions, 16 deletions
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,