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)
---
.../Framework/EntityTransfer/EntityTransferModule.cs | 19 ++++++++++++++++---
.../EntityTransfer/HGEntityTransferModule.cs | 14 ++++----------
.../Simulation/LocalSimulationConnector.cs | 4 ++--
.../Simulation/RemoteSimulationConnector.cs | 6 +++---
OpenSim/Region/Framework/Scenes/Scene.cs | 13 ++++++++-----
.../Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 2 +-
6 files changed, 34 insertions(+), 24 deletions(-)
(limited to 'OpenSim/Region')
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));
--
cgit v1.1