GetRegionsByName and GetHypergridRegionByName: detect that provided url is for local grid, and make it a local by region name local search

melanie
UbitUmarov 2016-12-15 23:48:25 +00:00
parent 48efbeb8d3
commit c0a23d36df
2 changed files with 27 additions and 12 deletions

View File

@ -508,6 +508,7 @@ namespace OpenSim.Services.GridService
if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName)) if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName))
return null; return null;
bool localGrid = string.IsNullOrWhiteSpace(regionURI);
string mapname = regionURI + regionName; string mapname = regionURI + regionName;
bool haveMatch = false; bool haveMatch = false;
@ -554,8 +555,9 @@ namespace OpenSim.Services.GridService
if(haveMatch) if(haveMatch)
return rinfos; return rinfos;
} }
if(!localGrid)
string HGname = regionURI +" "+ regionName; {
string HGname = regionURI +" "+ regionName; // include space for compatibility
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname); GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
if (r != null) if (r != null)
{ {
@ -564,6 +566,7 @@ namespace OpenSim.Services.GridService
rinfos.Add(r); rinfos.Add(r);
} }
} }
}
else if (rdatas != null && (rdatas.Count > 0)) else if (rdatas != null && (rdatas.Count > 0))
{ {
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); // m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
@ -597,10 +600,12 @@ namespace OpenSim.Services.GridService
if ((rdatas != null) && (rdatas.Count > 0)) if ((rdatas != null) && (rdatas.Count > 0))
return RegionData2RegionInfo(rdatas[0]); // get the first return RegionData2RegionInfo(rdatas[0]); // get the first
if(!string.IsNullOrWhiteSpace(regionURI))
{
string HGname = regionURI +" "+ regionName; string HGname = regionURI +" "+ regionName;
return m_HypergridLinker.LinkRegion(scopeID, HGname); return m_HypergridLinker.LinkRegion(scopeID, HGname);
} }
else }
return null; return null;
} }

View File

@ -137,6 +137,12 @@ namespace OpenSim.Services.GridService
m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
} }
m_ThisGatekeeper = m_ThisGatekeeperURI.AbsoluteUri;
if(m_ThisGatekeeperURI.Port == 80)
m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) +":80/";
else if(m_ThisGatekeeperURI.Port == 443)
m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) +":443/";
m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
@ -302,6 +308,10 @@ namespace OpenSim.Services.GridService
serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/"; serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/";
else if(uri.Port == 443) else if(uri.Port == 443)
serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/"; serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/";
if(serverURI == m_ThisGatekeeper)
serverURI = ""; // local grid, look for region name only
return true; return true;
} }