more on GridInfo

This commit is contained in:
UbitUmarov
2020-09-25 11:45:02 +01:00
parent a2534dc378
commit 9734a86489
3 changed files with 36 additions and 15 deletions

View File

@@ -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();

View File

@@ -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 = "";