diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index f0c4926..68ae4fa 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs | |||
@@ -193,16 +193,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
193 | // The coordinates are world coords (meters), NOT region units. | 193 | // The coordinates are world coords (meters), NOT region units. |
194 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 194 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
195 | { | 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 | |||
196 | bool inCache = false; | 207 | bool inCache = false; |
197 | GridRegion rinfo = m_RegionInfoCache.Get(scopeID, Util.RegionWorldLocToHandle((uint)x, (uint)y), out inCache); | 208 | GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionHandle, out inCache); |
198 | 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); | ||
199 | return rinfo; | 213 | return rinfo; |
214 | } | ||
200 | 215 | ||
201 | rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); | 216 | rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); |
202 | if (rinfo == null) | 217 | if (rinfo == null) |
203 | rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); | 218 | rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); |
204 | 219 | ||
205 | 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 | |||
206 | return rinfo; | 225 | return rinfo; |
207 | } | 226 | } |
208 | 227 | ||