aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-28 06:18:07 +0000
committerTeravus Ovares2007-11-28 06:18:07 +0000
commitb7d596a6af51bea7dba642cdc768ac5ff77af5f3 (patch)
tree967b749b10b548f6ed687d8ade4680e411793da4 /OpenSim/Region/Physics
parentbuild ThrottleCheck function to clear up bits of the throttle (diff)
downloadopensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.zip
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.gz
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.bz2
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.xz
* Restaring the sim works fine in grid mode now. Sims announce themselves to their neighbors when they start up. Neighbors get this message and tell their agents that there's a new sim up.
* Certain unrecoverable physics based crashes in ODE are now hooked up to the 'restart the sim' routine.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs17
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs22
2 files changed, 35 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 651992c..635b208 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -32,12 +32,29 @@ using OpenSim.Region.Physics.Manager;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
34{ 34{
35 public delegate void physicsCrash();
36
35 public abstract class PhysicsScene 37 public abstract class PhysicsScene
36 { 38 {
39 // The only thing that should register for this event is the InnerScene
40 // Anything else could cause problems.
41
42 public event physicsCrash OnPhysicsCrash;
43
37 public static PhysicsScene Null 44 public static PhysicsScene Null
38 { 45 {
39 get { return new NullPhysicsScene(); } 46 get { return new NullPhysicsScene(); }
40 } 47 }
48 public virtual void TriggerPhysicsBasedRestart()
49 {
50 physicsCrash handler = OnPhysicsCrash;
51 if (handler != null)
52 {
53 OnPhysicsCrash();
54 }
55
56 }
57
41 58
42 public abstract void Initialise(IMesher meshmerizer); 59 public abstract void Initialise(IMesher meshmerizer);
43 60
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index ec7d04d..7193886 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -32,6 +32,7 @@ using Axiom.Math;
32using Ode.NET; 32using Ode.NET;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
35
35//using OpenSim.Region.Physics.OdePlugin.Meshing; 36//using OpenSim.Region.Physics.OdePlugin.Meshing;
36 37
37namespace OpenSim.Region.Physics.OdePlugin 38namespace OpenSim.Region.Physics.OdePlugin
@@ -234,9 +235,16 @@ namespace OpenSim.Region.Physics.OdePlugin
234 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); 235 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2);
235 } 236 }
236 237
237 int count; 238 int count = 0;
238 239 try
240 {
239 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); 241 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
242 }
243 catch (System.Runtime.InteropServices.SEHException)
244 {
245 OpenSim.Framework.Console.MainLog.Instance.Error("PHYSICS", "The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
246 base.TriggerPhysicsBasedRestart();
247 }
240 248
241 for (int i = 0; i < count; i++) 249 for (int i = 0; i < count; i++)
242 { 250 {
@@ -805,8 +813,14 @@ namespace OpenSim.Region.Physics.OdePlugin
805 { 813 {
806 // Process 10 frames if the sim is running normal.. 814 // Process 10 frames if the sim is running normal..
807 // process 5 frames if the sim is running slow 815 // process 5 frames if the sim is running slow
808 d.WorldSetQuickStepNumIterations(world, m_physicsiterations); 816 try{
809 817 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
818 }
819 catch (System.StackOverflowException)
820 {
821 OpenSim.Framework.Console.MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
822 base.TriggerPhysicsBasedRestart();
823 }
810 824
811 int i = 0; 825 int i = 0;
812 while (step_time > 0.0f) 826 while (step_time > 0.0f)