diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index aa2423f6e5..f0fd74be80 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -199,6 +199,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP int numCollected = 0; //First of all make sure our packet queue isn't above our threshold + if (m_client == null) + return; + + if (m_client.PacketHandler == null) + return; + + if (m_client.PacketHandler.PacketQueue == null) + return; + + if (m_client.PacketHandler.PacketQueue.TextureOutgoingPacketQueueCount < 200) { diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 3b9d293bb4..26a8959129 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -378,6 +378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP case SocketError.NetworkReset: case SocketError.ConnectionReset: + case SocketError.OperationAborted: break; default: diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 9601ffce5b..335bc19e30 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -80,7 +80,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods } else { - m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); + if (m_dialogModule != null) + m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e5ddeb5222..cda90d6b15 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -939,11 +939,14 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysicsActor != null) { - m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); - m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; - m_physicsActor.UnSubscribeEvents(); - m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; - PhysicsActor = null; + lock (m_scene.SyncRoot) + { + m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; + m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); + m_physicsActor.UnSubscribeEvents(); + m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; + PhysicsActor = null; + } } } @@ -3192,25 +3195,30 @@ namespace OpenSim.Region.Framework.Scenes /// public void AddToPhysicalScene(bool isFlying) { - PhysicsScene scene = m_scene.PhysicsScene; + lock (m_scene.SyncRoot) + { + PhysicsScene scene = m_scene.PhysicsScene; - PhysicsVector pVec = - new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, - AbsolutePosition.Z); - - if (m_avHeight == 127.0f) - { - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), isFlying); + PhysicsVector pVec = + new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, + AbsolutePosition.Z); + + if (m_avHeight == 127.0f) + { + m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), + isFlying); + } + else + { + m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, + new PhysicsVector(0, 0, m_avHeight), isFlying); + } + scene.AddPhysicsActorTaint(m_physicsActor); + //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; + m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; + m_physicsActor.SubscribeEvents(1000); + m_physicsActor.LocalID = LocalId; } - else - { - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight), isFlying); - } - scene.AddPhysicsActorTaint(m_physicsActor); - //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; - m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; - m_physicsActor.SubscribeEvents(1000); - m_physicsActor.LocalID = LocalId; } // Event called by the physics plugin to tell the avatar about a collision. diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index c160cda532..dae19c358e 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -137,6 +137,14 @@ namespace OpenSim.Region.Physics.OdePlugin if (PhysicsVector.isFinite(pos)) { + if (pos.Z > 9999999) + { + pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + } + if (pos.Z < -90000) + { + pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + } _position = pos; m_taintPosition.X = pos.X; m_taintPosition.Y = pos.Y; @@ -396,6 +404,15 @@ namespace OpenSim.Region.Physics.OdePlugin { if (PhysicsVector.isFinite(value)) { + if (value.Z > 9999999) + { + value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + } + if (value.Z < -90000) + { + value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + } + _position.X = value.X; _position.Y = value.Y; _position.Z = value.Z; @@ -780,6 +797,41 @@ namespace OpenSim.Region.Physics.OdePlugin } //PidStatus = true; + d.Vector3 localpos = d.BodyGetPosition(Body); + PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z); + if (!PhysicsVector.isFinite(localPos)) + { + + m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); + _parent_scene.RemoveCharacter(this); + // destroy avatar capsule and related ODE data + if (Amotor != IntPtr.Zero) + { + // Kill the Amotor + d.JointDestroy(Amotor); + Amotor = IntPtr.Zero; + } + //kill the Geometry + _parent_scene.waitForSpaceUnlock(_parent_scene.space); + + if (Body != IntPtr.Zero) + { + //kill the body + d.BodyDestroy(Body); + + Body = IntPtr.Zero; + } + + if (Shell != IntPtr.Zero) + { + d.GeomDestroy(Shell); + _parent_scene.geom_name_map.Remove(Shell); + Shell = IntPtr.Zero; + } + + return; + } + PhysicsVector vec = new PhysicsVector(); d.Vector3 vel = d.BodyGetLinearVel(Body); float movementdivisor = 1f; @@ -901,6 +953,34 @@ namespace OpenSim.Region.Physics.OdePlugin else { m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()"); + m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); + _parent_scene.RemoveCharacter(this); + // destroy avatar capsule and related ODE data + if (Amotor != IntPtr.Zero) + { + // Kill the Amotor + d.JointDestroy(Amotor); + Amotor = IntPtr.Zero; + } + //kill the Geometry + _parent_scene.waitForSpaceUnlock(_parent_scene.space); + + if (Body != IntPtr.Zero) + { + //kill the body + d.BodyDestroy(Body); + + Body = IntPtr.Zero; + } + + if (Shell != IntPtr.Zero) + { + d.GeomDestroy(Shell); + _parent_scene.geom_name_map.Remove(Shell); + Shell = IntPtr.Zero; + } + + return; } } @@ -1044,21 +1124,30 @@ namespace OpenSim.Region.Physics.OdePlugin { _parent_scene.RemoveCharacter(this); // destroy avatar capsule and related ODE data - - // Kill the Amotor - d.JointDestroy(Amotor); - Amotor = IntPtr.Zero; - + if (Amotor != IntPtr.Zero) + { + // Kill the Amotor + d.JointDestroy(Amotor); + Amotor = IntPtr.Zero; + } //kill the Geometry _parent_scene.waitForSpaceUnlock(_parent_scene.space); - d.GeomDestroy(Shell); - _parent_scene.geom_name_map.Remove(Shell); - Shell = IntPtr.Zero; + if (Body != IntPtr.Zero) + { + //kill the body + d.BodyDestroy(Body); + + Body = IntPtr.Zero; + } + + if (Shell != IntPtr.Zero) + { + d.GeomDestroy(Shell); + _parent_scene.geom_name_map.Remove(Shell); + Shell = IntPtr.Zero; + } - //kill the body - d.BodyDestroy(Body); - Body=IntPtr.Zero; } m_isPhysical = m_tainted_isPhysical; diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index cdbf1db47a..d427401d07 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -131,6 +131,9 @@ namespace OpenSim.Region.UserStatistics } m_scene.Add(scene); + if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID)) + m_simstatsCounters.Remove(scene.RegionInfo.RegionID); + m_simstatsCounters.Add(scene.RegionInfo.RegionID, new USimStatsData(scene.RegionInfo.RegionID)); scene.StatsReporter.OnSendStatsResult += ReceiveClassicSimStatsPacket; } @@ -293,6 +296,10 @@ namespace OpenSim.Region.UserStatistics } dbConn.Close(); dbConn.Dispose(); + m_sessions.Clear(); + m_scene.Clear(); + reports.Clear(); + m_simstatsCounters.Clear(); } public virtual string Name