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>(); ISimulationService simService = scene.RequestModuleInterface<ISimulationService>();
m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
new UserAgentServerConnector(m_Config, MainServer.Instance); new UserAgentServerConnector(m_Config, MainServer.Instance);
} }
scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
} }
#endregion #endregion

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -79,9 +79,16 @@ namespace OpenSim.Services.GridService
m_DefaultRegion = defs[0]; m_DefaultRegion = defs[0];
else else
{ {
// Best guess, may be totally off // Get any region
m_DefaultRegion = new GridRegion(1000, 1000); defs = m_GridService.GetRegionsByName(m_ScopeID, "", 1);
m_log.WarnFormat("[HYPERGRID LINKER]: This grid does not have a default region. Assuming default coordinates at 1000, 1000."); 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; return m_DefaultRegion;
@ -90,7 +97,7 @@ namespace OpenSim.Services.GridService
public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) 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_Database = db;
m_GridService = gridService; m_GridService = gridService;
@ -196,7 +203,7 @@ namespace OpenSim.Services.GridService
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 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; reason = string.Empty;
regInfo = new GridRegion(); regInfo = new GridRegion();
@ -280,29 +287,28 @@ namespace OpenSim.Services.GridService
public bool TryUnlinkRegion(string mapName) public bool TryUnlinkRegion(string mapName)
{ {
m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName);
GridRegion regInfo = null; 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) List<RegionData> regions = m_Database.Get(mapName, m_ScopeID);
if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) if (regions != null && regions.Count > 0)
regInfo = r;
}
else
{ {
foreach (GridRegion r in m_HyperlinkRegions.Values) OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]);
if (r.RegionName.Equals(mapName)) if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0)
regInfo = r; {
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) if (regInfo != null)
{ {
RemoveHyperlinkRegion(regInfo.RegionID); RemoveHyperlinkRegion(regInfo.RegionID);

View File

@ -119,7 +119,8 @@ namespace OpenSim.Services.HypergridService
imageURL = string.Empty; imageURL = string.Empty;
reason = 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) if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty)
{ {
List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID);