aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs69
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs55
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs186
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs67
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs42
6 files changed, 233 insertions, 193 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 36e9da6..408d63d 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -46,7 +46,7 @@ using Nini.Config;
46 46
47namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 47namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
48{ 48{
49 public class EntityTransferModule : ISharedRegionModule, IEntityTransferModule 49 public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
@@ -65,9 +65,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
65 public bool EnableWaitForCallbackFromTeleportDest { get; set; } 65 public bool EnableWaitForCallbackFromTeleportDest { get; set; }
66 66
67 protected bool m_Enabled = false; 67 protected bool m_Enabled = false;
68 protected Scene m_aScene; 68
69 protected List<Scene> m_Scenes = new List<Scene>(); 69 protected Scene m_scene;
70
70 protected List<UUID> m_agentsInTransit; 71 protected List<UUID> m_agentsInTransit;
72
71 private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions = 73 private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions =
72 new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); 74 new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
73 75
@@ -129,10 +131,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
129 if (!m_Enabled) 131 if (!m_Enabled)
130 return; 132 return;
131 133
132 if (m_aScene == null) 134 m_scene = scene;
133 m_aScene = scene;
134 135
135 m_Scenes.Add(scene);
136 scene.RegisterModuleInterface<IEntityTransferModule>(this); 136 scene.RegisterModuleInterface<IEntityTransferModule>(this);
137 scene.EventManager.OnNewClient += OnNewClient; 137 scene.EventManager.OnNewClient += OnNewClient;
138 } 138 }
@@ -143,27 +143,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
143 client.OnTeleportLandmarkRequest += RequestTeleportLandmark; 143 client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
144 } 144 }
145 145
146 public virtual void Close() 146 public virtual void Close() {}
147 {
148 if (!m_Enabled)
149 return;
150 }
151 147
152 public virtual void RemoveRegion(Scene scene) 148 public virtual void RemoveRegion(Scene scene) {}
153 {
154 if (!m_Enabled)
155 return;
156 if (scene == m_aScene)
157 m_aScene = null;
158 149
159 m_Scenes.Remove(scene); 150 public virtual void RegionLoaded(Scene scene) {}
160 }
161
162 public virtual void RegionLoaded(Scene scene)
163 {
164 if (!m_Enabled)
165 return;
166 }
167 151
168 #endregion 152 #endregion
169 153
@@ -294,7 +278,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
294 { 278 {
295 uint x = 0, y = 0; 279 uint x = 0, y = 0;
296 Utils.LongToUInts(regionHandle, out x, out y); 280 Utils.LongToUInts(regionHandle, out x, out y);
297 GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); 281 GridRegion reg = m_scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y);
298 282
299 if (reg != null) 283 if (reg != null)
300 { 284 {
@@ -441,7 +425,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
441 425
442 string reason; 426 string reason;
443 string version; 427 string version;
444 if (!m_aScene.SimulationService.QueryAccess( 428 if (!m_scene.SimulationService.QueryAccess(
445 finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) 429 finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
446 { 430 {
447 sp.ControllingClient.SendTeleportFailed(reason); 431 sp.ControllingClient.SendTeleportFailed(reason);
@@ -660,7 +644,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
660 EnableChildAgents(sp); 644 EnableChildAgents(sp);
661 645
662 // Finally, kill the agent we just created at the destination. 646 // Finally, kill the agent we just created at the destination.
663 m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); 647 m_scene.SimulationService.CloseAgent(finalDestination, sp.UUID);
664 648
665 sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); 649 sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
666 } 650 }
@@ -668,7 +652,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
668 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) 652 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
669 { 653 {
670 logout = false; 654 logout = false;
671 bool success = m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); 655 bool success = m_scene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
672 656
673 if (success) 657 if (success)
674 sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); 658 sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
@@ -678,7 +662,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
678 662
679 protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) 663 protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent)
680 { 664 {
681 return m_aScene.SimulationService.UpdateAgent(finalDestination, agent); 665 return m_scene.SimulationService.UpdateAgent(finalDestination, agent);
682 } 666 }
683 667
684 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) 668 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
@@ -730,7 +714,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
730 return false; 714 return false;
731 } 715 }
732 716
733
734 #endregion 717 #endregion
735 718
736 #region Landmark Teleport 719 #region Landmark Teleport
@@ -742,7 +725,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
742 /// <param name="position"></param> 725 /// <param name="position"></param>
743 public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) 726 public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
744 { 727 {
745 GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); 728 GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
746 729
747 if (info == null) 730 if (info == null)
748 { 731 {
@@ -763,12 +746,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
763 m_log.DebugFormat( 746 m_log.DebugFormat(
764 "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); 747 "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
765 748
766 //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId); 749 //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_scene.PresenceService.GetAgent(client.SessionId);
767 GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); 750 GridUserInfo uinfo = m_scene.GridUserService.GetGridUserInfo(client.AgentId.ToString());
768 751
769 if (uinfo != null) 752 if (uinfo != null)
770 { 753 {
771 GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); 754 GridRegion regionInfo = m_scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
772 if (regionInfo == null) 755 if (regionInfo == null)
773 { 756 {
774 // can't find the Home region: Tell viewer and abort 757 // can't find the Home region: Tell viewer and abort
@@ -1625,7 +1608,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1625 #region Agent Arrived 1608 #region Agent Arrived
1626 public void AgentArrivedAtDestination(UUID id) 1609 public void AgentArrivedAtDestination(UUID id)
1627 { 1610 {
1628 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent {0} released", id);
1629 ResetFromTransit(id); 1611 ResetFromTransit(id);
1630 } 1612 }
1631 1613
@@ -1896,8 +1878,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1896 //// And the new channel... 1878 //// And the new channel...
1897 //if (m_interregionCommsOut != null) 1879 //if (m_interregionCommsOut != null)
1898 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); 1880 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
1899 if (m_aScene.SimulationService != null) 1881 if (m_scene.SimulationService != null)
1900 successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true); 1882 successYN = m_scene.SimulationService.CreateObject(destination, newPosition, grp, true);
1901 1883
1902 if (successYN) 1884 if (successYN)
1903 { 1885 {
@@ -2004,7 +1986,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2004 /// </summary> 1986 /// </summary>
2005 /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns> 1987 /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns>
2006 /// <param name='id'>The agent ID</para></param> 1988 /// <param name='id'>The agent ID</para></param>
2007 protected bool IsInTransit(UUID id) 1989 public bool IsInTransit(UUID id)
2008 { 1990 {
2009 lock (m_agentsInTransit) 1991 lock (m_agentsInTransit)
2010 return m_agentsInTransit.Contains(id); 1992 return m_agentsInTransit.Contains(id);
@@ -2024,10 +2006,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2024 if (m_agentsInTransit.Contains(id)) 2006 if (m_agentsInTransit.Contains(id))
2025 { 2007 {
2026 m_agentsInTransit.Remove(id); 2008 m_agentsInTransit.Remove(id);
2009
2010 m_log.DebugFormat(
2011 "[ENTITY TRANSFER MODULE]: Agent {0} cleared from transit in {1}",
2012 id, m_scene.RegionInfo.RegionName);
2013
2027 return true; 2014 return true;
2028 } 2015 }
2029 } 2016 }
2030 2017
2018 m_log.WarnFormat(
2019 "[ENTITY TRANSFER MODULE]: Agent {0} requested to clear from transit in {1} but was already cleared.",
2020 id, m_scene.RegionInfo.RegionName);
2021
2031 return false; 2022 return false;
2032 } 2023 }
2033 2024
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index b578bcb..4124667 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -45,11 +45,11 @@ using Nini.Config;
45 45
46namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 46namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
47{ 47{
48 public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule 48 public class HGEntityTransferModule
49 : EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule
49 { 50 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 52
52 private bool m_Initialized = false;
53 private int m_levelHGTeleport = 0; 53 private int m_levelHGTeleport = 0;
54 54
55 private GatekeeperServiceConnector m_GatekeeperConnector; 55 private GatekeeperServiceConnector m_GatekeeperConnector;
@@ -64,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
64 public override void Initialise(IConfigSource source) 64 public override void Initialise(IConfigSource source)
65 { 65 {
66 IConfig moduleConfig = source.Configs["Modules"]; 66 IConfig moduleConfig = source.Configs["Modules"];
67
67 if (moduleConfig != null) 68 if (moduleConfig != null)
68 { 69 {
69 string name = moduleConfig.GetString("EntityTransferModule", ""); 70 string name = moduleConfig.GetString("EntityTransferModule", "");
@@ -82,10 +83,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
82 public override void AddRegion(Scene scene) 83 public override void AddRegion(Scene scene)
83 { 84 {
84 base.AddRegion(scene); 85 base.AddRegion(scene);
86
85 if (m_Enabled) 87 if (m_Enabled)
86 {
87 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); 88 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
88 }
89 } 89 }
90 90
91 protected override void OnNewClient(IClientAPI client) 91 protected override void OnNewClient(IClientAPI client)
@@ -98,33 +98,28 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
98 public override void RegionLoaded(Scene scene) 98 public override void RegionLoaded(Scene scene)
99 { 99 {
100 base.RegionLoaded(scene); 100 base.RegionLoaded(scene);
101 if (m_Enabled)
102 if (!m_Initialized)
103 {
104 m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
105 m_Initialized = true;
106
107 }
108 101
102 if (m_Enabled)
103 m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
109 } 104 }
105
110 public override void RemoveRegion(Scene scene) 106 public override void RemoveRegion(Scene scene)
111 { 107 {
112 base.AddRegion(scene); 108 base.AddRegion(scene);
109
113 if (m_Enabled) 110 if (m_Enabled)
114 {
115 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); 111 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);
116 }
117 } 112 }
118 113
119
120 #endregion 114 #endregion
121 115
122 #region HG overrides of IEntiryTransferModule 116 #region HG overrides of IEntiryTransferModule
123 117
124 protected override GridRegion GetFinalDestination(GridRegion region) 118 protected override GridRegion GetFinalDestination(GridRegion region)
125 { 119 {
126 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID); 120 int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, region.RegionID);
127 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); 121 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags);
122
128 if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 123 if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
129 { 124 {
130 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); 125 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
@@ -135,6 +130,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
135 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI); 130 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI);
136 return real_destination; 131 return real_destination;
137 } 132 }
133
138 return region; 134 return region;
139 } 135 }
140 136
@@ -143,7 +139,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
143 if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 139 if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
144 return true; 140 return true;
145 141
146 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); 142 int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID);
147 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 143 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
148 return true; 144 return true;
149 145
@@ -156,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
156 if (logout) 152 if (logout)
157 { 153 {
158 // Log them out of this grid 154 // Log them out of this grid
159 m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); 155 m_scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
160 } 156 }
161 } 157 }
162 158
@@ -165,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
165 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); 161 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
166 reason = string.Empty; 162 reason = string.Empty;
167 logout = false; 163 logout = false;
168 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); 164 int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID);
169 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 165 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
170 { 166 {
171 // this user is going to another grid 167 // this user is going to another grid
@@ -205,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
205 "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); 201 "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
206 202
207 // Let's find out if this is a foreign user or a local user 203 // Let's find out if this is a foreign user or a local user
208 IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); 204 IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>();
209 if (uMan != null && uMan.IsLocalGridUser(id)) 205 if (uMan != null && uMan.IsLocalGridUser(id))
210 { 206 {
211 // local grid user 207 // local grid user
@@ -262,19 +258,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
262 { 258 {
263 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}", 259 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
264 (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position); 260 (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);
261
265 if (lm.Gatekeeper == string.Empty) 262 if (lm.Gatekeeper == string.Empty)
266 { 263 {
267 base.RequestTeleportLandmark(remoteClient, lm); 264 base.RequestTeleportLandmark(remoteClient, lm);
268 return; 265 return;
269 } 266 }
270 267
271 GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); 268 GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
272 269
273 // Local region? 270 // Local region?
274 if (info != null) 271 if (info != null)
275 { 272 {
276 ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, 273 ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
277 Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); 274 Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
275
278 return; 276 return;
279 } 277 }
280 else 278 else
@@ -285,6 +283,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
285 GridRegion gatekeeper = new GridRegion(); 283 GridRegion gatekeeper = new GridRegion();
286 gatekeeper.ServerURI = lm.Gatekeeper; 284 gatekeeper.ServerURI = lm.Gatekeeper;
287 GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID)); 285 GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID));
286
288 if (finalDestination != null) 287 if (finalDestination != null)
289 { 288 {
290 ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); 289 ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId);
@@ -314,8 +313,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
314 IUserAgentService security = new UserAgentServiceConnector(url); 313 IUserAgentService security = new UserAgentServiceConnector(url);
315 return security.VerifyClient(aCircuit.SessionID, token); 314 return security.VerifyClient(aCircuit.SessionID, token);
316 } 315 }
317 else 316 else
318 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", aCircuit.firstname, aCircuit.lastname); 317 {
318 m_log.DebugFormat(
319 "[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!",
320 aCircuit.firstname, aCircuit.lastname);
321 }
319 322
320 return false; 323 return false;
321 } 324 }
@@ -332,8 +335,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
332 } 335 }
333 336
334 // Let's find out if this is a foreign user or a local user 337 // Let's find out if this is a foreign user or a local user
335 IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); 338 IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>();
336 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId); 339 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, obj.AgentId);
337 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) 340 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
338 { 341 {
339 // local grid user 342 // local grid user
@@ -356,7 +359,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
356 359
357 #endregion 360 #endregion
358 361
359
360 private GridRegion MakeRegion(AgentCircuitData aCircuit) 362 private GridRegion MakeRegion(AgentCircuitData aCircuit)
361 { 363 {
362 GridRegion region = new GridRegion(); 364 GridRegion region = new GridRegion();
@@ -373,6 +375,5 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
373 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); 375 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
374 return region; 376 return region;
375 } 377 }
376
377 } 378 }
378} 379} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 90f27c4..270daad 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Linq;
29using System.Reflection; 30using System.Reflection;
30using log4net; 31using log4net;
31using Nini.Config; 32using Nini.Config;
@@ -41,22 +42,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
41 public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService 42 public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
42 { 43 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 // Version of this service
45 private const string m_Version = "SIMULATION/0.1";
46 45
47 private List<Scene> m_sceneList = new List<Scene>(); 46 /// <summary>
47 /// Version of this service
48 /// </summary>
49 private const string m_Version = "SIMULATION/0.1";
48 50
49 private IEntityTransferModule m_AgentTransferModule; 51 /// <summary>
50 protected IEntityTransferModule AgentTransferModule 52 /// Map region ID to scene.
51 { 53 /// </summary>
52 get 54 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
53 {
54 if (m_AgentTransferModule == null)
55 m_AgentTransferModule = m_sceneList[0].RequestModuleInterface<IEntityTransferModule>();
56 return m_AgentTransferModule;
57 }
58 }
59 55
56 /// <summary>
57 /// Is this module enabled?
58 /// </summary>
60 private bool m_ModuleEnabled = false; 59 private bool m_ModuleEnabled = false;
61 60
62 #region IRegionModule 61 #region IRegionModule
@@ -129,12 +128,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
129 /// <param name="scene"></param> 128 /// <param name="scene"></param>
130 public void RemoveScene(Scene scene) 129 public void RemoveScene(Scene scene)
131 { 130 {
132 lock (m_sceneList) 131 lock (m_scenes)
133 { 132 {
134 if (m_sceneList.Contains(scene)) 133 if (m_scenes.ContainsKey(scene.RegionInfo.RegionID))
135 { 134 m_scenes.Remove(scene.RegionInfo.RegionID);
136 m_sceneList.Remove(scene); 135 else
137 } 136 m_log.WarnFormat(
137 "[LOCAL SIMULATION CONNECTOR]: Tried to remove region {0} but it was not present",
138 scene.RegionInfo.RegionName);
138 } 139 }
139 } 140 }
140 141
@@ -144,13 +145,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
144 /// <param name="scene"></param> 145 /// <param name="scene"></param>
145 public void Init(Scene scene) 146 public void Init(Scene scene)
146 { 147 {
147 if (!m_sceneList.Contains(scene)) 148 lock (m_scenes)
148 { 149 {
149 lock (m_sceneList) 150 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID))
150 { 151 m_scenes[scene.RegionInfo.RegionID] = scene;
151 m_sceneList.Add(scene); 152 else
152 } 153 m_log.WarnFormat(
153 154 "[LOCAL SIMULATION CONNECTOR]: Tried to add region {0} but it is already present",
155 scene.RegionInfo.RegionName);
154 } 156 }
155 } 157 }
156 158
@@ -160,13 +162,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
160 162
161 public IScene GetScene(ulong regionhandle) 163 public IScene GetScene(ulong regionhandle)
162 { 164 {
163 foreach (Scene s in m_sceneList) 165 foreach (Scene s in m_scenes.Values)
164 { 166 {
165 if (s.RegionInfo.RegionHandle == regionhandle) 167 if (s.RegionInfo.RegionHandle == regionhandle)
166 return s; 168 return s;
167 } 169 }
170
168 // ? weird. should not happen 171 // ? weird. should not happen
169 return m_sceneList[0]; 172 return m_scenes.Values.ToArray()[0];
170 } 173 }
171 174
172 public ISimulationService GetInnerService() 175 public ISimulationService GetInnerService()
@@ -187,13 +190,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
187 return false; 190 return false;
188 } 191 }
189 192
190 foreach (Scene s in m_sceneList) 193 if (m_scenes.ContainsKey(destination.RegionID))
191 { 194 {
192 if (s.RegionInfo.RegionHandle == destination.RegionHandle)
193 {
194// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); 195// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
195 return s.NewUserConnection(aCircuit, teleportFlags, out reason); 196 return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason);
196 }
197 } 197 }
198 198
199 reason = "Did not find region " + destination.RegionName; 199 reason = "Did not find region " + destination.RegionName;
@@ -205,17 +205,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
205 if (destination == null) 205 if (destination == null)
206 return false; 206 return false;
207 207
208 foreach (Scene s in m_sceneList) 208 if (m_scenes.ContainsKey(destination.RegionID))
209 { 209 {
210 if (s.RegionInfo.RegionHandle == destination.RegionHandle)
211 {
212// m_log.DebugFormat( 210// m_log.DebugFormat(
213// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 211// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
214// s.RegionInfo.RegionName, destination.RegionHandle); 212// s.RegionInfo.RegionName, destination.RegionHandle);
215 213
216 s.IncomingChildAgentDataUpdate(cAgentData); 214 return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData);
217 return true;
218 }
219 } 215 }
220 216
221// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); 217// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
@@ -231,11 +227,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
231 // simulator so when we receive the update we need to hand it to each of the 227 // simulator so when we receive the update we need to hand it to each of the
232 // scenes; scenes each check to see if the is a scene presence for the avatar 228 // scenes; scenes each check to see if the is a scene presence for the avatar
233 // note that we really don't need the GridRegion for this call 229 // note that we really don't need the GridRegion for this call
234 foreach (Scene s in m_sceneList) 230 foreach (Scene s in m_scenes.Values)
235 { 231 {
236 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); 232 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
237 s.IncomingChildAgentDataUpdate(cAgentData); 233 s.IncomingChildAgentDataUpdate(cAgentData);
238 } 234 }
235
239 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); 236 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
240 return true; 237 return true;
241 } 238 }
@@ -247,14 +244,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
247 if (destination == null) 244 if (destination == null)
248 return false; 245 return false;
249 246
250 foreach (Scene s in m_sceneList) 247 if (m_scenes.ContainsKey(destination.RegionID))
251 { 248 {
252 if (s.RegionInfo.RegionHandle == destination.RegionHandle) 249// m_log.DebugFormat(
253 { 250// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
254 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); 251// s.RegionInfo.RegionName, destination.RegionHandle);
255 return s.IncomingRetrieveRootAgent(id, out agent); 252
256 } 253 return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent);
257 } 254 }
255
258 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); 256 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
259 return false; 257 return false;
260 } 258 }
@@ -266,27 +264,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
266 if (destination == null) 264 if (destination == null)
267 return false; 265 return false;
268 266
269 foreach (Scene s in m_sceneList) 267 if (m_scenes.ContainsKey(destination.RegionID))
270 { 268 {
271 if (s.RegionInfo.RegionID == destination.RegionID) 269// m_log.DebugFormat(
272 return s.QueryAccess(id, position, out reason); 270// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
271// s.RegionInfo.RegionName, destination.RegionHandle);
272
273 return m_scenes[destination.RegionID].QueryAccess(id, position, out reason);
273 } 274 }
275
274 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); 276 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
275 return false; 277 return false;
276 } 278 }
277 279
278 public bool ReleaseAgent(UUID origin, UUID id, string uri) 280 public bool ReleaseAgent(UUID originId, UUID agentId, string uri)
279 { 281 {
280 foreach (Scene s in m_sceneList) 282 if (m_scenes.ContainsKey(originId))
281 { 283 {
282 if (s.RegionInfo.RegionID == origin) 284// m_log.DebugFormat(
283 { 285// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
284// m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); 286// s.RegionInfo.RegionName, destination.RegionHandle);
285 AgentTransferModule.AgentArrivedAtDestination(id); 287
286 return true; 288 m_scenes[originId].EntityTransferModule.AgentArrivedAtDestination(agentId);
287// return s.IncomingReleaseAgent(id); 289 return true;
288 }
289 } 290 }
291
290 //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin); 292 //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin);
291 return false; 293 return false;
292 } 294 }
@@ -296,17 +298,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
296 if (destination == null) 298 if (destination == null)
297 return false; 299 return false;
298 300
299 foreach (Scene s in m_sceneList) 301 if (m_scenes.ContainsKey(destination.RegionID))
300 { 302 {
301 if (s.RegionInfo.RegionID == destination.RegionID) 303// m_log.DebugFormat(
302 { 304// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
303 //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); 305// s.RegionInfo.RegionName, destination.RegionHandle);
304 // Let's spawn a threadlet right here, because this may take 306
305 // a while 307 Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id); });
306 Util.FireAndForget(delegate { s.IncomingCloseAgent(id); }); 308 return true;
307 return true;
308 }
309 } 309 }
310
310 //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); 311 //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent");
311 return false; 312 return false;
312 } 313 }
@@ -320,25 +321,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
320 if (destination == null) 321 if (destination == null)
321 return false; 322 return false;
322 323
323 foreach (Scene s in m_sceneList) 324 if (m_scenes.ContainsKey(destination.RegionID))
324 { 325 {
325 if (s.RegionInfo.RegionHandle == destination.RegionHandle) 326// m_log.DebugFormat(
327// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
328// s.RegionInfo.RegionName, destination.RegionHandle);
329
330 Scene s = m_scenes[destination.RegionID];
331
332 if (isLocalCall)
326 { 333 {
327 //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); 334 // We need to make a local copy of the object
328 if (isLocalCall) 335 ISceneObject sogClone = sog.CloneForNewScene();
329 { 336 sogClone.SetState(sog.GetStateSnapshot(), s);
330 // We need to make a local copy of the object 337 return s.IncomingCreateObject(newPosition, sogClone);
331 ISceneObject sogClone = sog.CloneForNewScene(); 338 }
332 sogClone.SetState(sog.GetStateSnapshot(), s); 339 else
333 return s.IncomingCreateObject(newPosition, sogClone); 340 {
334 } 341 // Use the object as it came through the wire
335 else 342 return s.IncomingCreateObject(newPosition, sog);
336 {
337 // Use the object as it came through the wire
338 return s.IncomingCreateObject(newPosition, sog);
339 }
340 } 343 }
341 } 344 }
345
342 return false; 346 return false;
343 } 347 }
344 348
@@ -347,13 +351,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
347 if (destination == null) 351 if (destination == null)
348 return false; 352 return false;
349 353
350 foreach (Scene s in m_sceneList) 354 if (m_scenes.ContainsKey(destination.RegionID))
351 { 355 {
352 if (s.RegionInfo.RegionHandle == destination.RegionHandle) 356// m_log.DebugFormat(
353 { 357// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
354 return s.IncomingCreateObject(userID, itemID); 358// s.RegionInfo.RegionName, destination.RegionHandle);
355 } 359
360 return m_scenes[destination.RegionID].IncomingCreateObject(userID, itemID);
356 } 361 }
362
357 return false; 363 return false;
358 } 364 }
359 365
@@ -364,20 +370,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
364 370
365 public bool IsLocalRegion(ulong regionhandle) 371 public bool IsLocalRegion(ulong regionhandle)
366 { 372 {
367 foreach (Scene s in m_sceneList) 373 foreach (Scene s in m_scenes.Values)
368 if (s.RegionInfo.RegionHandle == regionhandle) 374 if (s.RegionInfo.RegionHandle == regionhandle)
369 return true; 375 return true;
376
370 return false; 377 return false;
371 } 378 }
372 379
373 public bool IsLocalRegion(UUID id) 380 public bool IsLocalRegion(UUID id)
374 { 381 {
375 foreach (Scene s in m_sceneList) 382 return m_scenes.ContainsKey(id);
376 if (s.RegionInfo.RegionID == id)
377 return true;
378 return false;
379 } 383 }
380 384
381 #endregion 385 #endregion
382 } 386 }
383} 387} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 18e9e3c..75c44d5 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -74,6 +74,13 @@ namespace OpenSim.Region.Framework.Interfaces
74 /// <param name='client'></param> 74 /// <param name='client'></param>
75 void TeleportHome(UUID id, IClientAPI client); 75 void TeleportHome(UUID id, IClientAPI client);
76 76
77 /// <summary>
78 /// Show whether the given agent is being teleported.
79 /// </summary>
80 /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns>
81 /// <param name='id'>The agent ID</para></param>
82 bool IsInTransit(UUID id);
83
77 bool Cross(ScenePresence agent, bool isFlying); 84 bool Cross(ScenePresence agent, bool isFlying);
78 85
79 void AgentArrivedAtDestination(UUID agent); 86 void AgentArrivedAtDestination(UUID agent);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fbe56f6..755b1e6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -166,7 +166,6 @@ namespace OpenSim.Region.Framework.Scenes
166 protected IConfigSource m_config; 166 protected IConfigSource m_config;
167 protected IRegionSerialiserModule m_serialiser; 167 protected IRegionSerialiserModule m_serialiser;
168 protected IDialogModule m_dialogModule; 168 protected IDialogModule m_dialogModule;
169 protected IEntityTransferModule m_teleportModule;
170 protected ICapabilitiesModule m_capsModule; 169 protected ICapabilitiesModule m_capsModule;
171 protected IGroupsModule m_groupsModule; 170 protected IGroupsModule m_groupsModule;
172 171
@@ -498,6 +497,7 @@ namespace OpenSim.Region.Framework.Scenes
498 } 497 }
499 498
500 public IAttachmentsModule AttachmentsModule { get; set; } 499 public IAttachmentsModule AttachmentsModule { get; set; }
500 public IEntityTransferModule EntityTransferModule { get; private set; }
501 501
502 public IAvatarFactoryModule AvatarFactory 502 public IAvatarFactoryModule AvatarFactory
503 { 503 {
@@ -924,8 +924,8 @@ namespace OpenSim.Region.Framework.Scenes
924 List<ulong> old = new List<ulong>(); 924 List<ulong> old = new List<ulong>();
925 old.Add(otherRegion.RegionHandle); 925 old.Add(otherRegion.RegionHandle);
926 agent.DropOldNeighbours(old); 926 agent.DropOldNeighbours(old);
927 if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc) 927 if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc)
928 m_teleportModule.EnableChildAgent(agent, otherRegion); 928 EntityTransferModule.EnableChildAgent(agent, otherRegion);
929 }); 929 });
930 } 930 }
931 catch (NullReferenceException) 931 catch (NullReferenceException)
@@ -1062,8 +1062,8 @@ namespace OpenSim.Region.Framework.Scenes
1062 { 1062 {
1063 ForEachRootScenePresence(delegate(ScenePresence agent) 1063 ForEachRootScenePresence(delegate(ScenePresence agent)
1064 { 1064 {
1065 if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc) 1065 if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc)
1066 m_teleportModule.EnableChildAgent(agent, r); 1066 EntityTransferModule.EnableChildAgent(agent, r);
1067 }); 1067 });
1068 } 1068 }
1069 catch (NullReferenceException) 1069 catch (NullReferenceException)
@@ -1238,7 +1238,7 @@ namespace OpenSim.Region.Framework.Scenes
1238 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); 1238 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
1239 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1239 m_dialogModule = RequestModuleInterface<IDialogModule>();
1240 m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); 1240 m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
1241 m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); 1241 EntityTransferModule = RequestModuleInterface<IEntityTransferModule>();
1242 m_groupsModule = RequestModuleInterface<IGroupsModule>(); 1242 m_groupsModule = RequestModuleInterface<IGroupsModule>();
1243 } 1243 }
1244 1244
@@ -2275,8 +2275,8 @@ namespace OpenSim.Region.Framework.Scenes
2275 return; 2275 return;
2276 } 2276 }
2277 2277
2278 if (m_teleportModule != null) 2278 if (EntityTransferModule != null)
2279 m_teleportModule.Cross(grp, attemptedPosition, silent); 2279 EntityTransferModule.Cross(grp, attemptedPosition, silent);
2280 } 2280 }
2281 2281
2282 public Border GetCrossedBorder(Vector3 position, Cardinals gridline) 2282 public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
@@ -3078,8 +3078,10 @@ namespace OpenSim.Region.Framework.Scenes
3078 /// <param name="client">The IClientAPI for the client</param> 3078 /// <param name="client">The IClientAPI for the client</param>
3079 public virtual void TeleportClientHome(UUID agentId, IClientAPI client) 3079 public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
3080 { 3080 {
3081 if (m_teleportModule != null) 3081 if (EntityTransferModule != null)
3082 m_teleportModule.TeleportHome(agentId, client); 3082 {
3083 EntityTransferModule.TeleportHome(agentId, client);
3084 }
3083 else 3085 else
3084 { 3086 {
3085 m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); 3087 m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active");
@@ -3638,7 +3640,6 @@ namespace OpenSim.Region.Framework.Scenes
3638 3640
3639 private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) 3641 private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason)
3640 { 3642 {
3641
3642 bool banned = land.IsBannedFromLand(agent.AgentID); 3643 bool banned = land.IsBannedFromLand(agent.AgentID);
3643 bool restricted = land.IsRestrictedFromLand(agent.AgentID); 3644 bool restricted = land.IsRestrictedFromLand(agent.AgentID);
3644 3645
@@ -4131,8 +4132,10 @@ namespace OpenSim.Region.Framework.Scenes
4131 position.Y -= shifty; 4132 position.Y -= shifty;
4132 } 4133 }
4133 4134
4134 if (m_teleportModule != null) 4135 if (EntityTransferModule != null)
4135 m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); 4136 {
4137 EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
4138 }
4136 else 4139 else
4137 { 4140 {
4138 m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); 4141 m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active");
@@ -4143,8 +4146,10 @@ namespace OpenSim.Region.Framework.Scenes
4143 4146
4144 public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) 4147 public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
4145 { 4148 {
4146 if (m_teleportModule != null) 4149 if (EntityTransferModule != null)
4147 return m_teleportModule.Cross(agent, isFlying); 4150 {
4151 return EntityTransferModule.Cross(agent, isFlying);
4152 }
4148 else 4153 else
4149 { 4154 {
4150 m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); 4155 m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule");
@@ -5188,14 +5193,34 @@ namespace OpenSim.Region.Framework.Scenes
5188 throw new Exception(error); 5193 throw new Exception(error);
5189 } 5194 }
5190 5195
5191 // This method is called across the simulation connector to 5196 /// <summary>
5192 // determine if a given agent is allowed in this region 5197 /// This method is called across the simulation connector to
5193 // AS A ROOT AGENT. Returning false here will prevent them 5198 /// determine if a given agent is allowed in this region
5194 // from logging into the region, teleporting into the region 5199 /// AS A ROOT AGENT
5195 // or corssing the broder walking, but will NOT prevent 5200 /// </summary>
5196 // child agent creation, thereby emulating the SL behavior. 5201 /// <remarks>
5202 /// Returning false here will prevent them
5203 /// from logging into the region, teleporting into the region
5204 /// or corssing the broder walking, but will NOT prevent
5205 /// child agent creation, thereby emulating the SL behavior.
5206 /// </remarks>
5207 /// <param name='agentID'></param>
5208 /// <param name='position'></param>
5209 /// <param name='reason'></param>
5210 /// <returns></returns>
5197 public bool QueryAccess(UUID agentID, Vector3 position, out string reason) 5211 public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
5198 { 5212 {
5213 if (EntityTransferModule.IsInTransit(agentID))
5214 {
5215 reason = "Agent is already in transit on this region";
5216
5217 m_log.DebugFormat(
5218 "[SCENE]: Denying agent {0} entry into {1} since region already has them registered as in transit",
5219 agentID, RegionInfo.RegionName);
5220
5221 return false;
5222 }
5223
5199 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. 5224 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
5200 // However, the long term fix is to make sure root agent count is always accurate. 5225 // However, the long term fix is to make sure root agent count is always accurate.
5201 m_sceneGraph.RecalculateStats(); 5226 m_sceneGraph.RecalculateStats();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 41bff7f..ccfe4ff 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -110,12 +110,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
110 110
111 UUID userId = TestHelpers.ParseTail(0x1); 111 UUID userId = TestHelpers.ParseTail(0x1);
112 112
113 EntityTransferModule etm = new EntityTransferModule(); 113 EntityTransferModule etmA = new EntityTransferModule();
114 EntityTransferModule etmB = new EntityTransferModule();
114 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); 115 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
115 116
116 IConfigSource config = new IniConfigSource(); 117 IConfigSource config = new IniConfigSource();
117 IConfig modulesConfig = config.AddConfig("Modules"); 118 IConfig modulesConfig = config.AddConfig("Modules");
118 modulesConfig.Set("EntityTransferModule", etm.Name); 119 modulesConfig.Set("EntityTransferModule", etmA.Name);
119 modulesConfig.Set("SimulationServices", lscm.Name); 120 modulesConfig.Set("SimulationServices", lscm.Name);
120 IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); 121 IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
121 122
@@ -127,7 +128,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
127 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); 128 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
128 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); 129 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
129 130
130 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); 131 SceneHelpers.SetupSceneModules(sceneA, config, etmA);
132 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
133 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
131 134
132 Vector3 teleportPosition = new Vector3(10, 11, 12); 135 Vector3 teleportPosition = new Vector3(10, 11, 12);
133 Vector3 teleportLookAt = new Vector3(20, 21, 22); 136 Vector3 teleportLookAt = new Vector3(20, 21, 22);
@@ -174,12 +177,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
174 UUID userId = TestHelpers.ParseTail(0x1); 177 UUID userId = TestHelpers.ParseTail(0x1);
175 Vector3 preTeleportPosition = new Vector3(30, 31, 32); 178 Vector3 preTeleportPosition = new Vector3(30, 31, 32);
176 179
177 EntityTransferModule etm = new EntityTransferModule(); 180 EntityTransferModule etmA = new EntityTransferModule();
181 EntityTransferModule etmB = new EntityTransferModule();
182
178 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); 183 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
179 184
180 IConfigSource config = new IniConfigSource(); 185 IConfigSource config = new IniConfigSource();
181 config.AddConfig("Modules"); 186 config.AddConfig("Modules");
182 config.Configs["Modules"].Set("EntityTransferModule", etm.Name); 187 config.Configs["Modules"].Set("EntityTransferModule", etmA.Name);
183 config.Configs["Modules"].Set("SimulationServices", lscm.Name); 188 config.Configs["Modules"].Set("SimulationServices", lscm.Name);
184 189
185 config.AddConfig("EntityTransfer"); 190 config.AddConfig("EntityTransfer");
@@ -195,13 +200,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests
195 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); 200 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
196 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); 201 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
197 202
203 SceneHelpers.SetupSceneModules(sceneA, config, etmA );
204
198 // We need to set up the permisions module on scene B so that our later use of agent limit to deny 205 // We need to set up the permisions module on scene B so that our later use of agent limit to deny
199 // QueryAccess won't succeed anyway because administrators are always allowed in and the default 206 // QueryAccess won't succeed anyway because administrators are always allowed in and the default
200 // IsAdministrator if no permissions module is present is true. 207 // IsAdministrator if no permissions module is present is true.
201 SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule() }); 208 SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB });
202 209
203 // Shared scene modules 210 // Shared scene modules
204 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); 211 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
205 212
206 Vector3 teleportPosition = new Vector3(10, 11, 12); 213 Vector3 teleportPosition = new Vector3(10, 11, 12);
207 Vector3 teleportLookAt = new Vector3(20, 21, 22); 214 Vector3 teleportLookAt = new Vector3(20, 21, 22);
@@ -249,12 +256,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
249 UUID userId = TestHelpers.ParseTail(0x1); 256 UUID userId = TestHelpers.ParseTail(0x1);
250 Vector3 preTeleportPosition = new Vector3(30, 31, 32); 257 Vector3 preTeleportPosition = new Vector3(30, 31, 32);
251 258
252 EntityTransferModule etm = new EntityTransferModule(); 259 EntityTransferModule etmA = new EntityTransferModule();
260 EntityTransferModule etmB = new EntityTransferModule();
253 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); 261 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
254 262
255 IConfigSource config = new IniConfigSource(); 263 IConfigSource config = new IniConfigSource();
256 config.AddConfig("Modules"); 264 config.AddConfig("Modules");
257 config.Configs["Modules"].Set("EntityTransferModule", etm.Name); 265 config.Configs["Modules"].Set("EntityTransferModule", etmA.Name);
258 config.Configs["Modules"].Set("SimulationServices", lscm.Name); 266 config.Configs["Modules"].Set("SimulationServices", lscm.Name);
259 267
260 config.AddConfig("EntityTransfer"); 268 config.AddConfig("EntityTransfer");
@@ -267,8 +275,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
267 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); 275 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
268 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); 276 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
269 277
278 SceneHelpers.SetupSceneModules(sceneA, config, etmA);
279 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
280
270 // Shared scene modules 281 // Shared scene modules
271 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); 282 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
272 283
273 Vector3 teleportPosition = new Vector3(10, 11, 12); 284 Vector3 teleportPosition = new Vector3(10, 11, 12);
274 Vector3 teleportLookAt = new Vector3(20, 21, 22); 285 Vector3 teleportLookAt = new Vector3(20, 21, 22);
@@ -312,12 +323,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
312 323
313 UUID userId = TestHelpers.ParseTail(0x1); 324 UUID userId = TestHelpers.ParseTail(0x1);
314 325
315 EntityTransferModule etm = new EntityTransferModule(); 326 EntityTransferModule etmA = new EntityTransferModule();
327 EntityTransferModule etmB = new EntityTransferModule();
316 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); 328 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
317 329
318 IConfigSource config = new IniConfigSource(); 330 IConfigSource config = new IniConfigSource();
319 IConfig modulesConfig = config.AddConfig("Modules"); 331 IConfig modulesConfig = config.AddConfig("Modules");
320 modulesConfig.Set("EntityTransferModule", etm.Name); 332 modulesConfig.Set("EntityTransferModule", etmA.Name);
321 modulesConfig.Set("SimulationServices", lscm.Name); 333 modulesConfig.Set("SimulationServices", lscm.Name);
322 IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); 334 IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
323 335
@@ -329,9 +341,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
329 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); 341 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
330 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); 342 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
331 343
332 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); 344 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
333 SceneHelpers.SetupSceneModules(sceneA, new CapabilitiesModule()); 345 SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
334 SceneHelpers.SetupSceneModules(sceneB, new CapabilitiesModule()); 346 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
335 347
336 Vector3 teleportPosition = new Vector3(10, 11, 12); 348 Vector3 teleportPosition = new Vector3(10, 11, 12);
337 Vector3 teleportLookAt = new Vector3(20, 21, 22); 349 Vector3 teleportLookAt = new Vector3(20, 21, 22);