aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
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/Scenes/Scene.cs
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/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs67
1 files changed, 46 insertions, 21 deletions
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();