diff --git a/OpenSim/Framework/GridInfo.cs b/OpenSim/Framework/GridInfo.cs index 6639c8e9b0..9cf0c81271 100644 --- a/OpenSim/Framework/GridInfo.cs +++ b/OpenSim/Framework/GridInfo.cs @@ -31,8 +31,6 @@ using System.Net; using System.Reflection; using log4net; using Nini.Config; -using OpenMetaverse; -using OpenMetaverse.StructuredData; namespace OpenSim.Framework { diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 301456cec0..c7082749fc 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -65,10 +65,12 @@ namespace OpenSim.Services.GridService protected UUID m_ScopeID = UUID.Zero; // protected bool m_Check4096 = true; protected string m_MapTileDirectory = string.Empty; - protected string m_ThisGatekeeperURI = string.Empty; - protected string m_ThisGatekeeperHost = string.Empty; - protected string m_ThisGateKeeperIP = string.Empty; - protected HashSet m_ThisGateKeeperAlias = new HashSet(); + + protected GridInfo m_ThisGridInfo; + //protected string m_ThisGatekeeperURI = string.Empty; + //protected string m_ThisGatekeeperHost = string.Empty; + //protected string m_ThisGateKeeperIP = string.Empty; + //protected HashSet m_ThisGateKeeperAlias = new HashSet(); public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) { @@ -98,6 +100,7 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); + /* m_ThisGatekeeperURI = Util.GetConfigVarFromSections(config, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); m_ThisGatekeeperURI = gridConfig.GetString("Gatekeeper", m_ThisGatekeeperURI); @@ -120,6 +123,10 @@ namespace OpenSim.Services.GridService m_ThisGateKeeperAlias.Add(alias[i].Trim().ToLower()); } } + */ + + m_ThisGridInfo = new GridInfo(config); + m_log.DebugFormat("[HYPERGRID LINKER]: Local Gatekeeper: {0}", m_ThisGridInfo.GateKeeperURL); m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); @@ -177,13 +184,7 @@ namespace OpenSim.Services.GridService public bool IsLocalGrid(string UriHost) { - if(String.IsNullOrEmpty(UriHost)) - return true; - if(m_ThisGatekeeperHost.Equals(UriHost, StringComparison.InvariantCultureIgnoreCase)) - return true; - if (m_ThisGateKeeperIP.Equals(UriHost)) - return true; - return m_ThisGateKeeperAlias.Contains(UriHost.ToLower()); + return m_ThisGridInfo.IsLocalGrid(UriHost) == 1; } public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) @@ -262,6 +263,7 @@ namespace OpenSim.Services.GridService regInfo.EstateOwner = ownerID; // Make sure we're not hyperlinking to regions on this grid! + /* if (!String.IsNullOrWhiteSpace(m_ThisGateKeeperIP)) { if (m_ThisGatekeeperHost.Equals(regInfo.ExternalHostName, StringComparison.InvariantCultureIgnoreCase) @@ -273,6 +275,14 @@ namespace OpenSim.Services.GridService return false; } } + */ + + if(IsLocalGrid(regInfo.ServerURI)) + { + m_log.InfoFormat("[HYPERGRID LINKER]: Cannot hyperlink to regions on the same grid"); + reason = "Cannot hyperlink to regions on the same grid"; + return false; + } // Check for free coordinates GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);