give more use to GridInfo for gatekeeper url

This commit is contained in:
UbitUmarov
2020-09-23 22:21:57 +01:00
parent d0d1ab9f2a
commit 354c79168b
5 changed files with 26 additions and 89 deletions

View File

@@ -67,10 +67,6 @@ namespace OpenSim.Services.GridService
protected string m_MapTileDirectory = string.Empty;
protected GridInfo m_ThisGridInfo;
//protected string m_ThisGatekeeperURI = string.Empty;
//protected string m_ThisGatekeeperHost = string.Empty;
//protected string m_ThisGateKeeperIP = string.Empty;
//protected HashSet<string> m_ThisGateKeeperAlias = new HashSet<string>();
public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db)
{
@@ -100,31 +96,6 @@ namespace OpenSim.Services.GridService
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
/*
m_ThisGatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
m_ThisGatekeeperURI = gridConfig.GetString("Gatekeeper", m_ThisGatekeeperURI);
if(!Util.checkServiceURI(m_ThisGatekeeperURI, out m_ThisGatekeeperURI, out m_ThisGatekeeperHost, out m_ThisGateKeeperIP))
{
m_log.ErrorFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeperURI);
throw new Exception("Failed to resolve gatekeeper external IP, please check GatekeeperURI configuration");
}
string gatekeeperURIAlias = Util.GetConfigVarFromSections<string>(config, "GatekeeperURIAlias",
new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
if(!string.IsNullOrWhiteSpace(gatekeeperURIAlias))
{
string[] alias = gatekeeperURIAlias.Split(',');
for(int i = 0; i < alias.Length; ++i)
{
if(!string.IsNullOrWhiteSpace(alias[i]))
m_ThisGateKeeperAlias.Add(alias[i].Trim().ToLower());
}
}
*/
m_ThisGridInfo = new GridInfo(config);
m_log.DebugFormat("[HYPERGRID LINKER]: Local Gatekeeper: {0}", m_ThisGridInfo.GateKeeperURL);
@@ -193,10 +164,9 @@ namespace OpenSim.Services.GridService
GridRegion regInfo = null;
string serverURI = string.Empty;
string regionHost = string.Empty;
string regionName = string.Empty;
if (!Util.buildHGRegionURI(mapName, out serverURI, out regionHost, out regionName))
if (!Util.buildHGRegionURI(mapName, out serverURI, out regionName))
{
reason = "Wrong URI format for link-region";
return null;
@@ -262,21 +232,6 @@ namespace OpenSim.Services.GridService
regInfo.ScopeID = scopeID;
regInfo.EstateOwner = ownerID;
// Make sure we're not hyperlinking to regions on this grid!
/*
if (!String.IsNullOrWhiteSpace(m_ThisGateKeeperIP))
{
if (m_ThisGatekeeperHost.Equals(regInfo.ExternalHostName, StringComparison.InvariantCultureIgnoreCase)
|| m_ThisGateKeeperIP.Equals(regInfo.ExternalHostName)
|| m_ThisGateKeeperAlias.Contains(regInfo.ExternalHostName.ToLower()))
{
m_log.InfoFormat("[HYPERGRID LINKER]: Cannot hyperlink to regions on the same grid");
reason = "Cannot hyperlink to regions on the same grid";
return false;
}
}
*/
if(IsLocalGrid(regInfo.ServerURI))
{
m_log.InfoFormat("[HYPERGRID LINKER]: Cannot hyperlink to regions on the same grid");