If GetRegionByName can't match something in the local db, then search the hypergrid if that functionality has been enabled.

This should fix the problem today where old style HG addresses (e.g. "hg.osgrid.org:80:Vue-6400") stopped working since 8c3eb324c4
bulletsim
Justin Clark-Casey (justincc) 2011-08-02 01:06:32 +01:00
parent d2220da205
commit b7f81d3492
1 changed files with 27 additions and 6 deletions

View File

@ -320,18 +320,25 @@ namespace OpenSim.Services.GridService
return null;
}
public GridRegion GetRegionByName(UUID scopeID, string regionName)
public GridRegion GetRegionByName(UUID scopeID, string name)
{
List<RegionData> rdatas = m_Database.Get(regionName, scopeID);
List<RegionData> rdatas = m_Database.Get(name, scopeID);
if ((rdatas != null) && (rdatas.Count > 0))
return RegionData2RegionInfo(rdatas[0]); // get the first
if (m_AllowHypergridMapSearch)
{
GridRegion r = GetHypergridRegionByName(scopeID, name);
if (r != null)
return r;
}
return null;
}
public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
{
m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
// m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
List<RegionData> rdatas = m_Database.Get(name + "%", scopeID);
@ -340,7 +347,7 @@ namespace OpenSim.Services.GridService
if (rdatas != null)
{
m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
foreach (RegionData rdata in rdatas)
{
if (count++ < maxNumber)
@ -348,9 +355,9 @@ namespace OpenSim.Services.GridService
}
}
if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)) && name.Contains("."))
if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)))
{
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name);
GridRegion r = GetHypergridRegionByName(scopeID, name);
if (r != null)
rinfos.Add(r);
}
@ -358,6 +365,20 @@ namespace OpenSim.Services.GridService
return rinfos;
}
/// <summary>
/// Get a hypergrid region.
/// </summary>
/// <param name="scopeID"></param>
/// <param name="name"></param>
/// <returns>null if no hypergrid region could be found.</returns>
protected GridRegion GetHypergridRegionByName(UUID scopeID, string name)
{
if (name.Contains("."))
return m_HypergridLinker.LinkRegion(scopeID, name);
else
return null;
}
public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
{
int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;