From b7f81d34928cb2d7296b91a8569adb488c264e36 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Aug 2011 01:06:32 +0100 Subject: 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 8c3eb324c4b666e7abadef4a714d1bd8d5f71ac2 --- OpenSim/Services/GridService/GridService.cs | 33 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index a6fbc00..f663dd6 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -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 rdatas = m_Database.Get(regionName, scopeID); + List 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 GetRegionsByName(UUID scopeID, string name, int maxNumber) { - m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); +// m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); List 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; } + /// + /// Get a hypergrid region. + /// + /// + /// + /// null if no hypergrid region could be found. + protected GridRegion GetHypergridRegionByName(UUID scopeID, string name) + { + if (name.Contains(".")) + return m_HypergridLinker.LinkRegion(scopeID, name); + else + return null; + } + public List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) { int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; -- cgit v1.1