From d214e2d0c4b8e1ea5e0d69e2ba94cd668be610bd Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 16 May 2013 17:12:02 +0100 Subject: [PATCH] On closing child agents, send separate asynchronous requests to each neighbour rather than sending all closes concurrently on a separate thread. This is to reduce race conditions where neighbours may be responding erratically, thus mixing up create and close agent requests in time. This mirrors OpenSimulator behaviour on enabling child agents where each region is contacted separately. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- .../Region/Framework/Scenes/SceneCommunicationService.cs | 4 +--- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 50bea6fd70..8fe9b666fd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3440,8 +3440,8 @@ namespace OpenSim.Region.Framework.Scenes List regions = avatar.KnownRegionHandles; regions.Remove(RegionInfo.RegionHandle); - // We must do this asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. - Util.FireAndForget(delegate { m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); }); + // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. + m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); } m_eventManager.TriggerClientClosed(agentID, this); diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 305f8a4d0d..8c84c9807a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -222,9 +222,7 @@ namespace OpenSim.Region.Framework.Scenes public void SendCloseChildAgentConnections(UUID agentID, List regionslst) { foreach (ulong handle in regionslst) - { - SendCloseChildAgent(agentID, handle); - } + Util.FireAndForget(delegate { SendCloseChildAgent(agentID, handle); }); } public List RequestNamedRegions(string name, int maxNumber) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2a265db5e9..9e9089b5ac 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3135,10 +3135,8 @@ namespace OpenSim.Region.Framework.Scenes if (byebyeRegions.Count > 0) { m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); - Util.FireAndForget(delegate - { - m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); - }); + + m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); } foreach (ulong handle in byebyeRegions)