diff options
author | Oren Hurvitz | 2014-04-09 08:03:25 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-04-09 09:22:20 +0100 |
commit | 06e0528d0b9929cbd8d2b360b0baa00288340d13 (patch) | |
tree | 0ffd33e5eda96badff712bdd78794ce6debbb392 /OpenSim/Region | |
parent | Log when the presence service logs-out all the users in a region (diff) | |
download | opensim-SC-06e0528d0b9929cbd8d2b360b0baa00288340d13.zip opensim-SC-06e0528d0b9929cbd8d2b360b0baa00288340d13.tar.gz opensim-SC-06e0528d0b9929cbd8d2b360b0baa00288340d13.tar.bz2 opensim-SC-06e0528d0b9929cbd8d2b360b0baa00288340d13.tar.xz |
In teleports, pass the source region to the destination (similar to an HTTP referrer)
Diffstat (limited to 'OpenSim/Region')
6 files changed, 34 insertions, 24 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 | |||
111 | /// </remarks> | 111 | /// </remarks> |
112 | private Stat m_interRegionTeleportFailures; | 112 | private Stat m_interRegionTeleportFailures; |
113 | 113 | ||
114 | protected string m_ThisHomeURI; | ||
115 | |||
114 | protected bool m_Enabled = false; | 116 | protected bool m_Enabled = false; |
115 | 117 | ||
116 | public Scene Scene { get; private set; } | 118 | public Scene Scene { get; private set; } |
@@ -207,6 +209,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
207 | string transferVersionName = "SIMULATION"; | 209 | string transferVersionName = "SIMULATION"; |
208 | float maxTransferVersion = 0.2f; | 210 | float maxTransferVersion = 0.2f; |
209 | 211 | ||
212 | IConfig hypergridConfig = source.Configs["Hypergrid"]; | ||
213 | if (hypergridConfig != null) | ||
214 | { | ||
215 | m_ThisHomeURI = hypergridConfig.GetString("HomeURI", string.Empty); | ||
216 | if (m_ThisHomeURI != string.Empty && !m_ThisHomeURI.EndsWith("/")) | ||
217 | m_ThisHomeURI += '/'; | ||
218 | } | ||
219 | |||
210 | IConfig transferConfig = source.Configs["EntityTransfer"]; | 220 | IConfig transferConfig = source.Configs["EntityTransfer"]; |
211 | if (transferConfig != null) | 221 | if (transferConfig != null) |
212 | { | 222 | { |
@@ -1296,8 +1306,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1296 | 1306 | ||
1297 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 1307 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) |
1298 | { | 1308 | { |
1309 | GridRegion source = new GridRegion(Scene.RegionInfo); | ||
1310 | source.RawServerURI = m_ThisHomeURI; | ||
1311 | |||
1299 | logout = false; | 1312 | logout = false; |
1300 | bool success = Scene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); | 1313 | bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, out reason); |
1301 | 1314 | ||
1302 | if (success) | 1315 | if (success) |
1303 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); | 1316 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); |
@@ -2262,7 +2275,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2262 | Thread.Sleep(500); | 2275 | Thread.Sleep(500); |
2263 | 2276 | ||
2264 | Scene scene = sp.Scene; | 2277 | Scene scene = sp.Scene; |
2265 | 2278 | ||
2266 | m_log.DebugFormat( | 2279 | m_log.DebugFormat( |
2267 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", | 2280 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", |
2268 | sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); | 2281 | sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); |
@@ -2271,7 +2284,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2271 | 2284 | ||
2272 | string reason = String.Empty; | 2285 | string reason = String.Empty; |
2273 | 2286 | ||
2274 | bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); | 2287 | bool regionAccepted = scene.SimulationService.CreateAgent(null, reg, a, (uint)TeleportFlags.Default, out reason); |
2275 | 2288 | ||
2276 | if (regionAccepted && newAgent) | 2289 | if (regionAccepted && newAgent) |
2277 | { | 2290 | { |
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 | |||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | private int m_levelHGTeleport = 0; | 55 | private int m_levelHGTeleport = 0; |
56 | private string m_ThisHomeURI; | ||
57 | 56 | ||
58 | private GatekeeperServiceConnector m_GatekeeperConnector; | 57 | private GatekeeperServiceConnector m_GatekeeperConnector; |
59 | private IUserAgentService m_UAS; | 58 | private IUserAgentService m_UAS; |
@@ -145,14 +144,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
145 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 144 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
146 | } | 145 | } |
147 | } | 146 | } |
148 | |||
149 | moduleConfig = source.Configs["Hypergrid"]; | ||
150 | if (moduleConfig != null) | ||
151 | { | ||
152 | m_ThisHomeURI = moduleConfig.GetString("HomeURI", string.Empty); | ||
153 | if (m_ThisHomeURI != string.Empty && !m_ThisHomeURI.EndsWith("/")) | ||
154 | m_ThisHomeURI += '/'; | ||
155 | } | ||
156 | } | 147 | } |
157 | 148 | ||
158 | public override void AddRegion(Scene scene) | 149 | public override void AddRegion(Scene scene) |
@@ -296,7 +287,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
296 | else | 287 | else |
297 | connector = new UserAgentServiceConnector(userAgentDriver); | 288 | connector = new UserAgentServiceConnector(userAgentDriver); |
298 | 289 | ||
299 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, false, out reason); | 290 | GridRegion source = new GridRegion(Scene.RegionInfo); |
291 | source.RawServerURI = m_ThisHomeURI; | ||
292 | |||
293 | bool success = connector.LoginAgentToGrid(source, agentCircuit, reg, finalDestination, false, out reason); | ||
300 | logout = success; // flag for later logout from this grid; this is an HG TP | 294 | logout = success; // flag for later logout from this grid; this is an HG TP |
301 | 295 | ||
302 | if (success) | 296 | 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 | |||
205 | * Agent-related communications | 205 | * Agent-related communications |
206 | */ | 206 | */ |
207 | 207 | ||
208 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 208 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) |
209 | { | 209 | { |
210 | if (destination == null) | 210 | if (destination == null) |
211 | { | 211 | { |
@@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
217 | if (m_scenes.ContainsKey(destination.RegionID)) | 217 | if (m_scenes.ContainsKey(destination.RegionID)) |
218 | { | 218 | { |
219 | // m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); | 219 | // m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); |
220 | return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason); | 220 | return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, source, out reason); |
221 | } | 221 | } |
222 | 222 | ||
223 | reason = "Did not find region " + destination.RegionName; | 223 | 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 | |||
162 | * Agent-related communications | 162 | * Agent-related communications |
163 | */ | 163 | */ |
164 | 164 | ||
165 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 165 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) |
166 | { | 166 | { |
167 | if (destination == null) | 167 | if (destination == null) |
168 | { | 168 | { |
@@ -172,13 +172,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
172 | } | 172 | } |
173 | 173 | ||
174 | // Try local first | 174 | // Try local first |
175 | if (m_localBackend.CreateAgent(destination, aCircuit, teleportFlags, out reason)) | 175 | if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, out reason)) |
176 | return true; | 176 | return true; |
177 | 177 | ||
178 | // else do the remote thing | 178 | // else do the remote thing |
179 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) | 179 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
180 | { | 180 | { |
181 | return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason); | 181 | return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); |
182 | } | 182 | } |
183 | return false; | 183 | return false; |
184 | } | 184 | } |
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 | |||
3382 | /// </summary> | 3382 | /// </summary> |
3383 | /// <param name="agent">CircuitData of the agent who is connecting</param> | 3383 | /// <param name="agent">CircuitData of the agent who is connecting</param> |
3384 | /// <param name="teleportFlags"></param> | 3384 | /// <param name="teleportFlags"></param> |
3385 | /// <param name="source">Source region (may be null)</param> | ||
3385 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 3386 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3386 | /// <returns>True if the region accepts this agent. False if it does not. False will | 3387 | /// <returns>True if the region accepts this agent. False if it does not. False will |
3387 | /// also return a reason.</returns> | 3388 | /// also return a reason.</returns> |
3388 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) | 3389 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, GridRegion source, out string reason) |
3389 | { | 3390 | { |
3390 | return NewUserConnection(agent, teleportFlags, out reason, true); | 3391 | return NewUserConnection(agent, teleportFlags, source, out reason, true); |
3391 | } | 3392 | } |
3392 | 3393 | ||
3393 | /// <summary> | 3394 | /// <summary> |
@@ -3407,12 +3408,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3407 | /// the LLUDP stack). | 3408 | /// the LLUDP stack). |
3408 | /// </remarks> | 3409 | /// </remarks> |
3409 | /// <param name="acd">CircuitData of the agent who is connecting</param> | 3410 | /// <param name="acd">CircuitData of the agent who is connecting</param> |
3411 | /// <param name="source">Source region (may be null)</param> | ||
3410 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 3412 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3411 | /// <param name="requirePresenceLookup">True for normal presence. False for NPC | 3413 | /// <param name="requirePresenceLookup">True for normal presence. False for NPC |
3412 | /// or other applications where a full grid/Hypergrid presence may not be required.</param> | 3414 | /// or other applications where a full grid/Hypergrid presence may not be required.</param> |
3413 | /// <returns>True if the region accepts this agent. False if it does not. False will | 3415 | /// <returns>True if the region accepts this agent. False if it does not. False will |
3414 | /// also return a reason.</returns> | 3416 | /// also return a reason.</returns> |
3415 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup) | 3417 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) |
3416 | { | 3418 | { |
3417 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 3419 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3418 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 3420 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
@@ -3431,7 +3433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3431 | // Don't disable this log message - it's too helpful | 3433 | // Don't disable this log message - it's too helpful |
3432 | string curViewer = Util.GetViewerName(acd); | 3434 | string curViewer = Util.GetViewerName(acd); |
3433 | m_log.DebugFormat( | 3435 | m_log.DebugFormat( |
3434 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", | 3436 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9}. {10}", |
3435 | RegionInfo.RegionName, | 3437 | RegionInfo.RegionName, |
3436 | (acd.child ? "child" : "root"), | 3438 | (acd.child ? "child" : "root"), |
3437 | acd.firstname, | 3439 | acd.firstname, |
@@ -3441,7 +3443,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3441 | acd.IPAddress, | 3443 | acd.IPAddress, |
3442 | curViewer, | 3444 | curViewer, |
3443 | ((TPFlags)teleportFlags).ToString(), | 3445 | ((TPFlags)teleportFlags).ToString(), |
3444 | acd.startpos | 3446 | acd.startpos, |
3447 | (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI) | ||
3445 | ); | 3448 | ); |
3446 | 3449 | ||
3447 | if (!LoginsEnabled) | 3450 | 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 | |||
228 | // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and | 228 | // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and |
229 | // establish a child scene presence. We pass in the circuit code that the client has to connect with *** | 229 | // establish a child scene presence. We pass in the circuit code that the client has to connect with *** |
230 | // XXX: ViaLogin may not be correct here. | 230 | // XXX: ViaLogin may not be correct here. |
231 | scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason); | 231 | scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, out reason); |
232 | 232 | ||
233 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); | 233 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); |
234 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | 234 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); |