From b2e6ec9e12ad07eb08496ebe8ca0476b793017d5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 17 Jan 2010 18:04:55 -0800 Subject: Agent gets there through the Gatekeeper, but still a few quirks to fix. --- .../EntityTransfer/EntityTransferModule.cs | 23 ++-- .../EntityTransfer/HGEntityTransferModule.cs | 27 +++++ .../Resources/CoreModulePlugin.addin.xml | 1 + .../AuthenticationServiceInConnectorModule.cs | 119 +++++++++++++++++++++ 4 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index d0171fe..8268bfa 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -239,12 +239,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer //avatar.Scene.RemoveCapsHandler(avatar.UUID); string capsPath = String.Empty; + + AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); - agentCircuit.BaseFolder = UUID.Zero; - agentCircuit.InventoryFolder = UUID.Zero; agentCircuit.startpos = position; agentCircuit.child = true; agentCircuit.Appearance = sp.Appearance; + if (currentAgentCircuit != null) + agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) { @@ -255,9 +257,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string reason = String.Empty; // Let's create an agent there if one doesn't exist yet. - if (!m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason)) + if (!CreateAgent(reg, finalDestination, agentCircuit, teleportFlags, out reason)) { - sp.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", + sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", reason)); return; } @@ -345,8 +347,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.CallbackURI = "http://" + sp.Scene.RegionInfo.ExternalHostName + ":" + sp.Scene.RegionInfo.HttpPort + "/agent/" + sp.UUID.ToString() + "/" + sp.Scene.RegionInfo.RegionID.ToString() + "/release/"; - // Straight to the region. Safe. - m_aScene.SimulationService.UpdateAgent(reg, agent); + UpdateAgent(reg, finalDestination, agent); m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); @@ -444,6 +445,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } + protected virtual bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) + { + return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); + } + + protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) + { + return m_aScene.SimulationService.UpdateAgent(reg, agent); + } + protected void KillEntity(Scene scene, uint localID) { scene.SendKillObject(localID); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 5d88311..e5a862d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Connectors.Hypergrid; @@ -58,6 +59,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } + private GatekeeperServiceConnector m_GatekeeperConnector; + #region ISharedRegionModule public override string Name @@ -74,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (name == Name) { m_agentsInTransit = new List(); + m_GatekeeperConnector = new GatekeeperServiceConnector(); m_Enabled = true; m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); } @@ -131,6 +135,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return true; } + protected override bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) + { + reason = string.Empty; + if (reg.RegionLocX != finalDestination.RegionLocX && reg.RegionLocY != finalDestination.RegionLocY) + { + // this user is going to another grid + reg.RegionName = finalDestination.RegionName; + return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason); + } + + return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); + } + + protected override bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) + { + if (reg.RegionLocX != finalDestination.RegionLocX && reg.RegionLocY != finalDestination.RegionLocY) + { + // this user is going to another grid + return m_GatekeeperConnector.UpdateAgent(reg, agent); + } + + return m_aScene.SimulationService.UpdateAgent(reg, agent); + } #endregion } diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 08a90a2..c61198d 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -66,6 +66,7 @@ \ \ \ + \ diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs new file mode 100644 index 0000000..02acddc --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs @@ -0,0 +1,119 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using System.Collections.Generic; +using log4net; +using Nini.Config; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Server.Base; +using OpenSim.Server.Handlers.Base; +using OpenSim.Server.Handlers.Authentication; +using OpenSim.Services.Interfaces; + +namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication +{ + public class AuthenticationServiceInConnectorModule : ISharedRegionModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static bool m_Enabled = false; + + private IConfigSource m_Config; + bool m_Registered = false; + + #region IRegionModule interface + + public void Initialise(IConfigSource config) + { + m_Config = config; + IConfig moduleConfig = config.Configs["Modules"]; + if (moduleConfig != null) + { + m_Enabled = moduleConfig.GetBoolean("AuthenticationServiceInConnector", false); + if (m_Enabled) + { + m_log.Info("[AUTHENTICATION IN CONNECTOR]: Authentication Service In Connector enabled"); + } + + } + + } + + public void PostInitialise() + { + } + + public void Close() + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public string Name + { + get { return "AuthenticationServiceInConnectorModule"; } + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + + if (!m_Registered) + { + m_Registered = true; + + m_log.Info("[AUTHENTICATION IN CONNECTOR]: Starting..."); + + new AuthenticationServiceConnector(m_Config, MainServer.Instance, "AuthenticationService"); + } + + } + + #endregion + + } +} -- cgit v1.1