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))
return null;
bool localGrid = string.IsNullOrWhiteSpace(regionURI);
string mapname = regionURI + regionName;
bool haveMatch = false;
@ -531,7 +532,7 @@ namespace OpenSim.Services.GridService
if(haveMatch)
return rinfos;
}
rdatas = m_Database.Get(Util.EscapeForLike(mapname)+ "%", scopeID);
if (rdatas != null && (rdatas.Count > 0))
{
@ -554,14 +555,16 @@ namespace OpenSim.Services.GridService
if(haveMatch)
return rinfos;
}
string HGname = regionURI +" "+ regionName;
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
if (r != null)
if(!localGrid)
{
if( count == maxNumber)
rinfos.RemoveAt(count - 1);
rinfos.Add(r);
string HGname = regionURI +" "+ regionName; // include space for compatibility
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
if (r != null)
{
if( count == maxNumber)
rinfos.RemoveAt(count - 1);
rinfos.Add(r);
}
}
}
else if (rdatas != null && (rdatas.Count > 0))
@ -597,11 +600,13 @@ namespace OpenSim.Services.GridService
if ((rdatas != null) && (rdatas.Count > 0))
return RegionData2RegionInfo(rdatas[0]); // get the first
string HGname = regionURI +" "+ regionName;
return m_HypergridLinker.LinkRegion(scopeID, HGname);
if(!string.IsNullOrWhiteSpace(regionURI))
{
string HGname = regionURI +" "+ regionName;
return m_HypergridLinker.LinkRegion(scopeID, HGname);
}
}
else
return null;
return null;
}
public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)

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_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_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
@ -302,6 +308,10 @@ namespace OpenSim.Services.GridService
serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/";
else if(uri.Port == 443)
serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/";
if(serverURI == m_ThisGatekeeper)
serverURI = ""; // local grid, look for region name only
return true;
}