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.
prebuild-update
Diva Canto 2010-08-06 17:43:09 -07:00
parent 7e47ab746e
commit 0090534793
8 changed files with 97 additions and 83 deletions

View File

@ -233,10 +233,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return m_GridService.GetFallbackRegions(scopeID, x, y);
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
return m_GridService.GetHyperlinks(scopeID);
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
return m_GridService.GetHyperlinks(scopeID);
}
public int GetRegionFlags(UUID scopeID, UUID regionID)
{

View File

@ -136,9 +136,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize);
Assert.IsNotNull(results, "Retrieved GetRegionRange list is null");
Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected");
results = m_LocalConnector.GetHyperlinks(UUID.Zero);
Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
results = m_LocalConnector.GetHyperlinks(UUID.Zero);
Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected");
}

View File

@ -556,55 +556,55 @@ namespace OpenSim.Services.Connectors
return rinfos;
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["METHOD"] = "get_hyperlinks";
List<GridRegion> rinfos = new List<GridRegion>();
string reply = string.Empty;
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return rinfos;
}
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData != null)
{
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
foreach (object r in rinfosList)
{
if (r is Dictionary<string, object>)
{
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo);
}
}
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks {0} received null response",
scopeID);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks received null reply");
return rinfos;
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["METHOD"] = "get_hyperlinks";
List<GridRegion> rinfos = new List<GridRegion>();
string reply = string.Empty;
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return rinfos;
}
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData != null)
{
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
foreach (object r in rinfosList)
{
if (r is Dictionary<string, object>)
{
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo);
}
}
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks {0} received null response",
scopeID);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks received null reply");
return rinfos;
}
public virtual int GetRegionFlags(UUID scopeID, UUID regionID)
{

View File

@ -357,11 +357,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
return new List<GridRegion>(0);
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
// Hypergrid/linked regions are not supported
return new List<GridRegion>();
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
// Hypergrid/linked regions are not supported
return new List<GridRegion>();
}
public int GetRegionFlags(UUID scopeID, UUID regionID)
{

View File

@ -426,21 +426,21 @@ namespace OpenSim.Services.GridService
return ret;
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
List<GridRegion> ret = new List<GridRegion>();
List<RegionData> regions = m_Database.GetHyperlinks(scopeID);
foreach (RegionData r in regions)
{
if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
ret.Add(RegionData2RegionInfo(r));
}
m_log.DebugFormat("[GRID SERVICE]: Hyperlinks returned {0} regions", ret.Count);
return ret;
}
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
List<GridRegion> ret = new List<GridRegion>();
List<RegionData> regions = m_Database.GetHyperlinks(scopeID);
foreach (RegionData r in regions)
{
if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
ret.Add(RegionData2RegionInfo(r));
}
m_log.DebugFormat("[GRID SERVICE]: Hyperlinks returned {0} regions", ret.Count);
return ret;
}
public int GetRegionFlags(UUID scopeID, UUID regionID)
{

View File

@ -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<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
@ -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<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
if (availableRegions.Count() == 0)
{
return false;
}
// would like to use .Except, but doesn't seem to exist
//IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
List<GridRegion> 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;

View File

@ -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_<RegionName> = "<flags>"
;; or: Region_<RegionID> = "<flags>"

View File

@ -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_<RegioName> = "<flags>"
;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut