diff options
author | Melanie | 2012-07-28 00:39:36 +0100 |
---|---|---|
committer | Melanie | 2012-07-28 00:39:36 +0100 |
commit | 771d79e83e9ef5686aee5fe1c572673cff291083 (patch) | |
tree | b37749fc1929ffd6dd1b9c2c4e29120accf26b99 /OpenSim/Region/Framework/Scenes/SceneManager.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | LSL/OSSL lacks Math.Min & Math.Max implementations. (diff) | |
download | opensim-SC_OLD-771d79e83e9ef5686aee5fe1c572673cff291083.zip opensim-SC_OLD-771d79e83e9ef5686aee5fe1c572673cff291083.tar.gz opensim-SC_OLD-771d79e83e9ef5686aee5fe1c572673cff291083.tar.bz2 opensim-SC_OLD-771d79e83e9ef5686aee5fe1c572673cff291083.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Framework/Monitoring/BaseStatsCollector.cs
OpenSim/Region/Application/OpenSim.cs
OpenSim/Region/Application/OpenSimBase.cs
OpenSim/Region/Framework/Scenes/SceneManager.cs
bin/OpenMetaverse.Rendering.Meshmerizer.dll
bin/OpenMetaverse.StructuredData.dll
bin/OpenMetaverse.dll
bin/OpenMetaverseTypes.dll
prebuild.xml
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneManager.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneManager.cs | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index e3fed49..a412414 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 | { |
@@ -128,9 +170,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
128 | 170 | ||
129 | public void Add(Scene scene) | 171 | public void Add(Scene scene) |
130 | { | 172 | { |
131 | scene.OnRestart += HandleRestart; | 173 | lock (m_localScenes) |
174 | m_localScenes.Add(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene); | ||
132 | 175 | ||
133 | m_localScenes.Add(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene); | 176 | scene.OnRestart += HandleRestart; |
177 | scene.EventManager.OnRegionReadyStatusChange += HandleRegionReadyStatusChange; | ||
134 | } | 178 | } |
135 | 179 | ||
136 | public void HandleRestart(RegionInfo rdata) | 180 | public void HandleRestart(RegionInfo rdata) |
@@ -138,12 +182,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
138 | m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); | 182 | m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); |
139 | int RegionSceneElement = -1; | 183 | int RegionSceneElement = -1; |
140 | 184 | ||
141 | m_localScenes.Remove(rdata.RegionID); | 185 | lock (m_localScenes) |
186 | m_localScenes.Remove(rdata.RegionID); | ||
142 | 187 | ||
143 | // Send signal to main that we're restarting this sim. | 188 | // Send signal to main that we're restarting this sim. |
144 | OnRestartSim(rdata); | 189 | OnRestartSim(rdata); |
145 | } | 190 | } |
146 | 191 | ||
192 | private void HandleRegionReadyStatusChange(IScene scene) | ||
193 | { | ||
194 | lock (m_localScenes) | ||
195 | AllRegionsReady = m_localScenes.TrueForAll(s => s.Ready); | ||
196 | } | ||
197 | |||
147 | public void SendSimOnlineNotification(ulong regionHandle) | 198 | public void SendSimOnlineNotification(ulong regionHandle) |
148 | { | 199 | { |
149 | RegionInfo Result = null; | 200 | RegionInfo Result = null; |
@@ -483,7 +534,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
483 | 534 | ||
484 | public void CloseScene(Scene scene) | 535 | public void CloseScene(Scene scene) |
485 | { | 536 | { |
486 | m_localScenes.Remove(scene.RegionInfo.RegionID); | 537 | lock (m_localScenes) |
538 | m_localScenes.Remove(scene.RegionInfo.RegionID); | ||
487 | 539 | ||
488 | scene.Close(); | 540 | scene.Close(); |
489 | } | 541 | } |