diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index b2646ba..85073fc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | 29 | using Mono.Addins; |
30 | using System; | 30 | using System; |
31 | using System.Collections; | ||
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using Nini.Config; | 34 | using Nini.Config; |
@@ -186,18 +187,41 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
186 | return rinfo; | 187 | return rinfo; |
187 | } | 188 | } |
188 | 189 | ||
190 | // Get a region given its base world coordinates (in meters). | ||
191 | // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST | ||
192 | // be the base coordinate of the region. | ||
193 | // The coordinates are world coords (meters), NOT region units. | ||
189 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 194 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
190 | { | 195 | { |
196 | ulong regionHandle = Util.RegionWorldLocToHandle((uint)x, (uint)y); | ||
197 | uint regionX = Util.WorldToRegionLoc((uint)x); | ||
198 | uint regionY = Util.WorldToRegionLoc((uint)y); | ||
199 | |||
200 | // Sanity check | ||
201 | if ((Util.RegionToWorldLoc(regionX) != (uint)x) || (Util.RegionToWorldLoc(regionY) != (uint)y)) | ||
202 | { | ||
203 | m_log.WarnFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Bad position requested: not the base of the region. Requested Pos=<{0},{1}>, Should Be=<{2},{3}>", | ||
204 | x, y, Util.RegionToWorldLoc(regionX), Util.RegionToWorldLoc(regionY)); | ||
205 | } | ||
206 | |||
191 | bool inCache = false; | 207 | bool inCache = false; |
192 | GridRegion rinfo = m_RegionInfoCache.Get(scopeID, Util.UIntsToLong((uint)x, (uint)y), out inCache); | 208 | GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionHandle, out inCache); |
193 | if (inCache) | 209 | if (inCache) |
210 | { | ||
211 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Found region {0} in cache. Pos=<{1},{2}>, RegionHandle={3}", | ||
212 | // (rinfo == null) ? "<missing>" : rinfo.RegionName, regionX, regionY, (rinfo == null) ? regionHandle : rinfo.RegionHandle); | ||
194 | return rinfo; | 213 | return rinfo; |
214 | } | ||
195 | 215 | ||
196 | rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); | 216 | rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); |
197 | if (rinfo == null) | 217 | if (rinfo == null) |
198 | rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); | 218 | rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); |
199 | 219 | ||
200 | m_RegionInfoCache.Cache(rinfo); | 220 | m_RegionInfoCache.Cache(rinfo); |
221 | |||
222 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Added region {0} to the cache. Pos=<{1},{2}>, RegionHandle={3}", | ||
223 | // (rinfo == null) ? "<missing>" : rinfo.RegionName, regionX, regionY, (rinfo == null) ? regionHandle : rinfo.RegionHandle); | ||
224 | |||
201 | return rinfo; | 225 | return rinfo; |
202 | } | 226 | } |
203 | 227 | ||
@@ -277,6 +301,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
277 | return rinfo; | 301 | return rinfo; |
278 | } | 302 | } |
279 | 303 | ||
304 | public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID) | ||
305 | { | ||
306 | List<GridRegion> rinfo = m_LocalGridService.GetDefaultHypergridRegions(scopeID); | ||
307 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetDefaultHypergridRegions {0} found {1} regions", name, rinfo.Count); | ||
308 | List<GridRegion> grinfo = m_RemoteGridService.GetDefaultHypergridRegions(scopeID); | ||
309 | |||
310 | if (grinfo != null) | ||
311 | { | ||
312 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetDefaultHypergridRegions {0} found {1} regions", name, grinfo.Count); | ||
313 | foreach (GridRegion r in grinfo) | ||
314 | { | ||
315 | m_RegionInfoCache.Cache(r); | ||
316 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) | ||
317 | rinfo.Add(r); | ||
318 | } | ||
319 | } | ||
320 | |||
321 | return rinfo; | ||
322 | } | ||
323 | |||
280 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 324 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
281 | { | 325 | { |
282 | List<GridRegion> rinfo = m_LocalGridService.GetFallbackRegions(scopeID, x, y); | 326 | List<GridRegion> rinfo = m_LocalGridService.GetFallbackRegions(scopeID, x, y); |
@@ -325,6 +369,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
325 | 369 | ||
326 | return flags; | 370 | return flags; |
327 | } | 371 | } |
372 | |||
373 | public Dictionary<string, object> GetExtraFeatures() | ||
374 | { | ||
375 | Dictionary<string, object> extraFeatures; | ||
376 | extraFeatures = m_LocalGridService.GetExtraFeatures(); | ||
377 | |||
378 | if (extraFeatures.Count == 0) | ||
379 | extraFeatures = m_RemoteGridService.GetExtraFeatures(); | ||
380 | |||
381 | return extraFeatures; | ||
382 | } | ||
328 | #endregion | 383 | #endregion |
329 | } | 384 | } |
330 | } | 385 | } |