From 339fd602db4a0182777c9acc0b7486d91e9f904d Mon Sep 17 00:00:00 2001 From: diva Date: Mon, 22 Dec 2008 07:06:01 +0000 Subject: This commit is a major change on the TP process. Several things were wrong and/or broken. (a) ExpectAvatarCrossing is redundant (and bad) because the client triggers the same method on the receiving region after it receives TeleportFinish. (b) At least two of the *Async methods in SceneCommunicationService weren't asynchronous at all; I made them be asynchronous. Crossing fingers... --- .../Hypergrid/HGSceneCommunicationService.cs | 42 +++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Hypergrid') diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs index ced5b86..78d5725 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs @@ -196,20 +196,20 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid agent.InventoryFolder = UUID.Zero; agent.startpos = position; agent.child = true; - if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) + if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) { - Thread.Sleep(2000); - - // brand new agent + // brand new agent, let's create a new caps seed agent.CapsPath = Util.GetRandomCapsPath(); - if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) - { - avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); - return; - } + } - Thread.Sleep(3000); + if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) + { + avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); + return; + } + if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) + { // TODO Should construct this behind a method capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort @@ -220,6 +220,11 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid OSD Item = EventQueueHelper.EnableSimulator(realHandle, endPoint); eq.Enqueue(Item, avatar.UUID); + // ES makes the client send a UseCircuitCode message to the destination, + // which triggers a bunch of things there. + // So let's wait + Thread.Sleep(2000); + Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, endPoint.ToString(), capsPath); eq.Enqueue(Item, avatar.UUID); } @@ -237,8 +242,8 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid + "/CAPS/" + agent.CapsPath + "0000/"; } - m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, - position, false); + //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, + // position, false); //if (!m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, // position, false)) @@ -251,7 +256,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid // return; //} - Thread.Sleep(7000); + avatar.MakeChildAgent(); + // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it + avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); m_log.DebugFormat( "[CAPS]: Sending new CAPS seed url {0} to client {1}", agent.CapsPath, avatar.UUID); @@ -276,9 +283,6 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid /// Hypergrid mod stop /// - avatar.MakeChildAgent(); - Thread.Sleep(3000); - avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); if (KiPrimitive != null) { KiPrimitive(avatar.LocalId); @@ -293,7 +297,11 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid /// if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) { - Thread.Sleep(5000); + // FinishTeleport makes the client send CompleteMovementIntoRegion (at the destination), which + // trigers a whole shebang of things there. So let's wait plenty before we disconnect. + // The user is already there anyway. + Thread.Sleep(8000); + avatar.Close(); CloseConnection(avatar.UUID); } // if (teleport success) // seems to be always success here -- cgit v1.1