aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-24 00:31:14 +0100
committerJustin Clark-Casey (justincc)2012-05-24 00:31:14 +0100
commit459c7635afdbc4002cacbf5780185645a4296f6a (patch)
tree9cf90fb39bc20e9283d6702d102475db08ca53d3 /OpenSim/Region/Framework
parentEnvironment Module - allows Environment settings for Viewer3 warning: include... (diff)
downloadopensim-SC_OLD-459c7635afdbc4002cacbf5780185645a4296f6a.zip
opensim-SC_OLD-459c7635afdbc4002cacbf5780185645a4296f6a.tar.gz
opensim-SC_OLD-459c7635afdbc4002cacbf5780185645a4296f6a.tar.bz2
opensim-SC_OLD-459c7635afdbc4002cacbf5780185645a4296f6a.tar.xz
If an agent is still registered as 'in transit' by the source region, don't allow an immediate teleport back.
This is to help relieve a race condition when an agent teleports then immediately attempts to teleport back before the source region has properly cleaned up/demoted the old ScenePresence. This is rare in viewers but much more possible via scripting or region module. However, more needs to be done since virtually all clean up happens after the transit flag is cleared . Possibly need to add a 'cleaning up' state to in transit. This change required making the EntityTransferModule and HGEntityTransferModule per-region rather than shared, in order to allow separate transit lists. Changes were also required in LocalSimulationConnector. Tested in standalone, grid and with local and remote region crossings with attachments.
Diffstat (limited to 'OpenSim/Region/Framework')
-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
3 files changed, 80 insertions, 36 deletions
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);