aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-06-24 19:49:05 +0100
committerJustin Clark-Casey (justincc)2011-06-24 19:49:05 +0100
commitde20f0603fa419ba16c56d16c2ad55301cad8b83 (patch)
treed93ef87605cc632744ec21f8fb6ea035e083e1c0 /OpenSim/Region/CoreModules/Framework
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-de20f0603fa419ba16c56d16c2ad55301cad8b83.zip
opensim-SC_OLD-de20f0603fa419ba16c56d16c2ad55301cad8b83.tar.gz
opensim-SC_OLD-de20f0603fa419ba16c56d16c2ad55301cad8b83.tar.bz2
opensim-SC_OLD-de20f0603fa419ba16c56d16c2ad55301cad8b83.tar.xz
Tell hypergridders when their teleports fail because of the 4096 limit rather than just saying "destination not found"
Instead of performing the 4096 check when the region is linked (and subsequently removing the link), leave the link in place and perform the check in the entity transfer module This allows us to explicitly tell the hypergridder why the teleport failed (region out of range). It also allows people on regions that are within range (on a large source grid) to teleport. The Check4096 config parameter in the [GridService] section is replaced by a max_distance paramter in a new [EntityTransfer] section in OpenSimDefaults.ini Since the parameter is in OpenSimDefaults.ini no action needs to be taken unless you want to increase this limit. It could also be decreased. The check is being made in the base entity transfer module, since I believe the viewer problem occurs both on extremely large grids and while hypergridding.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs52
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs6
2 files changed, 47 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 1341533..d54216a 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -50,6 +50,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
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
53 /// <summary>
54 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
55 /// </summary>
56 public int MaxTransferDistance { get; set; }
57
53 protected bool m_Enabled = false; 58 protected bool m_Enabled = false;
54 protected Scene m_aScene; 59 protected Scene m_aScene;
55 protected List<Scene> m_Scenes = new List<Scene>(); 60 protected List<Scene> m_Scenes = new List<Scene>();
@@ -78,13 +83,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
78 string name = moduleConfig.GetString("EntityTransferModule", ""); 83 string name = moduleConfig.GetString("EntityTransferModule", "");
79 if (name == Name) 84 if (name == Name)
80 { 85 {
81 m_agentsInTransit = new List<UUID>(); 86 InitialiseCommon(source);
82 m_Enabled = true; 87 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name);
83 m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name);
84 } 88 }
85 } 89 }
86 } 90 }
87 91
92 /// <summary>
93 /// Initialize config common for this module and any descendents.
94 /// </summary>
95 /// <param name="source"></param>
96 protected virtual void InitialiseCommon(IConfigSource source)
97 {
98 IConfig transferConfig = source.Configs["EntityTransfer"];
99 if (transferConfig != null)
100 MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
101
102 m_agentsInTransit = new List<UUID>();
103 m_Enabled = true;
104 }
105
88 public virtual void PostInitialise() 106 public virtual void PostInitialise()
89 { 107 {
90 } 108 }
@@ -114,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
114 return; 132 return;
115 } 133 }
116 134
117
118 public virtual void RemoveRegion(Scene scene) 135 public virtual void RemoveRegion(Scene scene)
119 { 136 {
120 if (!m_Enabled) 137 if (!m_Enabled)
@@ -129,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
129 { 146 {
130 if (!m_Enabled) 147 if (!m_Enabled)
131 return; 148 return;
132
133 } 149 }
134 150
135 #endregion 151 #endregion
@@ -204,8 +220,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
204 sp.ControllingClient.SendTeleportFailed("Problem at destination"); 220 sp.ControllingClient.SendTeleportFailed("Problem at destination");
205 return; 221 return;
206 } 222 }
207 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", 223
208 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); 224 uint curX = 0, curY = 0;
225 Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
226 int curCellX = (int)(curX / Constants.RegionSize);
227 int curCellY = (int)(curY / Constants.RegionSize);
228 int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize);
229 int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize);
230
231// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY);
232//
233// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}",
234// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI);
209 235
210 // Check that these are not the same coordinates 236 // Check that these are not the same coordinates
211 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && 237 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
@@ -216,6 +242,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
216 return; 242 return;
217 } 243 }
218 244
245 if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance)
246 {
247 sp.ControllingClient.SendTeleportFailed(
248 string.Format(
249 "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
250 finalDestination.RegionName, destCellX, destCellY,
251 sp.Scene.RegionInfo.RegionName, curCellX, curCellY,
252 MaxTransferDistance));
253
254 return;
255 }
256
219 // 257 //
220 // This is it 258 // This is it
221 // 259 //
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 4d77ef4..a87279a 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -67,10 +67,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
67 string name = moduleConfig.GetString("EntityTransferModule", ""); 67 string name = moduleConfig.GetString("EntityTransferModule", "");
68 if (name == Name) 68 if (name == Name)
69 { 69 {
70 m_agentsInTransit = new List<UUID>(); 70 InitialiseCommon(source);
71 71 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
72 m_Enabled = true;
73 m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
74 } 72 }
75 } 73 }
76 } 74 }