From a87a247f0548d39a8c39b1d28123d7da8db44598 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Jan 2010 07:20:13 +0000 Subject: Revert "Updates all IRegionModules to the new style region modules." This reverts commit ec3c31e61e5e540f822891110df9bc978655bbaf. --- .../InterGrid/OpenGridProtocolModule.cs | 100 ++++++++------------- 1 file changed, 38 insertions(+), 62 deletions(-) (limited to 'OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs') diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 8bb0fa9..10a3232 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -35,7 +35,6 @@ using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Web; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -76,9 +75,8 @@ namespace OpenSim.Region.CoreModules.InterGrid public bool visible_to_parent; public string teleported_into_region; } - - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class OpenGridProtocolModule : ISharedRegionModule + + public class OpenGridProtocolModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private List m_scene = new List(); @@ -94,22 +92,21 @@ namespace OpenSim.Region.CoreModules.InterGrid private bool httpSSL = false; private uint httpsslport = 0; private bool GridMode = false; - private bool m_enabled = false; - private IConfig cfg = null; - private IConfig httpcfg = null; - private IConfig startupcfg = null; - - #region ISharedRegionModule Members - public void Initialise(IConfigSource config) + #region IRegionModule Members + + public void Initialise(Scene scene, IConfigSource config) { + bool enabled = false; + IConfig cfg = null; + IConfig httpcfg = null; + IConfig startupcfg = null; try { cfg = config.Configs["OpenGridProtocol"]; - } - catch (NullReferenceException) + } catch (NullReferenceException) { - m_enabled = false; + enabled = false; } try @@ -131,15 +128,15 @@ namespace OpenSim.Region.CoreModules.InterGrid if (startupcfg != null) { - GridMode = m_enabled = startupcfg.GetBoolean("gridmode", false); + GridMode = enabled = startupcfg.GetBoolean("gridmode", false); } if (cfg != null) { - m_enabled = cfg.GetBoolean("ogp_enabled", false); + enabled = cfg.GetBoolean("ogp_enabled", false); LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); - if (m_enabled) + if (enabled) { m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); lock (m_scene) @@ -168,61 +165,35 @@ namespace OpenSim.Region.CoreModules.InterGrid } } + // can't pick the region 'agent' because it would conflict with our agent domain handler + // a zero length region name would conflict with are base region seed cap + if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) + { + MainServer.Instance.AddLLSDHandler( + "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), + ProcessRegionDomainSeed); + } + + if (!m_scene.Contains(scene)) + m_scene.Add(scene); } } } - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - if (m_enabled) + lock (m_scene) { - lock (m_scene) + if (m_scene.Count == 1) { - if (m_scene.Count == 1) + if (httpcfg != null) { - if (httpcfg != null) - { - httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); - httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); - if (httpsCN.Length == 0) - httpsCN = scene.RegionInfo.ExternalHostName; - httpsslport = (uint)httpcfg.GetInt("http_listener_sslport", ((int)scene.RegionInfo.HttpPort + 1)); - } + httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); + httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); + if (httpsCN.Length == 0) + httpsCN = scene.RegionInfo.ExternalHostName; + httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1)); } } - // can't pick the region 'agent' because it would conflict with our agent domain handler - // a zero length region name would conflict with are base region seed cap - if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) - { - MainServer.Instance.AddLLSDHandler( - "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), - ProcessRegionDomainSeed); - } - - if (!m_scene.Contains(scene)) - m_scene.Add(scene); } } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - MainServer.Instance.RemoveLLSDHandler( - "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), - ProcessRegionDomainSeed); - - if (m_scene.Contains(scene)) - m_scene.Remove(scene); - } public void PostInitialise() { @@ -238,6 +209,11 @@ namespace OpenSim.Region.CoreModules.InterGrid get { return "OpenGridProtocolModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) -- cgit v1.1