Assorted bug fixes in hypergrid linking.

slimupdates
Diva Canto 2010-05-03 09:50:55 -07:00
parent 1494c84f56
commit b10811a13b
8 changed files with 46 additions and 32 deletions

View File

@ -113,10 +113,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
ISimulationService simService = scene.RequestModuleInterface<ISimulationService>();
m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
new UserAgentServerConnector(m_Config, MainServer.Instance);
}
scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
}
#endregion

View File

@ -191,10 +191,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public override List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
{
List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber);
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count);
List<GridRegion> grinfo = base.GetRegionsByName(scopeID, name, maxNumber);
if (grinfo != null)
{
//m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionsByName {0} found {1} regions", name, grinfo.Count);
rinfo.AddRange(grinfo);
}
return rinfo;
}

View File

@ -70,7 +70,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);
server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler);
}
public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server)

View File

@ -48,6 +48,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
public HypergridHandlers(IGatekeeperService gatekeeper)
{
m_GatekeeperService = gatekeeper;
m_log.DebugFormat("[HYPERGRID HANDLERS]: Active");
}
/// <summary>
@ -61,6 +62,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
//string host = (string)requestData["host"];
//string portstr = (string)requestData["port"];
string name = (string)requestData["region_name"];
if (name == null)
name = string.Empty;
UUID regionID = UUID.Zero;
string externalName = string.Empty;

View File

@ -300,7 +300,7 @@ namespace OpenSim.Services.Connectors
if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response",
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region",
scopeID, x, y);
}
else
@ -391,9 +391,6 @@ namespace OpenSim.Services.Connectors
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response",
scopeID, name, maxNumber);
}
}
else

View File

@ -315,6 +315,8 @@ namespace OpenSim.Services.GridService
public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
{
m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID);
int count = 0;
@ -329,7 +331,7 @@ 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) && name.Contains(".")))
{
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name);
if (r != null)
@ -397,6 +399,7 @@ namespace OpenSim.Services.GridService
ret.Add(RegionData2RegionInfo(r));
}
m_log.DebugFormat("[GRID SERVICE]: GetDefaultRegions returning {0} regions", ret.Count);
return ret;
}

View File

@ -79,9 +79,16 @@ namespace OpenSim.Services.GridService
m_DefaultRegion = defs[0];
else
{
// Best guess, may be totally off
m_DefaultRegion = new GridRegion(1000, 1000);
m_log.WarnFormat("[HYPERGRID LINKER]: This grid does not have a default region. Assuming default coordinates at 1000, 1000.");
// Get any region
defs = m_GridService.GetRegionsByName(m_ScopeID, "", 1);
if (defs != null && defs.Count > 0)
m_DefaultRegion = defs[0];
else
{
// This shouldn't happen
m_DefaultRegion = new GridRegion(1000, 1000);
m_log.Error("[HYPERGRID LINKER]: Something is wrong with this grid. It has no regions?");
}
}
}
return m_DefaultRegion;
@ -90,7 +97,7 @@ namespace OpenSim.Services.GridService
public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db)
{
m_log.DebugFormat("[HYPERGRID LINKER]: Starting...");
m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType());
m_Database = db;
m_GridService = gridService;
@ -196,7 +203,7 @@ namespace OpenSim.Services.GridService
public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
{
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc);
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
reason = string.Empty;
regInfo = new GridRegion();
@ -280,29 +287,28 @@ namespace OpenSim.Services.GridService
public bool TryUnlinkRegion(string mapName)
{
m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName);
GridRegion regInfo = null;
if (mapName.Contains(":"))
{
string host = "127.0.0.1";
//string portstr;
//string regionName = "";
uint port = 9000;
string[] parts = mapName.Split(new char[] { ':' });
if (parts.Length >= 1)
{
host = parts[0];
}
foreach (GridRegion r in m_HyperlinkRegions.Values)
if (host.Equals(r.ExternalHostName) && (port == r.HttpPort))
regInfo = r;
}
else
List<RegionData> regions = m_Database.Get(mapName, m_ScopeID);
if (regions != null && regions.Count > 0)
{
foreach (GridRegion r in m_HyperlinkRegions.Values)
if (r.RegionName.Equals(mapName))
regInfo = r;
OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]);
if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0)
{
regInfo = new GridRegion();
regInfo.RegionID = regions[0].RegionID;
regInfo.ScopeID = m_ScopeID;
}
}
//foreach (GridRegion r in m_HyperlinkRegions.Values)
//{
// m_log.DebugFormat("XXX Comparing {0}:{1} with {2}:{3}", host, port, r.ExternalHostName, r.HttpPort);
// if (host.Equals(r.ExternalHostName) && (port == r.HttpPort))
// regInfo = r;
//}
if (regInfo != null)
{
RemoveHyperlinkRegion(regInfo.RegionID);

View File

@ -119,7 +119,8 @@ namespace OpenSim.Services.HypergridService
imageURL = string.Empty;
reason = string.Empty;
m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty ? "default region" : regionName));
m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName);
if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty)
{
List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID);