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 +-
.../Server/Handlers/Simulation/AgentHandlers.cs | 23 ++++++++++++++++++++++
.../Simulation/SimulationServiceConnector.cs | 14 ++++++++++++-
OpenSim/Services/Interfaces/ISimulationService.cs | 8 ++++++++
8 files changed, 103 insertions(+), 7 deletions(-)
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)
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index ab3250d..b648e12 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -108,6 +108,11 @@ namespace OpenSim.Server.Handlers.Simulation
DoAgentDelete(request, responsedata, agentID, action, regionID);
return responsedata;
}
+ else if (method.Equals("DELETECHILD"))
+ {
+ DoChildAgentDelete(request, responsedata, agentID, action, regionID);
+ return responsedata;
+ }
else
{
m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method);
@@ -320,6 +325,24 @@ namespace OpenSim.Server.Handlers.Simulation
}
}
+ protected void DoChildAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
+ {
+ m_log.Debug(" >>> DoChildAgentDelete action:" + action + "; RegionID:" + regionID);
+
+ GridRegion destination = new GridRegion();
+ destination.RegionID = regionID;
+
+ if (action.Equals("release"))
+ ReleaseAgent(regionID, id);
+ else
+ m_SimulationService.CloseChildAgent(destination, id);
+
+ responsedata["int_response_code"] = HttpStatusCode.OK;
+ responsedata["str_response_string"] = "OpenSim agent " + id.ToString();
+
+ m_log.Debug("[AGENT HANDLER]: Child Agent Released/Deleted.");
+ }
+
protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
{
m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID);
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index ff0dd7e..8e0063b 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -442,7 +442,7 @@ namespace OpenSim.Services.Connectors.Simulation
return true;
}
- public bool CloseAgent(GridRegion destination, UUID id)
+ private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
{
string uri = string.Empty;
try
@@ -459,6 +459,8 @@ namespace OpenSim.Services.Connectors.Simulation
WebRequest request = WebRequest.Create(uri);
request.Method = "DELETE";
+ if (ChildOnly)
+ request.Method += "CHILD";
request.Timeout = 10000;
StreamReader sr = null;
@@ -491,6 +493,16 @@ namespace OpenSim.Services.Connectors.Simulation
return true;
}
+ public bool CloseChildAgent(GridRegion destination, UUID id)
+ {
+ return CloseAgent(destination, id, true);
+ }
+
+ public bool CloseAgent(GridRegion destination, UUID id)
+ {
+ return CloseAgent(destination, id, false);
+ }
+
#endregion Agents
#region Objects
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 67d7cbe..33d6fde 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -71,6 +71,14 @@ namespace OpenSim.Services.Interfaces
bool ReleaseAgent(UUID originRegion, UUID id, string uri);
///
+ /// Close child agent.
+ ///
+ ///
+ ///
+ ///
+ bool CloseChildAgent(GridRegion destination, UUID id);
+
+ ///
/// Close agent.
///
///
--
cgit v1.1