Added checks for failed UpdateAgent calls.

soprefactor
Diva Canto 2010-06-12 12:08:45 -07:00
parent b9c01a1c42
commit 66619b5996
2 changed files with 31 additions and 17 deletions

View File

@ -396,7 +396,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.Position = position;
SetCallbackURL(agent, sp.Scene.RegionInfo);
UpdateAgent(reg, finalDestination, agent);
if (!UpdateAgent(reg, finalDestination, agent))
{
// Region doesn't take it
Fail(sp, finalDestination);
return;
}
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID);
@ -421,21 +426,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// that the client contacted the destination before we send the attachments and close things here.
if (!WaitForCallback(sp.UUID))
{
// Client never contacted destination. Let's restore everything back
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
// Fail. Reset it back
sp.IsChildAgent = false;
ResetFromTransit(sp.UUID);
// Yikes! We should just have a ref to scene here.
//sp.Scene.InformClientOfNeighbours(sp);
EnableChildAgents(sp);
// Finally, kill the agent we just created at the destination.
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
Fail(sp, finalDestination);
return;
}
@ -475,6 +466,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
}
private void Fail(ScenePresence sp, GridRegion finalDestination)
{
// Client never contacted destination. Let's restore everything back
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
// Fail. Reset it back
sp.IsChildAgent = false;
ResetFromTransit(sp.UUID);
EnableChildAgents(sp);
// Finally, kill the agent we just created at the destination.
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
}
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
{
@ -813,7 +820,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort +
"/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent);
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
{
// region doesn't take it
ResetFromTransit(agent.UUID);
return agent;
}
// Next, let's close the child agent connections that are too far away.
agent.CloseChildAgents(neighbourx, neighboury);

View File

@ -3903,6 +3903,8 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat(
"[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
// XPTO: if this agent is not allowed here as root, always return false
// We have to wait until the viewer contacts this region after receiving EAC.
// That calls AddNewClient, which finally creates the ScenePresence
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);