aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs53
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs2
4 files changed, 80 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 8f7cbee..c1acde4 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -11,8 +11,14 @@ using OpenSim.Region.Physics.Manager;
11 11
12namespace OpenSim.Region.Environment.Scenes 12namespace OpenSim.Region.Environment.Scenes
13{ 13{
14 public delegate void PhysicsCrash();
15
14 public class InnerScene 16 public class InnerScene
15 { 17 {
18 #region Events
19 public event PhysicsCrash UnRecoverableError;
20 #endregion
21
16 #region Fields 22 #region Fields
17 public Dictionary<LLUUID, ScenePresence> ScenePresences; 23 public Dictionary<LLUUID, ScenePresence> ScenePresences;
18 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; 24 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
@@ -26,17 +32,47 @@ namespace OpenSim.Region.Environment.Scenes
26 32
27 internal object m_syncRoot = new object(); 33 internal object m_syncRoot = new object();
28 34
29 public PhysicsScene PhyScene; 35 public PhysicsScene _PhyScene;
30 #endregion 36 #endregion
31 37
32 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) 38 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr)
33 { 39 {
40
34 m_parentScene = parent; 41 m_parentScene = parent;
35 m_regInfo = regInfo; 42 m_regInfo = regInfo;
36 PermissionsMngr = permissionsMngr; 43 PermissionsMngr = permissionsMngr;
37 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256); 44 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256);
38 QuadTree.Subdivide(); 45 QuadTree.Subdivide();
39 QuadTree.Subdivide(); 46 QuadTree.Subdivide();
47
48
49 }
50 public PhysicsScene PhyScene
51 {
52 get
53 { return _PhyScene; }
54 set
55 {
56 // If we're not doing the initial set
57 // Then we've got to remove the previous
58 // event handler
59 try
60 {
61 _PhyScene.OnPhysicsCrash -= physicsBasedCrash;
62 }
63 catch (System.NullReferenceException)
64 {
65 // This occurs when storing to _PhyScene the first time.
66 // Is there a better way to check the event handler before
67 // getting here
68 // This can be safely ignored. We're setting the first inital
69 // there are no event handler's registered.
70 }
71
72 _PhyScene = value;
73
74 _PhyScene.OnPhysicsCrash += physicsBasedCrash;
75 }
40 } 76 }
41 77
42 public void Close() 78 public void Close()
@@ -55,9 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
55 91
56 // PhysX does this (runs in the background). 92 // PhysX does this (runs in the background).
57 93
58 if (PhyScene.IsThreaded) 94 if (_PhyScene.IsThreaded)
59 { 95 {
60 PhyScene.GetResults(); 96 _PhyScene.GetResults();
61 } 97 }
62 } 98 }
63 99
@@ -75,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes
75 { 111 {
76 lock (m_syncRoot) 112 lock (m_syncRoot)
77 { 113 {
78 PhyScene.Simulate((float)elapsed); 114 _PhyScene.Simulate((float)elapsed);
79 } 115 }
80 } 116 }
81 117
@@ -338,6 +374,15 @@ namespace OpenSim.Region.Environment.Scenes
338 374
339 #region Other Methods 375 #region Other Methods
340 376
377
378 public void physicsBasedCrash()
379 {
380 if (UnRecoverableError != null)
381 {
382 UnRecoverableError();
383 }
384 }
385
341 public LLUUID ConvertLocalIDToFullID(uint localID) 386 public LLUUID ConvertLocalIDToFullID(uint localID)
342 { 387 {
343 SceneObjectGroup group = GetGroupByPrim(localID); 388 SceneObjectGroup group = GetGroupByPrim(localID);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index bdafce8..1359bd2 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -232,6 +232,15 @@ namespace OpenSim.Region.Environment.Scenes
232 m_permissionManager.Initialise(this); 232 m_permissionManager.Initialise(this);
233 233
234 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager); 234 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
235
236 // If the Inner scene has an Unrecoverable error, restart this sim.
237 // Currently the only thing that causes it to happen is two kinds of specific
238 // Physics based crashes.
239 //
240 // Out of memory
241 // Operating system has killed the plugin
242 m_innerScene.UnRecoverableError += restartNOW;
243
235 m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); 244 m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo);
236 245
237 RegisterDefaultSceneEvents(); 246 RegisterDefaultSceneEvents();
@@ -315,13 +324,17 @@ namespace OpenSim.Region.Environment.Scenes
315 { 324 {
316 t_restartTimer.Stop(); 325 t_restartTimer.Stop();
317 t_restartTimer.AutoReset = false; 326 t_restartTimer.AutoReset = false;
318 MainLog.Instance.Error("REGION", "Closing"); 327 restartNOW();
319 Close();
320 MainLog.Instance.Error("REGION", "Firing Region Restart Message");
321 base.Restart(0);
322 } 328 }
323 329
324 } 330 }
331 public void restartNOW()
332 {
333 MainLog.Instance.Error("REGION", "Closing");
334 Close();
335 MainLog.Instance.Error("REGION", "Firing Region Restart Message");
336 base.Restart(0);
337 }
325 public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) 338 public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e)
326 { 339 {
327 m_restartWaitTimer.Stop(); 340 m_restartWaitTimer.Stop();
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 9a83710..892bf81 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -171,6 +171,18 @@ namespace OpenSim.Region.Environment.Scenes
171 } 171 }
172 } 172 }
173 173
174 public void RequestNeighbors(RegionInfo region)
175 {
176 List<SimpleRegionInfo> neighbours =
177 m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
178 //IPEndPoint blah = new IPEndPoint();
179
180 //blah.Address = region.RemotingAddress;
181 //blah.Port = region.RemotingPort;
182
183
184 }
185
174 /// <summary> 186 /// <summary>
175 /// 187 ///
176 /// </summary> 188 /// </summary>
@@ -311,7 +323,7 @@ namespace OpenSim.Region.Environment.Scenes
311 public void InformNeighborsThatRegionisUp(RegionInfo region) 323 public void InformNeighborsThatRegionisUp(RegionInfo region)
312 { 324 {
313 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); 325 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
314 bool val = m_commsProvider.InterRegion.RegionUp(region); 326 bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
315 } 327 }
316 328
317 public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical) 329 public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical)
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index eba45fc..ed33bf7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Scenes
216 216
217 public void RestartCurrentScene() 217 public void RestartCurrentScene()
218 { 218 {
219 ForEachCurrentScene(delegate(Scene scene) { scene.Restart(15); }); 219 ForEachCurrentScene(delegate(Scene scene) { scene.restartNOW(); });
220 220
221 } 221 }
222 222