diff options
Added a bool variable to OGS1GridServices to be able to turn off the use of the remoteRegionInfoCache as caching region data like that stops a dynamic grid (where regions could change port or host at any time, useful for load balancing among other things) from working.
The bool is currently hardcoded to be true (to use the cache). So need to hook this up to a config option later.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 4ffb36f..f6da1e4 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private bool m_useRemoteRegionCache = true; | ||
49 | /// <summary> | 50 | /// <summary> |
50 | /// Encapsulate local backend services for manipulation of local regions | 51 | /// Encapsulate local backend services for manipulation of local regions |
51 | /// </summary> | 52 | /// </summary> |
@@ -372,7 +373,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
372 | } | 373 | } |
373 | 374 | ||
374 | regionInfo = buildRegionInfo(responseData, String.Empty); | 375 | regionInfo = buildRegionInfo(responseData, String.Empty); |
375 | if (requestData.ContainsKey("regionHandle")) | 376 | if ((m_useRemoteRegionCache) && (requestData.ContainsKey("regionHandle"))) |
376 | { | 377 | { |
377 | m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo); | 378 | m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo); |
378 | } | 379 | } |
@@ -394,7 +395,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
394 | return regionInfo; | 395 | return regionInfo; |
395 | } | 396 | } |
396 | 397 | ||
397 | if (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)) | 398 | if((!m_useRemoteRegionCache) || (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo))) |
398 | { | 399 | { |
399 | try | 400 | try |
400 | { | 401 | { |
@@ -437,11 +438,14 @@ namespace OpenSim.Region.Communications.OGS1 | |||
437 | //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); | 438 | //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); |
438 | regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, simURI ); | 439 | regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, simURI ); |
439 | 440 | ||
440 | lock (m_remoteRegionInfoCache) | 441 | if (m_useRemoteRegionCache) |
441 | { | 442 | { |
442 | if (!m_remoteRegionInfoCache.ContainsKey(regionHandle)) | 443 | lock (m_remoteRegionInfoCache) |
443 | { | 444 | { |
444 | m_remoteRegionInfoCache.Add(regionHandle, regionInfo); | 445 | if (!m_remoteRegionInfoCache.ContainsKey(regionHandle)) |
446 | { | ||
447 | m_remoteRegionInfoCache.Add(regionHandle, regionInfo); | ||
448 | } | ||
445 | } | 449 | } |
446 | } | 450 | } |
447 | } | 451 | } |
@@ -481,10 +485,13 @@ namespace OpenSim.Region.Communications.OGS1 | |||
481 | 485 | ||
482 | public RegionInfo RequestClosestRegion(string regionName) | 486 | public RegionInfo RequestClosestRegion(string regionName) |
483 | { | 487 | { |
484 | foreach (RegionInfo ri in m_remoteRegionInfoCache.Values) | 488 | if (m_useRemoteRegionCache) |
485 | { | 489 | { |
486 | if (ri.RegionName == regionName) | 490 | foreach (RegionInfo ri in m_remoteRegionInfoCache.Values) |
487 | return ri; | 491 | { |
492 | if (ri.RegionName == regionName) | ||
493 | return ri; | ||
494 | } | ||
488 | } | 495 | } |
489 | 496 | ||
490 | RegionInfo regionInfo = null; | 497 | RegionInfo regionInfo = null; |
@@ -508,7 +515,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
508 | 515 | ||
509 | regionInfo = buildRegionInfo(responseData, ""); | 516 | regionInfo = buildRegionInfo(responseData, ""); |
510 | 517 | ||
511 | if (!m_remoteRegionInfoCache.ContainsKey(regionInfo.RegionHandle)) | 518 | if ((m_useRemoteRegionCache) && (!m_remoteRegionInfoCache.ContainsKey(regionInfo.RegionHandle))) |
512 | m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); | 519 | m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); |
513 | } | 520 | } |
514 | catch | 521 | catch |