From 66619b599654397fb09da0f40d3d7e69dafcfb41 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 12 Jun 2010 12:08:45 -0700 Subject: Added checks for failed UpdateAgent calls. --- .../EntityTransfer/EntityTransferModule.cs | 46 ++++++++++++++-------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a33f5c5..5d50a83 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -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); -- cgit v1.1 From 19558f380a1e9cbaff849eb15262266ea79b60d2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 13 Jun 2010 19:06:22 -0700 Subject: Fixes the long-standing RegionUp bug! Plus lots of other cleanups related to neighbours. --- .../EntityTransfer/EntityTransferModule.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 5d50a83..ab1cfc3 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -922,12 +922,40 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// public void EnableChildAgent(ScenePresence sp, GridRegion region) { + m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName); + + AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); agent.BaseFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero; agent.startpos = new Vector3(128, 128, 70); agent.child = true; agent.Appearance = sp.Appearance; + agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); + + agent.ChildrenCapSeeds = new Dictionary(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); + m_log.DebugFormat("[XXX] Seeds 1 {0}", agent.ChildrenCapSeeds.Count); + + if (!agent.ChildrenCapSeeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) + agent.ChildrenCapSeeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); + m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count); + + sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath); + foreach (ulong h in agent.ChildrenCapSeeds.Keys) + m_log.DebugFormat("[XXX] --> {0}", h); + m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle); + agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath); + + if (sp.Scene.CapsModule != null) + { + sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, agent.ChildrenCapSeeds); + } + + if (currentAgentCircuit != null) + { + agent.ServiceURLs = currentAgentCircuit.ServiceURLs; + agent.Viewer = currentAgentCircuit.Viewer; + } InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, -- cgit v1.1