aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-25 21:00:59 +0100
committerJustin Clark-Casey (justincc)2012-07-25 21:00:59 +0100
commit31304c222df1e5a832afd0ebcf7d3ed403543e54 (patch)
treed139e3f34534caa4f31c58503b88bd02a3385d45 /OpenSim/Region/Framework
parentRename "image queues clear" console command to "clear image queues" (diff)
downloadopensim-SC_OLD-31304c222df1e5a832afd0ebcf7d3ed403543e54.zip
opensim-SC_OLD-31304c222df1e5a832afd0ebcf7d3ed403543e54.tar.gz
opensim-SC_OLD-31304c222df1e5a832afd0ebcf7d3ed403543e54.tar.bz2
opensim-SC_OLD-31304c222df1e5a832afd0ebcf7d3ed403543e54.tar.xz
Make SceneManager.OnRegionsReadyStatusChange event available.
This is fired when all regions are ready or when at least one region becomes not ready. Recently added EventManager.OnRegionReady becomes OnRegionReadyStatusChange to match OnLoginsEnabledStatusChange
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs53
4 files changed, 76 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 620b605..6dea2f0 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -513,8 +513,7 @@ namespace OpenSim.Region.Framework.Scenes
513 /// 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
514 /// have been completed. 514 /// have been completed.
515 /// </remarks> 515 /// </remarks>
516 public event RegionReady OnRegionReady; 516 public event Action<IScene> OnRegionReadyStatusChange;
517 public delegate void RegionReady(IScene scene);
518 517
519 public delegate void PrimsLoaded(Scene s); 518 public delegate void PrimsLoaded(Scene s);
520 public event PrimsLoaded OnPrimsLoaded; 519 public event PrimsLoaded OnPrimsLoaded;
@@ -2508,13 +2507,13 @@ namespace OpenSim.Region.Framework.Scenes
2508 } 2507 }
2509 } 2508 }
2510 2509
2511 public void TriggerRegionReady(IScene scene) 2510 public void TriggerRegionReadyStatusChange(IScene scene)
2512 { 2511 {
2513 RegionReady handler = OnRegionReady; 2512 Action<IScene> handler = OnRegionReadyStatusChange;
2514 2513
2515 if (handler != null) 2514 if (handler != null)
2516 { 2515 {
2517 foreach (RegionReady d in handler.GetInvocationList()) 2516 foreach (Action<IScene> d in handler.GetInvocationList())
2518 { 2517 {
2519 try 2518 try
2520 { 2519 {
@@ -2522,7 +2521,7 @@ namespace OpenSim.Region.Framework.Scenes
2522 } 2521 }
2523 catch (Exception e) 2522 catch (Exception e)
2524 { 2523 {
2525 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}", 2524 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}",
2526 e.Message, e.StackTrace); 2525 e.Message, e.StackTrace);
2527 } 2526 }
2528 } 2527 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ee34338..20918bd 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1499,8 +1499,8 @@ namespace OpenSim.Region.Framework.Scenes
1499 m_sceneGridService.InformNeighborsThatRegionisUp( 1499 m_sceneGridService.InformNeighborsThatRegionisUp(
1500 RequestModuleInterface<INeighbourService>(), RegionInfo); 1500 RequestModuleInterface<INeighbourService>(), RegionInfo);
1501 1501
1502 // Region ready should always be triggered whether logins are immediately enabled or not. 1502 // Region ready should always be set
1503 EventManager.TriggerRegionReady(this); 1503 Ready = true;
1504 } 1504 }
1505 else 1505 else
1506 { 1506 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 282fc5e..b87a38a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -124,6 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
124 } 124 }
125 private bool m_loginsEnabled; 125 private bool m_loginsEnabled;
126 126
127 public bool Ready
128 {
129 get
130 {
131 return m_ready;
132 }
133
134 set
135 {
136 if (m_ready != value)
137 {
138 m_ready = value;
139 EventManager.TriggerRegionReadyStatusChange(this);
140 }
141 }
142 }
143 private bool m_ready;
144
127 public float TimeDilation 145 public float TimeDilation
128 { 146 {
129 get { return 1.0f; } 147 get { return 1.0f; }
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index d73a959..c81b55d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -47,6 +47,48 @@ namespace OpenSim.Region.Framework.Scenes
47 47
48 public event RestartSim OnRestartSim; 48 public event RestartSim OnRestartSim;
49 49
50 /// <summary>
51 /// Fired when either all regions are ready for use or at least one region has become unready for use where
52 /// previously all regions were ready.
53 /// </summary>
54 public event Action<SceneManager> OnRegionsReadyStatusChange;
55
56 /// <summary>
57 /// Are all regions ready for use?
58 /// </summary>
59 public bool AllRegionsReady
60 {
61 get
62 {
63 return m_allRegionsReady;
64 }
65
66 private set
67 {
68 if (m_allRegionsReady != value)
69 {
70 m_allRegionsReady = value;
71 Action<SceneManager> handler = OnRegionsReadyStatusChange;
72 if (handler != null)
73 {
74 foreach (Action<SceneManager> d in handler.GetInvocationList())
75 {
76 try
77 {
78 d(this);
79 }
80 catch (Exception e)
81 {
82 m_log.ErrorFormat("[SCENE MANAGER]: Delegate for OnRegionsReadyStatusChange failed - continuing {0} - {1}",
83 e.Message, e.StackTrace);
84 }
85 }
86 }
87 }
88 }
89 }
90 private bool m_allRegionsReady;
91
50 private static SceneManager m_instance = null; 92 private static SceneManager m_instance = null;
51 public static SceneManager Instance 93 public static SceneManager Instance
52 { 94 {
@@ -141,10 +183,11 @@ namespace OpenSim.Region.Framework.Scenes
141 183
142 public void Add(Scene scene) 184 public void Add(Scene scene)
143 { 185 {
144 scene.OnRestart += HandleRestart;
145
146 lock (m_localScenes) 186 lock (m_localScenes)
147 m_localScenes.Add(scene); 187 m_localScenes.Add(scene);
188
189 scene.OnRestart += HandleRestart;
190 scene.EventManager.OnRegionReadyStatusChange += HandleRegionReadyStatusChange;
148 } 191 }
149 192
150 public void HandleRestart(RegionInfo rdata) 193 public void HandleRestart(RegionInfo rdata)
@@ -175,6 +218,12 @@ namespace OpenSim.Region.Framework.Scenes
175 OnRestartSim(rdata); 218 OnRestartSim(rdata);
176 } 219 }
177 220
221 private void HandleRegionReadyStatusChange(IScene scene)
222 {
223 lock (m_localScenes)
224 AllRegionsReady = m_localScenes.TrueForAll(s => s.Ready);
225 }
226
178 public void SendSimOnlineNotification(ulong regionHandle) 227 public void SendSimOnlineNotification(ulong regionHandle)
179 { 228 {
180 RegionInfo Result = null; 229 RegionInfo Result = null;