diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 596f867..ded7806 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -49,6 +49,9 @@ namespace OpenSim.Services.Connectors | |||
49 | 49 | ||
50 | private string m_ServerURI = String.Empty; | 50 | private string m_ServerURI = String.Empty; |
51 | 51 | ||
52 | private ExpiringCache<ulong, GridRegion> m_regionCache = | ||
53 | new ExpiringCache<ulong, GridRegion>(); | ||
54 | |||
52 | public GridServicesConnector() | 55 | public GridServicesConnector() |
53 | { | 56 | { |
54 | } | 57 | } |
@@ -275,6 +278,13 @@ namespace OpenSim.Services.Connectors | |||
275 | 278 | ||
276 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 279 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
277 | { | 280 | { |
281 | GridRegion rinfo = null; | ||
282 | ulong regionHandle = Util.UIntsToLong((uint)x, (uint)y); | ||
283 | |||
284 | // this cache includes NULL regions | ||
285 | if (m_regionCache.TryGetValue(regionHandle, out rinfo)) | ||
286 | return rinfo; | ||
287 | |||
278 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 288 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
279 | 289 | ||
280 | sendData["SCOPEID"] = scopeID.ToString(); | 290 | sendData["SCOPEID"] = scopeID.ToString(); |
@@ -296,7 +306,6 @@ namespace OpenSim.Services.Connectors | |||
296 | return null; | 306 | return null; |
297 | } | 307 | } |
298 | 308 | ||
299 | GridRegion rinfo = null; | ||
300 | if (reply != string.Empty) | 309 | if (reply != string.Empty) |
301 | { | 310 | { |
302 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 311 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -316,6 +325,8 @@ namespace OpenSim.Services.Connectors | |||
316 | else | 325 | else |
317 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); | 326 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); |
318 | 327 | ||
328 | m_regionCache.Add(regionHandle, rinfo, TimeSpan.FromSeconds(600)); | ||
329 | |||
319 | return rinfo; | 330 | return rinfo; |
320 | } | 331 | } |
321 | 332 | ||
@@ -672,7 +683,7 @@ namespace OpenSim.Services.Connectors | |||
672 | 683 | ||
673 | return rinfos; | 684 | return rinfos; |
674 | } | 685 | } |
675 | 686 | ||
676 | public int GetRegionFlags(UUID scopeID, UUID regionID) | 687 | public int GetRegionFlags(UUID scopeID, UUID regionID) |
677 | { | 688 | { |
678 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 689 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
@@ -744,7 +755,7 @@ namespace OpenSim.Services.Connectors | |||
744 | if (reply != string.Empty) | 755 | if (reply != string.Empty) |
745 | { | 756 | { |
746 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 757 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
747 | 758 | ||
748 | if ((replyData != null) && replyData.Count > 0) | 759 | if ((replyData != null) && replyData.Count > 0) |
749 | { | 760 | { |
750 | foreach (string key in replyData.Keys) | 761 | foreach (string key in replyData.Keys) |