From d44b7d9637be7e95c7ad993edf1dfd4e4deb7e76 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 6 Aug 2010 17:43:09 -0700 Subject: [PATCH] Added Check4096 config var under [GridService], at the request of many. Changed the iteration that Marck had on the Hyperlinker. ATTENTION! CONFIGURATION CHANGE AFFECTING Robust.HG.ini.example and StandaloneCommon.ini.example. --- .../Services/GridService/HypergridLinker.cs | 23 +++++++++++++------ bin/Robust.HG.ini.example | 2 ++ .../StandaloneCommon.ini.example | 3 +++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 017df415b8..b190f9316e 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Reflection; using System.Xml; @@ -63,6 +62,7 @@ namespace OpenSim.Services.GridService protected GatekeeperServiceConnector m_GatekeeperConnector; protected UUID m_ScopeID = UUID.Zero; + protected bool m_Check4096 = true; // Hyperlink regions are hyperlinks on the map public readonly Dictionary m_HyperlinkRegions = new Dictionary(); @@ -117,6 +117,8 @@ namespace OpenSim.Services.GridService if (scope != string.Empty) UUID.TryParse(scope, out m_ScopeID); + m_Check4096 = gridConfig.GetBoolean("Check4096", true); + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); @@ -278,7 +280,7 @@ namespace OpenSim.Services.GridService } uint x, y; - if (!Check4096(handle, out x, out y)) + if (m_Check4096 && !Check4096(handle, out x, out y)) { RemoveHyperlinkRegion(regInfo.RegionID); reason = "Region is too far (" + x + ", " + y + ")"; @@ -363,11 +365,18 @@ namespace OpenSim.Services.GridService { // Check for regions which are not linked regions List hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); - IEnumerable availableRegions = regions.Except(hyperlinks); - if (availableRegions.Count() == 0) - { - return false; - } + // would like to use .Except, but doesn't seem to exist + //IEnumerable availableRegions = regions.Except(hyperlinks); + List availableRegions = regions.FindAll(delegate(GridRegion region) + { + // Ewww! n^2 + if (hyperlinks.Find(delegate(GridRegion r) { return r.RegionID == region.RegionID; }) == null) // not hyperlink. good. + return true; + + return false; + }); + if (availableRegions.Count == 0) + return false; } return true; diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index ebabe8de5c..4b9334e150 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -54,6 +54,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" Realm = "regions" ; AllowDuplicateNames = "True" + ; Check4096 = "False" + ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" ;; or: Region_ = "" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 6299485e44..51b5df94bc 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -48,6 +48,9 @@ ;;--- For MySql region storage (alternative) ;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" + ; If HG, do you want this check on the distance to be performed? + ; Check4096 = "False" + ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" ;; where can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut