From 172bb05ec257b1abb3554eeb6c5b8bcbdae89b78 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 25 Nov 2015 04:13:13 +0000
Subject:  suspend the use of DisableSimulator, that is causing teleport and
 crossing issues

---
 OpenSim/Framework/Util.cs                           |  2 +-
 .../EntityTransfer/EntityTransferModule.cs          | 21 ++++++++++-----------
 OpenSim/Region/Framework/Scenes/ScenePresence.cs    |  8 ++++----
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 4dafaef..4aad578 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -753,7 +753,7 @@ namespace OpenSim.Framework
             newy *= Constants.RegionSize;
             if (oldy + oldsizey + drawdist < newy)
                 return true;
-            if (newy + newsizey + drawdist< oldy)
+            if (newy + newsizey + drawdist < oldy)
                 return true;
 
             return false;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 3fe8171..9899ccd 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1068,8 +1068,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
                 // This sleep can be increased if necessary.  However, whilst it's active,
                 // an agent cannot teleport back to this region if it has teleported away.
                 Thread.Sleep(2000);
-                if (m_eqModule != null && !sp.DoNotCloseAfterTeleport)
-                    m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID);
+//                if (m_eqModule != null && !sp.DoNotCloseAfterTeleport)
+//                    m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID);
                 Thread.Sleep(500);
                 sp.Scene.CloseAgent(sp.UUID, false);
             }
@@ -1201,8 +1201,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
             // Now let's make it officially a child agent
             sp.MakeChildAgent(destinationHandle);
 
-
-
             // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
             // go by HG hook
             if (NeedsClosing(reg, OutSideViewRange))
@@ -1217,10 +1215,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
                 // DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR
                 // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS.
 
-                Thread.Sleep(14000);
-                if (m_eqModule != null && !sp.DoNotCloseAfterTeleport)
-                    m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID);
-                Thread.Sleep(1000);
+                Thread.Sleep(15000);
+//                if (m_eqModule != null && !sp.DoNotCloseAfterTeleport)
+//                    m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID);
+//                Thread.Sleep(1000);
 
                 // OK, it got this agent. Let's close everything
                 // If we shouldn't close the agent due to some other region renewing the connection 
@@ -1806,6 +1804,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
             // Unlike a teleport, here we do not wait for the destination region to confirm the receipt.
             m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
 
+
+
+            agent.CloseChildAgents(false, neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
+
             // this may need the attachments
 
             agent.HasMovedAway(true);
@@ -1815,9 +1817,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
             // FIXME: Possibly this should occur lower down after other commands to close other agents,
             // but not sure yet what the side effects would be.
             m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
-
-            agent.CloseChildAgents(false, neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
-
             // TODO: Check since what version this wasn't needed anymore. May be as old as 0.6
 /*
             // Backwards compatibility. Best effort
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5903274..0d2c8c3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -4143,8 +4143,8 @@ namespace OpenSim.Region.Framework.Scenes
                             {
                                 byebyeRegions.Add(handle);
                                 // this should not be here
-                                if(eventQueue != null)
-                                    eventQueue.DisableSimulator(handle,UUID);
+//                                if(eventQueue != null)
+///                                    eventQueue.DisableSimulator(handle,UUID);
                             }
                         }
                         else
@@ -4154,8 +4154,8 @@ namespace OpenSim.Region.Framework.Scenes
                             {
                                 byebyeRegions.Add(handle);
                                 // this should not be here
-                                if(eventQueue != null)
-                                    eventQueue.DisableSimulator(handle,UUID);
+//                                if(eventQueue != null)
+//                                    eventQueue.DisableSimulator(handle,UUID);
                             }
                         }
                     }
-- 
cgit v1.1