several changes to simulatorfeatures, special url ones. Centralize those on scene gridinfo. Do host and dns checks, etc. Grid can override local settings, but currently same old mess. Grid login and info fecth should happen before loading anything in scene, specially modules

This commit is contained in:
UbitUmarov
2020-11-12 00:30:20 +00:00
parent ddc1083383
commit 20695be8cd
5 changed files with 308 additions and 71 deletions

View File

@@ -406,6 +406,13 @@ namespace OpenSim
/// <returns></returns>
public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene)
{
IRegionModulesController controller;
if (!ApplicationRegistry.TryGet(out controller))
{
m_log.Fatal("REGIONMODULES]: The new RegionModulesController is missing...");
Environment.Exit(0);
}
int port = regionInfo.InternalEndPoint.Port;
// set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims)
@@ -429,7 +436,6 @@ namespace OpenSim
regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName +
":" + regionInfo.HttpPort.ToString() + "/";
regionInfo.osSecret = m_osSecret;
if ((proxyUrl.Length > 0) && (portadd_flag))
@@ -442,16 +448,9 @@ namespace OpenSim
Scene scene = SetupScene(regionInfo, proxyOffset, Config);
m_log.Info("[MODULES]: Loading Region's modules (old style)");
// Use this in the future, the line above will be deprecated soon
m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)");
IRegionModulesController controller;
if (ApplicationRegistry.TryGet(out controller))
{
m_log.Info("[REGIONMODULES]: Loading Region's modules");
if (controller != null)
controller.AddRegionToModules(scene);
}
else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
if (m_securePermissionsLoading)
{
@@ -520,8 +519,7 @@ namespace OpenSim
scene.SnmpService.BootInfo("Grid Registration done", scene);
}
// We need to do this after we've initialized the
// scripting engines.
// We need to do this after we've initialized the scripting engines.
scene.CreateScriptInstances();
if (scene.SnmpService != null)

View File

@@ -72,11 +72,7 @@ namespace OpenSim.Region.ClientStack.Linden
/// </summary>
private OSDMap m_features = new OSDMap();
private string m_SearchURL = string.Empty;
private string m_DestinationGuideURL = string.Empty;
private bool m_ExportSupported = false;
private string m_GridName = string.Empty;
private string m_GridURL = string.Empty;
private bool m_doScriptSyntax;
@@ -84,8 +80,6 @@ namespace OpenSim.Region.ClientStack.Linden
static private UUID m_scriptSyntaxID = UUID.Zero;
static private byte[] m_scriptSyntaxXML = null;
static private string m_economyURL = null;
#region ISharedRegionModule Members
public void Initialise(IConfigSource source)
@@ -94,34 +88,10 @@ namespace OpenSim.Region.ClientStack.Linden
m_doScriptSyntax = true;
if (config != null)
{
//
// All this is obsolete since getting these features from the grid service!!
// Will be removed after the next release
//
m_SearchURL = config.GetString("SearchServerURI", m_SearchURL);
m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL);
if (m_DestinationGuideURL == string.Empty) // Make this consistent with the variable in the LoginService config
m_DestinationGuideURL = config.GetString("DestinationGuide", m_DestinationGuideURL);
m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
m_GridURL = Util.GetConfigVarFromSections<string>(
source, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "SimulatorFeatures" }, String.Empty);
m_GridName = config.GetString("GridName", string.Empty);
if (m_GridName == string.Empty)
m_GridName = Util.GetConfigVarFromSections<string>(
source, "GridName", new string[] { "GridInfo", "SimulatorFeatures" }, String.Empty);
if (m_GridName == string.Empty)
m_GridName = Util.GetConfigVarFromSections<string>(
source, "gridname", new string[] { "GridInfo", "SimulatorFeatures" }, String.Empty);
m_doScriptSyntax = config.GetBoolean("ScriptSyntax", m_doScriptSyntax);
}
m_economyURL = Util.GetConfigVarFromSections<string>(source, "economy", new string[] { "Economy", "GridInfo" });
ReadScriptSyntax();
AddDefaultFeatures();
}
@@ -208,19 +178,8 @@ namespace OpenSim.Region.ClientStack.Linden
extrasMap["MinHeightmap"] = Constants.MinTerrainHeightmap;
extrasMap["MaxHeightmap"] = Constants.MaxTerrainHeightmap;
// TODO: Take these out of here into their respective modules, like map-server-url
if (!string.IsNullOrWhiteSpace(m_SearchURL))
extrasMap["search-server-url"] = m_SearchURL;
if (!string.IsNullOrEmpty(m_DestinationGuideURL))
extrasMap["destination-guide-url"] = m_DestinationGuideURL;
if (m_ExportSupported)
extrasMap["ExportSupported"] = true;
if (!string.IsNullOrWhiteSpace(m_GridURL))
extrasMap["GridURL"] = m_GridURL;
if (!string.IsNullOrWhiteSpace(m_GridName))
extrasMap["GridName"] = m_GridName;
if(!string.IsNullOrWhiteSpace(m_economyURL))
extrasMap["currency-base-uri"] = Util.AppendEndSlash(m_economyURL);
if (extrasMap.Count > 0)
m_features["OpenSimExtras"] = extrasMap;
}
@@ -363,6 +322,7 @@ namespace OpenSim.Region.ClientStack.Linden
return;
}
GridInfo ginfo = scene.SceneGridInfo;
lock (m_features)
{
OSDMap extrasMap;
@@ -375,12 +335,41 @@ namespace OpenSim.Region.ClientStack.Linden
foreach (string key in extraFeatures.Keys)
{
extrasMap[key] = (string)extraFeatures[key];
if (key == "ExportSupported")
string val = (string)extraFeatures[key];
switch(key)
{
bool.TryParse(extraFeatures[key].ToString(), out m_ExportSupported);
case "GridName":
ginfo.GridName = val;
break;
case "GridNick":
ginfo.GridNick = val;
break;
case "GridURL":
ginfo.GridUrl = val;
break;
case "GridURLAlias":
string[] vals = val.Split(',');
if(vals.Length > 0)
ginfo.GridUrlAlias = vals;
break;
case "search-server-url":
ginfo.SearchURL = val;
break;
case "destination-guide-url":
ginfo.DestinationGuideURL = val;
break;
case "currency-base-uri":
ginfo.EconomyURL = val;
break;
default:
extrasMap[key] = val;
if (key == "ExportSupported")
{
bool.TryParse(val, out m_ExportSupported);
}
break;
}
}
m_features["OpenSimExtras"] = extrasMap;
}

