aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs53
1 files changed, 51 insertions, 2 deletions
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;