diff options
Addresses a race condition that happened between the viewer and the departing region wrt the creation of the child agent in the receiving region, and that resulted in failed TPs.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 194d782..8d3792c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2911,7 +2911,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2911 | // m_log.DebugFormat( | 2911 | // m_log.DebugFormat( |
2912 | // "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 2912 | // "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
2913 | 2913 | ||
2914 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); | 2914 | // We have to wait until the viewer contacts this region after receiving EAC. |
2915 | // That calls AddNewClient, which finally creates the ScenePresence | ||
2916 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | ||
2915 | if (childAgentUpdate != null) | 2917 | if (childAgentUpdate != null) |
2916 | { | 2918 | { |
2917 | childAgentUpdate.ChildAgentDataUpdate(cAgentData); | 2919 | childAgentUpdate.ChildAgentDataUpdate(cAgentData); |
@@ -2947,6 +2949,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
2947 | return false; | 2949 | return false; |
2948 | } | 2950 | } |
2949 | 2951 | ||
2952 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | ||
2953 | { | ||
2954 | int ntimes = 10; | ||
2955 | ScenePresence childAgentUpdate = null; | ||
2956 | while ((childAgentUpdate = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | ||
2957 | Thread.Sleep(1000); | ||
2958 | return childAgentUpdate; | ||
2959 | |||
2960 | } | ||
2961 | |||
2950 | public virtual bool IncomingReleaseAgent(UUID id) | 2962 | public virtual bool IncomingReleaseAgent(UUID id) |
2951 | { | 2963 | { |
2952 | return m_sceneGridService.ReleaseAgent(id); | 2964 | return m_sceneGridService.ReleaseAgent(id); |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 7c0df39..ed455f4 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1000,7 +1000,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1000 | /// </summary> | 1000 | /// </summary> |
1001 | public void CompleteMovement() | 1001 | public void CompleteMovement() |
1002 | { | 1002 | { |
1003 | //Console.WriteLine("\n CompleteMovement \n"); | ||
1004 | Vector3 look = Velocity; | 1003 | Vector3 look = Velocity; |
1005 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) | 1004 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) |
1006 | { | 1005 | { |
@@ -1017,7 +1016,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1017 | 1016 | ||
1018 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | 1017 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1019 | { | 1018 | { |
1020 | //m_log.DebugFormat("Found callback URI {0}", m_callbackURI); | 1019 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); |
1021 | Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); | 1020 | Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); |
1022 | m_callbackURI = null; | 1021 | m_callbackURI = null; |
1023 | } | 1022 | } |