aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs69
1 files changed, 30 insertions, 39 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