and yes HG uri again
parent
be490a8312
commit
9b9f93c4b2
|
@ -414,6 +414,26 @@ namespace OpenSim.Framework
|
||||||
return regionCoord << 8;
|
return regionCoord << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool checkServiceURI(string uristr, out string serviceURI)
|
||||||
|
{
|
||||||
|
serviceURI = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Uri uri = new Uri(uristr);
|
||||||
|
serviceURI = uri.AbsoluteUri;
|
||||||
|
if(uri.Port == 80)
|
||||||
|
serviceURI = serviceURI.Trim(new char[] { '/', ' ' }) +":80/";
|
||||||
|
else if(uri.Port == 443)
|
||||||
|
serviceURI = serviceURI.Trim(new char[] { '/', ' ' }) +":443/";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
serviceURI = string.Empty;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool buildHGRegionURI(string inputName, out string serverURI, out string regionName)
|
public static bool buildHGRegionURI(string inputName, out string serverURI, out string regionName)
|
||||||
{
|
{
|
||||||
serverURI = string.Empty;
|
serverURI = string.Empty;
|
||||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
private string m_ThisGatekeeper = string.Empty;
|
||||||
|
|
||||||
private IGridService m_LocalGridService;
|
private IGridService m_LocalGridService;
|
||||||
private IGridService m_RemoteGridService;
|
private IGridService m_RemoteGridService;
|
||||||
|
@ -118,13 +119,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache);
|
m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache);
|
||||||
if (m_LocalGridService == null)
|
if (m_LocalGridService == null)
|
||||||
{
|
{
|
||||||
m_log.Error("[REMOTE GRID CONNECTOR]: failed to loar local connector");
|
m_log.Error("[REMOTE GRID CONNECTOR]: failed to load local connector");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_RegionInfoCache == null)
|
if(m_RegionInfoCache == null)
|
||||||
m_RegionInfoCache = new RegionInfoCache();
|
m_RegionInfoCache = new RegionInfoCache();
|
||||||
|
|
||||||
|
m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
|
||||||
|
new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
|
||||||
|
// Legacy. Remove soon!
|
||||||
|
m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper);
|
||||||
|
|
||||||
|
Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,13 +241,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
if (rinfo != null)
|
if (rinfo != null)
|
||||||
return rinfo;
|
return rinfo;
|
||||||
|
|
||||||
// HG urls should not get here, strip them
|
// HG urls should not get here, strip them
|
||||||
|
// side effect is that local regions with same name as HG may also be found
|
||||||
|
// this mb good or bad
|
||||||
string regionName = name;
|
string regionName = name;
|
||||||
if(name.Contains("."))
|
if(name.Contains("."))
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(m_ThisGatekeeper))
|
||||||
|
return rinfo; // no HG
|
||||||
|
|
||||||
string regionURI = "";
|
string regionURI = "";
|
||||||
if(!Util.buildHGRegionURI(name, out regionURI, out regionName))
|
if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName))
|
||||||
return rinfo;
|
return rinfo; // invalid
|
||||||
|
if(m_ThisGatekeeper != regionURI)
|
||||||
|
return rinfo; // not local grid
|
||||||
}
|
}
|
||||||
|
|
||||||
rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
|
rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
|
||||||
|
@ -258,9 +273,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
string regionName = name;
|
string regionName = name;
|
||||||
if(name.Contains("."))
|
if(name.Contains("."))
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(m_ThisGatekeeper))
|
||||||
|
return rinfo; // no HG
|
||||||
|
|
||||||
string regionURI = "";
|
string regionURI = "";
|
||||||
if(!Util.buildHGRegionURI(name, out regionURI, out regionName))
|
if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName))
|
||||||
return rinfo;
|
return rinfo; // invalid
|
||||||
|
if(m_ThisGatekeeper != regionURI)
|
||||||
|
return rinfo; // not local grid
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber);
|
List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber);
|
||||||
|
|
Loading…
Reference in New Issue