From 06e0528d0b9929cbd8d2b360b0baa00288340d13 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Wed, 9 Apr 2014 08:03:25 +0300
Subject: In teleports, pass the source region to the destination (similar to
an HTTP referrer)
---
.../EntityTransfer/EntityTransferModule.cs | 19 ++++++++--
.../EntityTransfer/HGEntityTransferModule.cs | 14 ++-----
.../Simulation/LocalSimulationConnector.cs | 4 +-
.../Simulation/RemoteSimulationConnector.cs | 6 +--
OpenSim/Region/Framework/Scenes/Scene.cs | 13 ++++---
.../Scenes/Tests/ScenePresenceAgentTests.cs | 2 +-
OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 5 ++-
.../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 5 ++-
.../Server/Handlers/Simulation/AgentHandlers.cs | 23 ++++++++++--
.../Hypergrid/UserAgentServiceConnector.cs | 43 +++-------------------
.../Simulation/SimulationServiceConnector.cs | 30 ++++++++++-----
.../Services/HypergridService/GatekeeperService.cs | 14 ++++---
.../Services/HypergridService/UserAgentService.cs | 12 +++---
OpenSim/Services/Interfaces/IGridService.cs | 14 ++++++-
OpenSim/Services/Interfaces/IHypergridServices.cs | 5 ++-
OpenSim/Services/Interfaces/ISimulationService.cs | 4 +-
OpenSim/Services/LLLoginService/LLLoginService.cs | 11 +-----
OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +-
18 files changed, 122 insertions(+), 104 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index f7470bd..53be68f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -111,6 +111,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
///
private Stat m_interRegionTeleportFailures;
+ protected string m_ThisHomeURI;
+
protected bool m_Enabled = false;
public Scene Scene { get; private set; }
@@ -207,6 +209,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string transferVersionName = "SIMULATION";
float maxTransferVersion = 0.2f;
+ IConfig hypergridConfig = source.Configs["Hypergrid"];
+ if (hypergridConfig != null)
+ {
+ m_ThisHomeURI = hypergridConfig.GetString("HomeURI", string.Empty);
+ if (m_ThisHomeURI != string.Empty && !m_ThisHomeURI.EndsWith("/"))
+ m_ThisHomeURI += '/';
+ }
+
IConfig transferConfig = source.Configs["EntityTransfer"];
if (transferConfig != null)
{
@@ -1296,8 +1306,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
{
+ GridRegion source = new GridRegion(Scene.RegionInfo);
+ source.RawServerURI = m_ThisHomeURI;
+
logout = false;
- bool success = Scene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
+ bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, out reason);
if (success)
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
@@ -2262,7 +2275,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Thread.Sleep(500);
Scene scene = sp.Scene;
-
+
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
@@ -2271,7 +2284,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string reason = String.Empty;
- bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
+ bool regionAccepted = scene.SimulationService.CreateAgent(null, reg, a, (uint)TeleportFlags.Default, out reason);
if (regionAccepted && newAgent)
{
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 52e0d5a..79bff06 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -53,7 +53,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private int m_levelHGTeleport = 0;
- private string m_ThisHomeURI;
private GatekeeperServiceConnector m_GatekeeperConnector;
private IUserAgentService m_UAS;
@@ -145,14 +144,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
}
}
-
- moduleConfig = source.Configs["Hypergrid"];
- if (moduleConfig != null)
- {
- m_ThisHomeURI = moduleConfig.GetString("HomeURI", string.Empty);
- if (m_ThisHomeURI != string.Empty && !m_ThisHomeURI.EndsWith("/"))
- m_ThisHomeURI += '/';
- }
}
public override void AddRegion(Scene scene)
@@ -296,7 +287,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
else
connector = new UserAgentServiceConnector(userAgentDriver);
- bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, false, out reason);
+ GridRegion source = new GridRegion(Scene.RegionInfo);
+ source.RawServerURI = m_ThisHomeURI;
+
+ bool success = connector.LoginAgentToGrid(source, agentCircuit, reg, finalDestination, false, out reason);
logout = success; // flag for later logout from this grid; this is an HG TP
if (success)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index dc06e4b..3348b42 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -205,7 +205,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
* Agent-related communications
*/
- public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
+ public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
{
if (destination == null)
{
@@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
if (m_scenes.ContainsKey(destination.RegionID))
{
// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
- return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason);
+ return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, source, out reason);
}
reason = "Did not find region " + destination.RegionName;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 5f43f08..8436488 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
* Agent-related communications
*/
- public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
+ public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
{
if (destination == null)
{
@@ -172,13 +172,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
}
// Try local first
- if (m_localBackend.CreateAgent(destination, aCircuit, teleportFlags, out reason))
+ if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, out reason))
return true;
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionID))
{
- return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason);
+ return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, out reason);
}
return false;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4013fa7..2ccb28d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3382,12 +3382,13 @@ namespace OpenSim.Region.Framework.Scenes
///
/// CircuitData of the agent who is connecting
///
+ /// Source region (may be null)
/// Outputs the reason for the false response on this string
/// True if the region accepts this agent. False if it does not. False will
/// also return a reason.
- public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
+ public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, GridRegion source, out string reason)
{
- return NewUserConnection(agent, teleportFlags, out reason, true);
+ return NewUserConnection(agent, teleportFlags, source, out reason, true);
}
///
@@ -3407,12 +3408,13 @@ namespace OpenSim.Region.Framework.Scenes
/// the LLUDP stack).
///
/// CircuitData of the agent who is connecting
+ /// Source region (may be null)
/// Outputs the reason for the false response on this string
/// True for normal presence. False for NPC
/// or other applications where a full grid/Hypergrid presence may not be required.
/// True if the region accepts this agent. False if it does not. False will
/// also return a reason.
- public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup)
+ public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup)
{
bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 ||
(teleportFlags & (uint)TPFlags.ViaHGLogin) != 0);
@@ -3431,7 +3433,7 @@ namespace OpenSim.Region.Framework.Scenes
// Don't disable this log message - it's too helpful
string curViewer = Util.GetViewerName(acd);
m_log.DebugFormat(
- "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})",
+ "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9}. {10}",
RegionInfo.RegionName,
(acd.child ? "child" : "root"),
acd.firstname,
@@ -3441,7 +3443,8 @@ namespace OpenSim.Region.Framework.Scenes
acd.IPAddress,
curViewer,
((TPFlags)teleportFlags).ToString(),
- acd.startpos
+ acd.startpos,
+ (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI)
);
if (!LoginsEnabled)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 1ff1329..e2ed9c8 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -228,7 +228,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// *** This is the first stage, when a neighbouring region is told that a viewer is about to try and
// establish a child scene presence. We pass in the circuit code that the client has to connect with ***
// XXX: ViaLogin may not be correct here.
- scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason);
+ scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, out reason);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
index adc2fbc..95a0510 100644
--- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
@@ -61,9 +61,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
m_Proxy = proxy;
}
- protected override bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
+ protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination,
+ AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
{
- return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason);
+ return m_GatekeeperService.LoginAgent(source, aCircuit, destination, out reason);
}
}
}
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index 04bb9e8..e787f7c 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -117,9 +117,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
- protected override bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
+ protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination,
+ AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
{
- return m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, fromLogin, out reason);
+ return m_UserAgentService.LoginAgentToGrid(source, aCircuit, gatekeeper, destination, fromLogin, out reason);
}
}
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index c495b60..0d7f259 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -307,13 +307,29 @@ namespace OpenSim.Server.Handlers.Simulation
return;
}
+ GridRegion source = null;
+
+ if (args.ContainsKey("source_uuid"))
+ {
+ source = new GridRegion();
+ source.RegionLocX = Int32.Parse(args["source_x"].AsString());
+ source.RegionLocY = Int32.Parse(args["source_y"].AsString());
+ source.RegionName = args["source_name"].AsString();
+ source.RegionID = UUID.Parse(args["source_uuid"].AsString());
+
+ if (args.ContainsKey("source_server_uri"))
+ source.RawServerURI = args["source_server_uri"].AsString();
+ else
+ source.RawServerURI = null;
+ }
+
OSDMap resp = new OSDMap(2);
string reason = String.Empty;
// This is the meaning of POST agent
//m_regionClient.AdjustUserInformation(aCircuit);
//bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
- bool result = CreateAgent(gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason);
+ bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason);
resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result);
@@ -387,9 +403,10 @@ namespace OpenSim.Server.Handlers.Simulation
}
// subclasses can override this
- protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
+ protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination,
+ AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
{
- return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
+ return m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason);
}
}
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 61f8516..8abd046 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -116,7 +116,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
// The Login service calls this interface with fromLogin=true
// Sims call it with fromLogin=false
// Either way, this is verified by the handler
- public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason)
+ public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason)
{
reason = String.Empty;
@@ -138,56 +138,25 @@ namespace OpenSim.Services.Connectors.Hypergrid
Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI);
uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome;
- return CreateAgent(home, aCircuit, flags, out reason);
+ return CreateAgent(source, home, aCircuit, flags, out reason);
}
// The simulators call this interface
- public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
+ public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
{
- return LoginAgentToGrid(aCircuit, gatekeeper, destination, false, out reason);
+ return LoginAgentToGrid(source, aCircuit, gatekeeper, destination, false, out reason);
}
- protected override void PackData(OSDMap args, AgentCircuitData aCircuit, GridRegion destination, uint flags)
+ protected override void PackData(OSDMap args, GridRegion source, AgentCircuitData aCircuit, GridRegion destination, uint flags)
{
- base.PackData(args, aCircuit, destination, flags);
+ base.PackData(args, source, aCircuit, destination, flags);
args["gatekeeper_serveruri"] = OSD.FromString(m_Gatekeeper.ServerURI);
args["gatekeeper_host"] = OSD.FromString(m_Gatekeeper.ExternalHostName);
args["gatekeeper_port"] = OSD.FromString(m_Gatekeeper.HttpPort.ToString());
args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
}
- protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress)
- {
- OSDMap args = null;
- try
- {
- args = aCircuit.PackAgentCircuitData();
- }
- catch (Exception e)
- {
- m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
- }
-
- // Add the input arguments
- args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI);
- args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName);
- args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString());
- args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
- args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
- args["destination_name"] = OSD.FromString(destination.RegionName);
- args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
- args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
-
- // 10/3/2010
- // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.
- // This need cleaning elsewhere...
- //if (ipaddress != null)
- // args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
-
- return args;
- }
-
public void SetClientToken(UUID sessionID, string token)
{
// no-op
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 98686f8..a5520c4 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -79,22 +79,32 @@ namespace OpenSim.Services.Connectors.Simulation
return "agent/";
}
- protected virtual void PackData(OSDMap args, AgentCircuitData aCircuit, GridRegion destination, uint flags)
+ protected virtual void PackData(OSDMap args, GridRegion source, AgentCircuitData aCircuit, GridRegion destination, uint flags)
{
- args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
- args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
- args["destination_name"] = OSD.FromString(destination.RegionName);
- args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
- args["teleport_flags"] = OSD.FromString(flags.ToString());
+ if (source != null)
+ {
+ args["source_x"] = OSD.FromString(source.RegionLocX.ToString());
+ args["source_y"] = OSD.FromString(source.RegionLocY.ToString());
+ args["source_name"] = OSD.FromString(source.RegionName);
+ args["source_uuid"] = OSD.FromString(source.RegionID.ToString());
+ if (!String.IsNullOrEmpty(source.RawServerURI))
+ args["source_server_uri"] = OSD.FromString(source.RawServerURI);
+ }
+
+ args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
+ args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
+ args["destination_name"] = OSD.FromString(destination.RegionName);
+ args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
+ args["teleport_flags"] = OSD.FromString(flags.ToString());
}
- public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
+ public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
{
string tmp = String.Empty;
- return CreateAgent(destination, aCircuit, flags, out tmp, out reason);
+ return CreateAgent(source, destination, aCircuit, flags, out tmp, out reason);
}
- public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
+ public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
{
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
reason = String.Empty;
@@ -111,7 +121,7 @@ namespace OpenSim.Services.Connectors.Simulation
try
{
OSDMap args = aCircuit.PackAgentCircuitData();
- PackData(args, aCircuit, destination, flags);
+ PackData(args, source, aCircuit, destination, flags);
OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
bool success = result["success"].AsBoolean();
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 24b98fd..69a593b 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -230,16 +230,18 @@ namespace OpenSim.Services.HypergridService
}
#region Login Agent
- public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason)
+ public bool LoginAgent(GridRegion source, AgentCircuitData aCircuit, GridRegion destination, out string reason)
{
reason = string.Empty;
string authURL = string.Empty;
if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
- m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}",
- aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName,
- aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString());
+
+ m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9}, Teleport Flags: {10}. From region {11}",
+ aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionID,
+ aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, (TeleportFlags)aCircuit.teleportFlags,
+ (source == null) ? "Unknown" : string.Format("{0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI));
string curViewer = Util.GetViewerName(aCircuit);
@@ -428,9 +430,9 @@ namespace OpenSim.Services.HypergridService
// Preserve our TeleportFlags we have gathered so-far
loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags;
- m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag);
+ m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0}, Teleport Flags: {1}", aCircuit.Name, loginFlag);
- return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason);
+ return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason);
}
protected bool Authenticate(AgentCircuitData aCircuit)
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index b414aca..6ec2f19 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -215,7 +215,7 @@ namespace OpenSim.Services.HypergridService
return home;
}
- public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason)
+ public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason)
{
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI);
@@ -274,10 +274,12 @@ namespace OpenSim.Services.HypergridService
m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}, desired region: {2}", m_GridName, gridName, region.RegionID);
if (m_GridName == gridName)
- success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
+ {
+ success = m_GatekeeperService.LoginAgent(source, agentCircuit, finalDestination, out reason);
+ }
else
{
- success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);
+ success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);
if (success)
// Report them as nowhere
m_PresenceService.ReportAgent(agentCircuit.SessionID, UUID.Zero);
@@ -307,10 +309,10 @@ namespace OpenSim.Services.HypergridService
return true;
}
- public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason)
+ public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason)
{
reason = string.Empty;
- return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, false, out reason);
+ return LoginAgentToGrid(source, agentCircuit, gatekeeper, finalDestination, false, out reason);
}
TravelingAgentInfo CreateTravelInfo(AgentCircuitData agentCircuit, GridRegion region, bool fromLogin, out TravelingAgentInfo existing)
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 8e6279e..bbf95ad 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -142,7 +142,7 @@ namespace OpenSim.Services.Interfaces
public string ServerURI
{
get {
- if ( m_serverURI != string.Empty ) {
+ if (!String.IsNullOrEmpty(m_serverURI)) {
return m_serverURI;
} else {
if (m_httpPort == 0)
@@ -152,7 +152,7 @@ namespace OpenSim.Services.Interfaces
}
}
set {
- if ( value.EndsWith("/") ) {
+ if (value.EndsWith("/")) {
m_serverURI = value;
} else {
m_serverURI = value + '/';
@@ -161,6 +161,16 @@ namespace OpenSim.Services.Interfaces
}
protected string m_serverURI;
+ ///
+ /// Provides direct access to the 'm_serverURI' field, without returning a generated URL if m_serverURI is missing.
+ ///
+ public string RawServerURI
+ {
+ get { return m_serverURI; }
+ set { m_serverURI = value; }
+ }
+
+
public string RegionName
{
get { return m_regionName; }
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs
index 30f27ee..5e012fb 100644
--- a/OpenSim/Services/Interfaces/IHypergridServices.cs
+++ b/OpenSim/Services/Interfaces/IHypergridServices.cs
@@ -52,13 +52,14 @@ namespace OpenSim.Services.Interfaces
/// The region the visitor should enter, or null if no region can be found / is allowed
GridRegion GetHyperlinkRegion(UUID regionID, UUID agentID, string agentHomeURI, out string message);
- bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason);
+ bool LoginAgent(GridRegion source, AgentCircuitData aCircuit, GridRegion destination, out string reason);
}
public interface IUserAgentService
{
- bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason);
+ bool LoginAgentToGrid(GridRegion source, AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason);
+
void LogoutAgent(UUID userID, UUID sessionID);
///
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index d359056..375a35c 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -53,11 +53,13 @@ namespace OpenSim.Services.Interfaces
///
/// Ask the simulator hosting the destination to create an agent on that region.
///
+ /// The region that the user is coming from. Will be null if the user
+ /// logged-in directly, or arrived from a simulator that doesn't send this parameter.
///
///
///
/// Reason message in the event of a failure.
- bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason);
+ bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason);
///
/// Full child agent update.
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index a2fb308..25c9417 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -905,13 +905,6 @@ namespace OpenSim.Services.LLLoginService
SetServiceURLs(aCircuit, account);
return aCircuit;
-
- //m_UserAgentService.LoginAgentToGrid(aCircuit, GatekeeperServiceConnector, region, out reason);
- //if (simConnector.CreateAgent(region, aCircuit, 0, out reason))
- // return aCircuit;
-
- //return null;
-
}
private void SetServiceURLs(AgentCircuitData aCircuit, UserAccount account)
@@ -966,13 +959,13 @@ namespace OpenSim.Services.LLLoginService
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
{
- return simConnector.CreateAgent(region, aCircuit, (uint)flags, out reason);
+ return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);
}
private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason)
{
m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName);
- if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, true, out reason))
+ if (m_UserAgentService.LoginAgentToGrid(null, aCircuit, gatekeeper, destination, true, out reason))
return true;
return false;
}
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 345ca8a..8f44555 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -548,7 +548,7 @@ namespace OpenSim.Tests.Common
string reason;
// Stage 1: tell the scene to expect a new user connection
- if (!scene.NewUserConnection(agentData, (uint)tf, out reason))
+ if (!scene.NewUserConnection(agentData, (uint)tf, null, out reason))
Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene
--
cgit v1.1