View File

@@ -1268,6 +1268,69 @@ namespace OpenSim.Region.Framework.Scenes
fm.AddOpenSimExtraFeature("MaxPrimScale", OSD.FromReal(m_maxNonphys));
fm.AddOpenSimExtraFeature("MinPhysPrimScale", OSD.FromReal(m_minPhys));
fm.AddOpenSimExtraFeature("MaxPhysPrimScale", OSD.FromReal(m_maxPhys));
if(SceneGridInfo != null)
{
OSD osdtmp;
string tmp;
if (!fm.TryGetOpenSimExtraFeature("GridName", out osdtmp))
{
tmp = SceneGridInfo.GridName;
if (!string.IsNullOrEmpty(tmp))
fm.AddOpenSimExtraFeature("GridName", tmp);
}
if (!fm.TryGetOpenSimExtraFeature("GridNick", out osdtmp))
{
tmp = SceneGridInfo.GridNick;
if (!string.IsNullOrEmpty(tmp))
fm.AddOpenSimExtraFeature("GridNick", tmp);
}
if (!fm.TryGetOpenSimExtraFeature("GridURL", out osdtmp))
{
tmp = SceneGridInfo.GridUrl;
fm.AddOpenSimExtraFeature("GridURL", tmp);
}
if (!fm.TryGetOpenSimExtraFeature("GridURLAlias", out osdtmp))
{
string[] alias = SceneGridInfo.GridUrlAlias;
if(alias != null && alias.Length > 0)
{
StringBuilder sb = osStringBuilderCache.Acquire();
int i = 0;
for(; i < alias.Length - 1; ++i)
{
sb.Append(alias[i]);
sb.Append(',');
}
sb.Append(alias[i]);
fm.AddOpenSimExtraFeature("GridURLAlias", osStringBuilderCache.GetStringAndRelease(sb));
}
}
if (!fm.TryGetOpenSimExtraFeature("search-server-url", out osdtmp))
{
tmp = SceneGridInfo.SearchURL;
if (!string.IsNullOrEmpty(tmp))
fm.AddOpenSimExtraFeature("search-server-url", tmp);
}
if (!fm.TryGetOpenSimExtraFeature("destination-guide-url", out osdtmp))
{
tmp = SceneGridInfo.DestinationGuideURL;
if (!string.IsNullOrEmpty(tmp))
fm.AddOpenSimExtraFeature("destination-guide-url", tmp);
}
if (!fm.TryGetOpenSimExtraFeature("currency-base-uri", out osdtmp))
{
tmp = SceneGridInfo.EconomyURL;
if (!string.IsNullOrEmpty(tmp))
fm.AddOpenSimExtraFeature("currency-base-uri", tmp);
}
}
}
}