* Tear down CAPS and http handlers when an agent leaves a region (via crossing, teleport or logout)

0.6.0-stable
Justin Clarke Casey 2008-03-25 18:47:14 +00:00
parent e74892ee44
commit 8c74cf7758
3 changed files with 48 additions and 11 deletions

View File

@ -1498,11 +1498,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
m_sceneGridService.SendCloseChildAgentConnections(agentID, childknownRegions); m_sceneGridService.SendCloseChildAgentConnections(agentID, childknownRegions);
if (m_capsHandlers.ContainsKey(agentID)) RemoveCapsHandler(agentID);
{
m_capsHandlers[agentID].DeregisterHandlers();
m_capsHandlers.Remove(agentID);
}
} }
m_eventManager.TriggerClientClosed(agentID); m_eventManager.TriggerClientClosed(agentID);
@ -1717,8 +1713,8 @@ namespace OpenSim.Region.Environment.Scenes
String capsObjectPath = GetCapsPath(agentId); String capsObjectPath = GetCapsPath(agentId);
m_log.DebugFormat( m_log.DebugFormat(
"[CONNECTION DEBUGGING]: Setting up CAPS handler for avatar {0} at {1} in {2}", "[CONNECTION DEBUGGING]: Setting up CAPS handler for avatar {0} in {1}",
agentId, capsObjectPath, RegionInfo.RegionName); agentId, RegionInfo.RegionName);
Caps cap = Caps cap =
new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port, new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port,
@ -1734,6 +1730,29 @@ namespace OpenSim.Region.Environment.Scenes
m_capsHandlers[agentId] = cap; m_capsHandlers[agentId] = cap;
} }
/// <summary>
/// Remove the caps handler for a given agent.
/// </summary>
/// <param name="agentId"></param>
public void RemoveCapsHandler(LLUUID agentId)
{
if (m_capsHandlers.ContainsKey(agentId))
{
m_log.DebugFormat(
"[CONNECTION DEBUGGING]: Removing CAPS handler for root agent {0} in {1}",
agentId, RegionInfo.RegionName);
m_capsHandlers[agentId].DeregisterHandlers();
m_capsHandlers.Remove(agentId);
}
else
{
m_log.WarnFormat(
"[CONNECTION DEBUGGING]: Received request to remove CAPS handler for root agent {0} in {1}, but no such CAPS handler found!",
agentId, RegionInfo.RegionName);
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -547,6 +547,12 @@ namespace OpenSim.Region.Environment.Scenes
if(destRegionUp) if(destRegionUp)
{ {
avatar.Close(); avatar.Close();
// Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport
// failure at this point (unlike a border crossing failure). So perhaps this can never fail
// once we reach here...
avatar.Scene.RemoveCapsHandler(avatar.UUID);
m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent); m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
position, false); position, false);
@ -557,6 +563,9 @@ namespace OpenSim.Region.Environment.Scenes
"http://" + reg.ExternalHostName + ":" + reg.HttpPort "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + circuitdata.CapsPath + "0000/"; + "/CAPS/" + circuitdata.CapsPath + "0000/";
m_log.DebugFormat(
"[CONNECTION DEBUGGING]: Sending new CAPS seed url {0} to avatar {1}", capsPath, avatar.UUID);
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
capsPath); capsPath);
avatar.MakeChildAgent(); avatar.MakeChildAgent();

View File

@ -1619,6 +1619,11 @@ namespace OpenSim.Region.Environment.Scenes
SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
if (neighbourRegion != null) if (neighbourRegion != null)
{ {
// When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar
// This means we need to remove the current caps handler here and possibly compensate later,
// in case both scenes are being hosted on the same region server. Messy
m_scene.RemoveCapsHandler(UUID);
bool res = bool res =
m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos, m_scene.InformNeighbourOfCrossing(neighbourHandle, m_controllingClient.AgentId, newpos,
m_physicsActor.Flying); m_physicsActor.Flying);
@ -1640,6 +1645,10 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.SendKillObject(m_localId); m_scene.SendKillObject(m_localId);
m_scene.NotifyMyCoarseLocationChange(); m_scene.NotifyMyCoarseLocationChange();
} }
else
{
m_scene.AddCapsHandler(UUID);
}
} }
} }