aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authordiva2009-02-01 00:59:42 +0000
committerdiva2009-02-01 00:59:42 +0000
commitff149ae197c1092a9a98ea84a2363fa967490857 (patch)
tree7f7c28c152183f3f8de20d1b0f3244897af8ea65 /OpenSim/Region/Environment/Modules
parentSpeed improvement mostly when sensing objects especially noticeable in a sim ... (diff)
downloadopensim-SC_OLD-ff149ae197c1092a9a98ea84a2363fa967490857.zip
opensim-SC_OLD-ff149ae197c1092a9a98ea84a2363fa967490857.tar.gz
opensim-SC_OLD-ff149ae197c1092a9a98ea84a2363fa967490857.tar.bz2
opensim-SC_OLD-ff149ae197c1092a9a98ea84a2363fa967490857.tar.xz
Check for the 4096 limitation in dynamic region hyperlinks.
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs49
1 files changed, 43 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs
index cb05092..7346d92 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
110 if (mapName.Contains(".") && mapName.Contains(":")) 110 if (mapName.Contains(".") && mapName.Contains(":"))
111 { 111 {
112 // It probably is a domain name. Try to link to it. 112 // It probably is a domain name. Try to link to it.
113 TryLinkRegion(mapName, regionInfos); 113 TryLinkRegion(remoteClient, mapName, regionInfos);
114 } 114 }
115 } 115 }
116 116
@@ -154,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
154 return (m_scene.SceneGridService is HGSceneCommunicationService); 154 return (m_scene.SceneGridService is HGSceneCommunicationService);
155 } 155 }
156 156
157 private void TryLinkRegion(string mapName, List<RegionInfo> regionInfos) 157 private void TryLinkRegion(IClientAPI client, string mapName, List<RegionInfo> regionInfos)
158 { 158 {
159 string host = "127.0.0.1"; 159 string host = "127.0.0.1";
160 string portstr; 160 string portstr;
@@ -183,7 +183,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
183 { 183 {
184 uint xloc = (uint)(random.Next(0, Int16.MaxValue)); 184 uint xloc = (uint)(random.Next(0, Int16.MaxValue));
185 RegionInfo regInfo; 185 RegionInfo regInfo;
186 bool success = TryCreateLink(xloc, 0, port, host, out regInfo); 186 bool success = TryCreateLink(client, xloc, 0, port, host, out regInfo);
187 if (success) 187 if (success)
188 { 188 {
189 regInfo.RegionName = mapName; 189 regInfo.RegionName = mapName;
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
192 } 192 }
193 } 193 }
194 194
195 private bool TryCreateLink(uint xloc, uint yloc, uint externalPort, string externalHostName, out RegionInfo regInfo) 195 private bool TryCreateLink(IClientAPI client, uint xloc, uint yloc, uint externalPort, string externalHostName, out RegionInfo regInfo)
196 { 196 {
197 m_log.DebugFormat("[HGrid]: Dynamic link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); 197 m_log.DebugFormat("[HGrid]: Dynamic link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc);
198 198
@@ -219,14 +219,51 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
219 } 219 }
220 catch (Exception e) 220 catch (Exception e)
221 { 221 {
222 m_log.Warn("[HGrid] Unable to dynamically link region: " + e); 222 m_log.Warn("[HGrid] Unable to dynamically link region: " + e.Message);
223 return false; 223 return false;
224 } 224 }
225 225
226 m_log.Debug("[HGrid] Dynamic link region succeeded"); 226 if (!Check4096(client, regInfo))
227 {
228 return false;
229 }
227 230
231 m_log.Debug("[HGrid] Dynamic link region succeeded");
228 return true; 232 return true;
229 } 233 }
230 234
235 /// <summary>
236 /// Cope with this viewer limitation.
237 /// </summary>
238 /// <param name="regInfo"></param>
239 /// <returns></returns>
240 private bool Check4096(IClientAPI client, RegionInfo regInfo)
241 {
242 ulong realHandle;
243 if (UInt64.TryParse(regInfo.regionSecret, out realHandle))
244 {
245 uint x, y;
246 Utils.LongToUInts(realHandle, out x, out y);
247 x = x / Constants.RegionSize;
248 y = y / Constants.RegionSize;
249
250 if ((Math.Abs((int)m_scene.RegionInfo.RegionLocX - (int)x) >= 4096) ||
251 (Math.Abs((int)m_scene.RegionInfo.RegionLocY - (int)y) >= 4096))
252 {
253 m_scene.CommsManager.GridService.RegisterRegion(regInfo);
254 m_log.Debug("[HGrid]: Region deregistered.");
255 client.SendAlertMessage("Region is too far (" + x + ", " + y + ")");
256 return false;
257 }
258 return true;
259 }
260 else
261 {
262 m_scene.CommsManager.GridService.RegisterRegion(regInfo);
263 m_log.Debug("[HGrid]: Gnomes. Region deregistered.");
264 return false;
265 }
266 }
267
231 } 268 }
232} 269}