mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
more on GridInfo
This commit is contained in:
@@ -125,9 +125,6 @@ namespace OpenSim.Framework
|
||||
|
||||
public bool ResolveDNS()
|
||||
{
|
||||
if (URLType == UriHostNameType.Unknown || String.IsNullOrWhiteSpace(Host))
|
||||
return false;
|
||||
|
||||
IPAddress ip = Util.GetHostFromDNS(Host);
|
||||
if (ip == null)
|
||||
return false;
|
||||
@@ -174,6 +171,7 @@ namespace OpenSim.Framework
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private bool m_hasHGconfig;
|
||||
private OSHostURL m_gateKeeperURL;
|
||||
private HashSet<OSHostURL> m_gateKeeperAlias;
|
||||
|
||||
@@ -199,6 +197,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
if (string.IsNullOrEmpty(gatekeeper))
|
||||
{
|
||||
m_hasHGconfig = false;
|
||||
if(!string.IsNullOrEmpty(defaultHost))
|
||||
m_gateKeeperURL = new OSHostURL(defaultHost, true);
|
||||
}
|
||||
@@ -261,6 +260,13 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasHGConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_hasHGconfig;
|
||||
}
|
||||
}
|
||||
public string GateKeeperURL
|
||||
{
|
||||
get
|
||||
@@ -271,6 +277,16 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public string GateKeeperURLNoEndSlash
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_gateKeeperURL.URLType != UriHostNameType.Unknown)
|
||||
return m_gateKeeperURL.URL.Substring(0, m_gateKeeperURL.URL.Length - 1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string HomeURL
|
||||
{
|
||||
get
|
||||
@@ -281,7 +297,11 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public int IsLocalGrid(string gatekeeper)
|
||||
// -2 dns failed
|
||||
// -1 if bad url
|
||||
// 0 if not local
|
||||
// 1 if local
|
||||
public int IsLocalGrid(string gatekeeper, bool withResolveCheck = false)
|
||||
{
|
||||
OSHostURL tmp = new OSHostURL(gatekeeper, false);
|
||||
if(tmp.URLType == UriHostNameType.Unknown)
|
||||
@@ -290,6 +310,10 @@ namespace OpenSim.Framework
|
||||
return 1;
|
||||
if (m_gateKeeperAlias != null && m_gateKeeperAlias.Contains(tmp))
|
||||
return 1;
|
||||
if (withResolveCheck)
|
||||
{
|
||||
return tmp.ResolveDNS() ? 0 : -2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
private IMessageTransferModule m_TransferModule = null;
|
||||
private bool m_Enabled = false;
|
||||
|
||||
private string m_ThisGridURL;
|
||||
private GridInfo m_thisGridInfo;
|
||||
|
||||
private readonly ExpiringCacheOS<UUID, GridInstantMessage> m_PendingLures = new ExpiringCacheOS<UUID, GridInstantMessage>(3600000);
|
||||
|
||||
@@ -64,12 +64,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
if (config.Configs["Messaging"].GetString("LureModule", string.Empty) == "HGLureModule")
|
||||
{
|
||||
m_Enabled = true;
|
||||
|
||||
m_ThisGridURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
|
||||
new string[] { "Startup", "Hypergrid", "Messaging" }, String.Empty);
|
||||
// Legacy. Remove soon!
|
||||
m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL);
|
||||
m_log.DebugFormat("[LURE MODULE]: {0} enabled", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +76,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
lock (m_scenes)
|
||||
{
|
||||
m_scenes.Add(scene);
|
||||
if(m_thisGridInfo == null)
|
||||
m_thisGridInfo = scene.SceneGridInfo;
|
||||
scene.EventManager.OnIncomingInstantMessage += OnIncomingInstantMessage;
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
}
|
||||
@@ -135,6 +131,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_thisGridInfo = null;
|
||||
}
|
||||
|
||||
public string Name
|
||||
@@ -189,7 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
Scene scene = (Scene)(client.Scene);
|
||||
ScenePresence presence = scene.GetScenePresence(client.AgentId);
|
||||
|
||||
message += "@" + m_ThisGridURL;
|
||||
message += "@" + m_thisGridInfo.GateKeeperURLNoEndSlash;
|
||||
|
||||
m_log.DebugFormat("[HG LURE MODULE]: TP invite with message {0}", message);
|
||||
|
||||
@@ -241,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
if (parts.Length > 1)
|
||||
{
|
||||
string url = parts[parts.Length - 1]; // the last part
|
||||
if (url.Trim(new char[] {'/'}) != m_ThisGridURL.Trim(new char[] {'/'}))
|
||||
if (m_thisGridInfo.IsLocalGrid(url, true) == 0)
|
||||
{
|
||||
m_log.DebugFormat("[HG LURE MODULE]: Luring agent to grid {0} region {1} position {2}", url, im.RegionID, im.Position);
|
||||
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
string regionName = name;
|
||||
if(name.Contains("."))
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(m_ThisGridInfo.GateKeeperURL))
|
||||
if(!m_ThisGridInfo.HasHGConfig)
|
||||
return rinfo; // no HG
|
||||
|
||||
string regionURI = "";
|
||||
@@ -293,7 +293,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
string regionName = name;
|
||||
if(name.Contains("."))
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(m_ThisGridInfo.GateKeeperURL))
|
||||
if(!m_ThisGridInfo.HasHGConfig)
|
||||
return rinfo; // no HG
|
||||
|
||||
string regionURI = "";
|
||||
|
||||
Reference in New Issue
Block a user