From 1c040d8c1ed5ee1ba1e80aa1d248a9b06d1790a5 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 18 May 2010 03:24:43 -0700 Subject: Fix to the scenario where we send an agent to a neighbouring sim (via teleport), then tell our neighbours to close the agents.. thereby disconnecting the user. Added a new CloseChildAgent method in lieu of CloseAgent. This has been a long standing problem - with any luck this will cure it. --- .../Simulation/LocalSimulationConnector.cs | 17 ++++++++++++++++ .../Simulation/RemoteSimulationConnector.cs | 15 ++++++++++++++ .../Framework/Interfaces/IInterregionComms.cs | 8 ++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 23 +++++++++++++++++----- .../Framework/Scenes/SceneCommunicationService.cs | 2 +- 5 files changed, 59 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index e32dbb3..329a259 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -290,6 +290,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; } + public bool CloseChildAgent(GridRegion destination, UUID id) + { + if (destination == null) + return false; + + foreach (Scene s in m_sceneList) + { + if (s.RegionInfo.RegionID == destination.RegionID) + { + //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); + return s.IncomingCloseChildAgent(id); + } + } + //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); + return false; + } + /** * Object-related communications */ diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 9e8454f..377c868 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -253,6 +253,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; } + public bool CloseChildAgent(GridRegion destination, UUID id) + { + if (destination == null) + return false; + + // Try local first + if (m_localBackend.CloseChildAgent(destination, id)) + return true; + + // else do the remote thing + if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) + return m_remoteConnector.CloseChildAgent(destination, id); + + return false; + } public bool CloseAgent(GridRegion destination, UUID id) { diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs index 2d6287f..67a500f 100644 --- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs @@ -68,6 +68,14 @@ namespace OpenSim.Region.Framework.Interfaces bool SendReleaseAgent(ulong regionHandle, UUID id, string uri); /// + /// Close chid agent. + /// + /// + /// + /// + bool SendCloseChildAgent(ulong regionHandle, UUID id); + + /// /// Close agent. /// /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1b08c50..f331984 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3914,12 +3914,22 @@ namespace OpenSim.Region.Framework.Scenes return false; } + public bool IncomingCloseAgent(UUID agentID) + { + return IncomingCloseAgent(agentID, false); + } + + public bool IncomingCloseChildAgent(UUID agentID) + { + return IncomingCloseAgent(agentID, true); + } + /// /// Tell a single agent to disconnect from the region. /// - /// /// - public bool IncomingCloseAgent(UUID agentID) + /// + public bool IncomingCloseAgent(UUID agentID, bool childOnly) { //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); @@ -3931,7 +3941,7 @@ namespace OpenSim.Region.Framework.Scenes { m_sceneGraph.removeUserCount(false); } - else + else if (!childOnly) { m_sceneGraph.removeUserCount(true); } @@ -3947,9 +3957,12 @@ namespace OpenSim.Region.Framework.Scenes } else presence.ControllingClient.SendShutdownConnectionNotice(); + presence.ControllingClient.Close(); + } + else if (!childOnly) + { + presence.ControllingClient.Close(); } - - presence.ControllingClient.Close(); return true; } diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 9d0e6f4..6309cd9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -281,7 +281,7 @@ namespace OpenSim.Region.Framework.Scenes uint x = 0, y = 0; Utils.LongToUInts(regionHandle, out x, out y); GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - m_scene.SimulationService.CloseAgent(destination, agentID); + m_scene.SimulationService.CloseChildAgent(destination, agentID); } private void SendCloseChildAgentCompleted(IAsyncResult iar) -- cgit v1.1