diff options
author | Teravus Ovares | 2007-11-27 13:46:52 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-27 13:46:52 +0000 |
commit | 082f2baebe300e1313a34444c42dcc0a20c44baf (patch) | |
tree | 71616106c7a7dc1a3e21ea14c2f4b6d09fc642a5 /OpenSim/Region/Environment/Scenes/Scene.cs | |
parent | MainMap workaround. Map still does not fill in automatically, but one click o... (diff) | |
download | opensim-SC_OLD-082f2baebe300e1313a34444c42dcc0a20c44baf.zip opensim-SC_OLD-082f2baebe300e1313a34444c42dcc0a20c44baf.tar.gz opensim-SC_OLD-082f2baebe300e1313a34444c42dcc0a20c44baf.tar.bz2 opensim-SC_OLD-082f2baebe300e1313a34444c42dcc0a20c44baf.tar.xz |
Fixed an event in the events chain in inter-region communications.
As a consequence, restarting sims in the same process instance now shows them when they come back up in grid mode and standalone mode.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 73 |
1 files changed, 55 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a9791ee..d8723f6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -57,6 +57,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
57 | { | 57 | { |
58 | #region Fields | 58 | #region Fields |
59 | protected Timer m_heartbeatTimer = new Timer(); | 59 | protected Timer m_heartbeatTimer = new Timer(); |
60 | protected Timer m_restartWaitTimer = new Timer(); | ||
61 | |||
62 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | ||
60 | 63 | ||
61 | public InnerScene m_innerScene; | 64 | public InnerScene m_innerScene; |
62 | 65 | ||
@@ -210,6 +213,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
210 | m_authenticateHandler = authen; | 213 | m_authenticateHandler = authen; |
211 | CommsManager = commsMan; | 214 | CommsManager = commsMan; |
212 | m_sceneGridService = sceneGridService; | 215 | m_sceneGridService = sceneGridService; |
216 | m_sceneGridService.debugRegionName = regInfo.RegionName; | ||
213 | m_storageManager = storeManager; | 217 | m_storageManager = storeManager; |
214 | AssetCache = assetCach; | 218 | AssetCache = assetCach; |
215 | m_regInfo = regInfo; | 219 | m_regInfo = regInfo; |
@@ -244,6 +248,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
244 | 248 | ||
245 | httpListener = httpServer; | 249 | httpListener = httpServer; |
246 | m_dumpAssetsToFile = dumpAssetsToFile; | 250 | m_dumpAssetsToFile = dumpAssetsToFile; |
251 | |||
252 | // This function was moved to terrain for some kind of map hack by babble | ||
247 | RegisterRegionWithComms(); | 253 | RegisterRegionWithComms(); |
248 | } | 254 | } |
249 | 255 | ||
@@ -262,29 +268,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
262 | { | 268 | { |
263 | // Another region is up. We have to tell all our ScenePresences about it | 269 | // Another region is up. We have to tell all our ScenePresences about it |
264 | // This fails to get the desired effect and needs further work. | 270 | // This fails to get the desired effect and needs further work. |
265 | try | 271 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) |
266 | { | 272 | { |
267 | 273 | if (!(m_regionRestartNotifyList.Contains(otherRegion))) | |
268 | ForEachScenePresence(delegate(ScenePresence agent) | ||
269 | { | 274 | { |
270 | if (!(agent.IsChildAgent)) | 275 | m_regionRestartNotifyList.Add(otherRegion); |
271 | { | 276 | |
272 | this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | 277 | m_restartWaitTimer = new Timer(20000); |
273 | InformClientOfNeighbor(agent, otherRegion); | 278 | m_restartWaitTimer.AutoReset = false; |
274 | } | 279 | m_restartWaitTimer.Elapsed += new ElapsedEventHandler(restart_Notify_Wait_Elapsed); |
280 | m_restartWaitTimer.Start(); | ||
275 | } | 281 | } |
276 | |||
277 | ); | ||
278 | } | ||
279 | catch (System.NullReferenceException) | ||
280 | { | ||
281 | // This means that we're not booted up completely yet. | ||
282 | } | 282 | } |
283 | return true; | 283 | return true; |
284 | } | 284 | } |
285 | public virtual void Restart(float seconds) | 285 | public virtual void Restart(float seconds) |
286 | { | 286 | { |
287 | if (seconds < 100) | 287 | if (seconds < 15) |
288 | { | 288 | { |
289 | t_restartTimer.Stop(); | 289 | t_restartTimer.Stop(); |
290 | SendGeneralAlert("Restart Aborted"); | 290 | SendGeneralAlert("Restart Aborted"); |
@@ -314,6 +314,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
314 | else | 314 | else |
315 | { | 315 | { |
316 | t_restartTimer.Stop(); | 316 | t_restartTimer.Stop(); |
317 | t_restartTimer.AutoReset = false; | ||
317 | MainLog.Instance.Error("REGION", "Closing"); | 318 | MainLog.Instance.Error("REGION", "Closing"); |
318 | Close(); | 319 | Close(); |
319 | MainLog.Instance.Error("REGION", "Firing Region Restart Message"); | 320 | MainLog.Instance.Error("REGION", "Firing Region Restart Message"); |
@@ -321,6 +322,34 @@ namespace OpenSim.Region.Environment.Scenes | |||
321 | } | 322 | } |
322 | 323 | ||
323 | } | 324 | } |
325 | public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) | ||
326 | { | ||
327 | m_restartWaitTimer.Stop(); | ||
328 | foreach (RegionInfo region in m_regionRestartNotifyList) | ||
329 | { | ||
330 | try | ||
331 | { | ||
332 | |||
333 | ForEachScenePresence(delegate(ScenePresence agent) | ||
334 | { | ||
335 | if (!(agent.IsChildAgent)) | ||
336 | { | ||
337 | //agent.ControllingClient.new | ||
338 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | ||
339 | InformClientOfNeighbor(agent, region); | ||
340 | } | ||
341 | } | ||
342 | |||
343 | ); | ||
344 | } | ||
345 | catch (System.NullReferenceException) | ||
346 | { | ||
347 | // This means that we're not booted up completely yet. | ||
348 | } | ||
349 | } | ||
350 | // Reset list to nothing. | ||
351 | m_regionRestartNotifyList = new List<RegionInfo>(); | ||
352 | } | ||
324 | public override void Close() | 353 | public override void Close() |
325 | { | 354 | { |
326 | ForEachScenePresence(delegate(ScenePresence avatar) | 355 | ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -642,7 +671,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
642 | } | 671 | } |
643 | 672 | ||
644 | CreateTerrainTextureInitial(); | 673 | CreateTerrainTextureInitial(); |
645 | CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map | 674 | //CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map |
675 | |||
676 | // These two 'commands' *must be* next to each other or sim rebooting fails. | ||
677 | m_sceneGridService.RegisterRegion(RegionInfo); | ||
678 | m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); | ||
646 | } | 679 | } |
647 | catch (Exception e) | 680 | catch (Exception e) |
648 | { | 681 | { |
@@ -1073,13 +1106,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1073 | /// </summary> | 1106 | /// </summary> |
1074 | public void RegisterRegionWithComms() | 1107 | public void RegisterRegionWithComms() |
1075 | { | 1108 | { |
1076 | m_sceneGridService.RegisterRegion(m_regInfo); | 1109 | // Don't register here. babblefro moved registration to *after *the map |
1110 | // functions on line 675 so that a proper map will generate and get sent to grid services | ||
1111 | // Double registrations will cause inter region communication issues | ||
1112 | |||
1113 | //m_sceneGridService.RegisterRegion(m_regInfo); | ||
1077 | m_sceneGridService.OnExpectUser += NewUserConnection; | 1114 | m_sceneGridService.OnExpectUser += NewUserConnection; |
1078 | m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; | 1115 | m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; |
1079 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; | 1116 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; |
1080 | m_sceneGridService.OnRegionUp += OtherRegionUp; | 1117 | m_sceneGridService.OnRegionUp += OtherRegionUp; |
1081 | // Tell Other regions that I'm here. | 1118 | // Tell Other regions that I'm here. |
1082 | m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); | 1119 | |
1083 | } | 1120 | } |
1084 | public void UnRegisterReginWithComms() | 1121 | public void UnRegisterReginWithComms() |
1085 | { | 1122 | { |