aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-27 13:46:52 +0000
committerTeravus Ovares2007-11-27 13:46:52 +0000
commit082f2baebe300e1313a34444c42dcc0a20c44baf (patch)
tree71616106c7a7dc1a3e21ea14c2f4b6d09fc642a5 /OpenSim/Region/Environment/Scenes
parentMainMap workaround. Map still does not fill in automatically, but one click o... (diff)
downloadopensim-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 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs73
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs31
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs6
3 files changed, 90 insertions, 20 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 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 18ce34d..0355a1b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -22,25 +22,48 @@ namespace OpenSim.Region.Environment.Scenes
22 public event CloseAgentConnection OnCloseAgentConnection; 22 public event CloseAgentConnection OnCloseAgentConnection;
23 public event PrimCrossing OnPrimCrossingIntoRegion; 23 public event PrimCrossing OnPrimCrossingIntoRegion;
24 public event RegionUp OnRegionUp; 24 public event RegionUp OnRegionUp;
25 25 public string _debugRegionName = "";
26
27 public string debugRegionName
28 {
29 get { return _debugRegionName; }
30 set
31 {
32 _debugRegionName = value;
33
34
35
36 }
37 }
26 38
27 public SceneCommunicationService(CommunicationsManager commsMan) 39 public SceneCommunicationService(CommunicationsManager commsMan)
28 { 40 {
29 m_commsProvider = commsMan; 41 m_commsProvider = commsMan;
42 m_commsProvider.GridService.gdebugRegionName = _debugRegionName;
43 m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName;
30 } 44 }
31 45
32 public void RegisterRegion(RegionInfo regionInfos) 46 public void RegisterRegion(RegionInfo regionInfos)
33 { 47 {
34 m_regionInfo = regionInfos; 48 m_regionInfo = regionInfos;
35 regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo); 49 regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
50
36 if (regionCommsHost != null) 51 if (regionCommsHost != null)
37 { 52 {
53 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
54
55 regionCommsHost.debugRegionName = _debugRegionName;
38 regionCommsHost.OnExpectUser += NewUserConnection; 56 regionCommsHost.OnExpectUser += NewUserConnection;
39 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; 57 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
40 regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing; 58 regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing;
41 regionCommsHost.OnCloseAgentConnection += CloseConnection; 59 regionCommsHost.OnCloseAgentConnection += CloseConnection;
42 regionCommsHost.OnRegionUp += newRegionUp; 60 regionCommsHost.OnRegionUp += newRegionUp;
43 61
62
63 }
64 else
65 {
66 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
44 67
45 } 68 }
46 } 69 }
@@ -70,6 +93,7 @@ namespace OpenSim.Region.Environment.Scenes
70 { 93 {
71 if (OnExpectUser != null) 94 if (OnExpectUser != null)
72 { 95 {
96 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname);
73 OnExpectUser(regionHandle, agent); 97 OnExpectUser(regionHandle, agent);
74 } 98 }
75 } 99 }
@@ -78,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
78 { 102 {
79 if (OnRegionUp != null) 103 if (OnRegionUp != null)
80 { 104 {
105 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
81 OnRegionUp(region); 106 OnRegionUp(region);
82 } 107 }
83 return true; 108 return true;
@@ -188,6 +213,7 @@ namespace OpenSim.Region.Environment.Scenes
188 /// <returns></returns> 213 /// <returns></returns>
189 public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) 214 public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
190 { 215 {
216 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionHandle.ToString());
191 return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle); 217 return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
192 } 218 }
193 219
@@ -275,6 +301,7 @@ namespace OpenSim.Region.Environment.Scenes
275 301
276 public void InformNeighborsThatRegionisUp(RegionInfo region) 302 public void InformNeighborsThatRegionisUp(RegionInfo region)
277 { 303 {
304 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
278 bool val = m_commsProvider.InterRegion.RegionUp(region); 305 bool val = m_commsProvider.InterRegion.RegionUp(region);
279 } 306 }
280 307
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index c28269e..eba45fc 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -214,6 +214,12 @@ namespace OpenSim.Region.Environment.Scenes
214 } 214 }
215 } 215 }
216 216
217 public void RestartCurrentScene()
218 {
219 ForEachCurrentScene(delegate(Scene scene) { scene.Restart(15); });
220
221 }
222
217 public void BackupCurrentScene() 223 public void BackupCurrentScene()
218 { 224 {
219 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); 225 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });