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) --- OpenSim/Region/Framework/Scenes/Scene.cs | 13 ++++++++----- .../Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') 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