From 5001f61c08fea2ebfcb2590be69073d04d129d70 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 29 Jan 2010 18:59:41 -0800 Subject: * HGGridConnector is no longer necessary. * Handle logout properly. This needed an addition to IClientAPI, because of how the logout packet is currently being handled -- the agent is being removed from the scene before the different event handlers are executed, which is broken. --- .../EntityTransfer/EntityTransferModule.cs | 9 ++++--- .../EntityTransfer/HGEntityTransferModule.cs | 28 ++++++++++++---------- 2 files changed, 20 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 ee6cb04..53de269 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -268,7 +268,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (sp.ParentID != (uint)0) sp.StandUp(); - m_log.Debug("XXX HERE 1"); if (!sp.ValidateAttachments()) { sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); @@ -351,7 +350,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // 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); + Thread.Sleep(200); eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); @@ -428,13 +427,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } - KillEntity(sp.Scene, sp.LocalId); - - sp.MakeChildAgent(); // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it CrossAttachmentsIntoNewRegion(finalDestination, sp, true); + KillEntity(sp.Scene, sp.LocalId); + + sp.MakeChildAgent(); // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index fbf8be9..28593fc 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -81,16 +81,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_Enabled) { scene.RegisterModuleInterface(this); - scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(OnNewClient); } } protected override void OnNewClient(IClientAPI client) { - base.OnNewClient(client); - client.OnLogout += new Action(OnLogout); + client.OnTeleportHomeRequest += TeleportHome; + client.OnConnectionClosed += new Action(OnConnectionClosed); } + public override void RegionLoaded(Scene scene) { base.RegionLoaded(scene); @@ -234,18 +234,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return false; } - void OnLogout(IClientAPI obj) + void OnConnectionClosed(IClientAPI obj) { - m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: client {0} logged out in {1}", obj.AgentId, obj.Scene.RegionInfo.RegionName); - AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); - - if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) + if (obj.IsLoggingOut) { - string url = aCircuit.ServiceURLs["HomeURI"].ToString(); - IUserAgentService security = new UserAgentServiceConnector(url); - security.LogoutAgent(obj.AgentId, obj.SessionId); - } + AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); + if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) + { + string url = aCircuit.ServiceURLs["HomeURI"].ToString(); + IUserAgentService security = new UserAgentServiceConnector(url); + security.LogoutAgent(obj.AgentId, obj.SessionId); + //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url); + } + else + m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId); + } } #endregion -- cgit v1.1