Improvement over 2 commits ago: make the hyperlink check understand port 80.

0.7.1-dev
Diva Canto 2011-03-28 19:34:55 -07:00
parent d3771e5366
commit 309eb712a3
1 changed files with 29 additions and 4 deletions

View File

@ -66,6 +66,7 @@ namespace OpenSim.Services.GridService
protected bool m_Check4096 = true;
protected string m_MapTileDirectory = string.Empty;
protected string m_ThisGatekeeper = string.Empty;
protected Uri m_ThisGatekeeperURI = null;
// Hyperlink regions are hyperlinks on the map
public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
@ -125,6 +126,14 @@ namespace OpenSim.Services.GridService
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty);
try
{
m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper);
}
catch
{
m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
}
m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
@ -249,6 +258,8 @@ namespace OpenSim.Services.GridService
remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
reason = string.Empty;
Uri uri = null;
regInfo = new GridRegion();
if ( externalPort > 0)
regInfo.HttpPort = externalPort;
@ -259,8 +270,17 @@ namespace OpenSim.Services.GridService
else
regInfo.ExternalHostName = "0.0.0.0";
if ( serverURI != null)
{
regInfo.ServerURI = serverURI;
try
{
uri = new Uri(serverURI);
regInfo.ExternalHostName = uri.Host;
regInfo.HttpPort = (uint)uri.Port;
}
catch {}
}
if ( remoteRegionName != string.Empty )
regInfo.RegionName = remoteRegionName;
@ -270,11 +290,16 @@ namespace OpenSim.Services.GridService
regInfo.EstateOwner = ownerID;
// Make sure we're not hyperlinking to regions on this grid!
if (regInfo.ServerURI.Trim(new char[]{'/', ' '}) == m_ThisGatekeeper.Trim(new char[]{'/', ' '}))
if (m_ThisGatekeeperURI != null)
{
reason = "Cannot hyperlink to regions on the same grid";
return false;
if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port)
{
reason = "Cannot hyperlink to regions on the same grid";
return false;
}
}
else
m_log.WarnFormat("[HYPERGRID LINKER]: Please set this grid's Gatekeeper's address in [GridService]!");
// Check for free coordinates
GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);