diff options
author | Diva Canto | 2010-08-06 17:43:09 -0700 |
---|---|---|
committer | Diva Canto | 2010-08-06 17:43:09 -0700 |
commit | 009053479302e7581a85c7574a6cc8eaa23745d8 (patch) | |
tree | 7b11018e7368719d40f75d475db45777e6fecf2b /OpenSim/Services/GridService | |
parent | Allow creation of link regions if there is an existing region within a 4096 r... (diff) | |
download | opensim-SC-009053479302e7581a85c7574a6cc8eaa23745d8.zip opensim-SC-009053479302e7581a85c7574a6cc8eaa23745d8.tar.gz opensim-SC-009053479302e7581a85c7574a6cc8eaa23745d8.tar.bz2 opensim-SC-009053479302e7581a85c7574a6cc8eaa23745d8.tar.xz |
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.
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 30 | ||||
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 23 |
2 files changed, 31 insertions, 22 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 79a45fe..ce6f64b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -426,21 +426,21 @@ namespace OpenSim.Services.GridService | |||
426 | return ret; | 426 | return ret; |
427 | } | 427 | } |
428 | 428 | ||
429 | public List<GridRegion> GetHyperlinks(UUID scopeID) | 429 | public List<GridRegion> GetHyperlinks(UUID scopeID) |
430 | { | 430 | { |
431 | List<GridRegion> ret = new List<GridRegion>(); | 431 | List<GridRegion> ret = new List<GridRegion>(); |
432 | 432 | ||
433 | List<RegionData> regions = m_Database.GetHyperlinks(scopeID); | 433 | List<RegionData> regions = m_Database.GetHyperlinks(scopeID); |
434 | 434 | ||
435 | foreach (RegionData r in regions) | 435 | foreach (RegionData r in regions) |
436 | { | 436 | { |
437 | if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) | 437 | if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) |
438 | ret.Add(RegionData2RegionInfo(r)); | 438 | ret.Add(RegionData2RegionInfo(r)); |
439 | } | 439 | } |
440 | 440 | ||
441 | m_log.DebugFormat("[GRID SERVICE]: Hyperlinks returned {0} regions", ret.Count); | 441 | m_log.DebugFormat("[GRID SERVICE]: Hyperlinks returned {0} regions", ret.Count); |
442 | return ret; | 442 | return ret; |
443 | } | 443 | } |
444 | 444 | ||
445 | public int GetRegionFlags(UUID scopeID, UUID regionID) | 445 | public int GetRegionFlags(UUID scopeID, UUID regionID) |
446 | { | 446 | { |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 017df41..b190f93 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
31 | using System.Net; | 30 | using System.Net; |
32 | using System.Reflection; | 31 | using System.Reflection; |
33 | using System.Xml; | 32 | using System.Xml; |
@@ -63,6 +62,7 @@ namespace OpenSim.Services.GridService | |||
63 | protected GatekeeperServiceConnector m_GatekeeperConnector; | 62 | protected GatekeeperServiceConnector m_GatekeeperConnector; |
64 | 63 | ||
65 | protected UUID m_ScopeID = UUID.Zero; | 64 | protected UUID m_ScopeID = UUID.Zero; |
65 | protected bool m_Check4096 = true; | ||
66 | 66 | ||
67 | // Hyperlink regions are hyperlinks on the map | 67 | // Hyperlink regions are hyperlinks on the map |
68 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); | 68 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); |
@@ -117,6 +117,8 @@ namespace OpenSim.Services.GridService | |||
117 | if (scope != string.Empty) | 117 | if (scope != string.Empty) |
118 | UUID.TryParse(scope, out m_ScopeID); | 118 | UUID.TryParse(scope, out m_ScopeID); |
119 | 119 | ||
120 | m_Check4096 = gridConfig.GetBoolean("Check4096", true); | ||
121 | |||
120 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); | 122 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); |
121 | 123 | ||
122 | m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); | 124 | m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); |
@@ -278,7 +280,7 @@ namespace OpenSim.Services.GridService | |||
278 | } | 280 | } |
279 | 281 | ||
280 | uint x, y; | 282 | uint x, y; |
281 | if (!Check4096(handle, out x, out y)) | 283 | if (m_Check4096 && !Check4096(handle, out x, out y)) |
282 | { | 284 | { |
283 | RemoveHyperlinkRegion(regInfo.RegionID); | 285 | RemoveHyperlinkRegion(regInfo.RegionID); |
284 | reason = "Region is too far (" + x + ", " + y + ")"; | 286 | reason = "Region is too far (" + x + ", " + y + ")"; |
@@ -363,11 +365,18 @@ namespace OpenSim.Services.GridService | |||
363 | { | 365 | { |
364 | // Check for regions which are not linked regions | 366 | // Check for regions which are not linked regions |
365 | List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); | 367 | List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); |
366 | IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); | 368 | // would like to use .Except, but doesn't seem to exist |
367 | if (availableRegions.Count() == 0) | 369 | //IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); |
368 | { | 370 | List<GridRegion> availableRegions = regions.FindAll(delegate(GridRegion region) |
369 | return false; | 371 | { |
370 | } | 372 | // Ewww! n^2 |
373 | if (hyperlinks.Find(delegate(GridRegion r) { return r.RegionID == region.RegionID; }) == null) // not hyperlink. good. | ||
374 | return true; | ||
375 | |||
376 | return false; | ||
377 | }); | ||
378 | if (availableRegions.Count == 0) | ||
379 | return false; | ||
371 | } | 380 | } |
372 | 381 | ||
373 | return true; | 382 | return true; |