From ae130d9f25de9d46038270337ddc967e0e8ab1d9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 2 Sep 2019 22:48:06 +0100 Subject: mantis 8580: make some changes on regions find code. (only gatekeeper host is used on local grid detection, not its port) --- .../Grid/RemoteGridServiceConnector.cs | 33 ++++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index ee17093..cd67d88 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -52,7 +52,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid MethodBase.GetCurrentMethod().DeclaringType); private bool m_Enabled = false; - private string m_ThisGatekeeper = string.Empty; + private string m_ThisGatekeeperURI = string.Empty; + private string m_ThisGatekeeperHost = string.Empty; + private string m_ThisGatekeeperIP = string.Empty; private IGridService m_LocalGridService; private IGridService m_RemoteGridService; @@ -126,13 +128,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if(m_RegionInfoCache == null) m_RegionInfoCache = new RegionInfoCache(); - m_ThisGatekeeper = Util.GetConfigVarFromSections(source, "GatekeeperURI", + m_ThisGatekeeperURI = Util.GetConfigVarFromSections(source, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); // Legacy. Remove soon! - m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); - - Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper); + m_ThisGatekeeperURI = gridConfig.GetString("Gatekeeper", m_ThisGatekeeperURI); + Util.checkServiceURI(m_ThisGatekeeperURI, out m_ThisGatekeeperURI, out m_ThisGatekeeperHost, out m_ThisGatekeeperIP); return true; } @@ -247,14 +248,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid string regionName = name; if(name.Contains(".")) { - if(string.IsNullOrWhiteSpace(m_ThisGatekeeper)) + if(string.IsNullOrWhiteSpace(m_ThisGatekeeperIP)) return rinfo; // no HG string regionURI = ""; - if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) + string regionHost = ""; + if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName)) return rinfo; // invalid - if(m_ThisGatekeeper != regionURI) + if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase) && !m_ThisGatekeeperIP.Equals(regionHost)) return rinfo; // not local grid + if (String.IsNullOrEmpty(regionName)) + return m_RemoteGridService.GetDefaultRegions(scopeID)[0]; } rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); @@ -273,17 +277,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid string regionName = name; if(name.Contains(".")) { - if(string.IsNullOrWhiteSpace(m_ThisGatekeeper)) + if(string.IsNullOrWhiteSpace(m_ThisGatekeeperURI)) return rinfo; // no HG string regionURI = ""; - if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) + string regionHost = ""; + if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName)) return rinfo; // invalid - if(m_ThisGatekeeper != regionURI) + if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase) && !m_ThisGatekeeperIP.Equals(regionHost)) return rinfo; // not local grid } - List grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber); + List grinfo = null; + if (String.IsNullOrEmpty(regionName)) + grinfo = m_RemoteGridService.GetDefaultRegions(scopeID); + else + grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber); if (grinfo != null) { -- cgit v1.1