From 2a886fd76c9df972fa3096d19b37047f7eda672f Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 21 Oct 2009 02:19:45 +0100 Subject: [PATCH] Really make module port selection work. Implement port setting in LLProxyLoginModule. --- .../RegionModulesControllerPlugin.cs | 33 ++++++++++++++++--- OpenSim/Client/Linden/LLProxyLoginModule.cs | 12 +++++-- OpenSim/Framework/MainServer.cs | 4 ++- bin/config-include/GridCommon.ini.example | 4 +++ 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs index 13cb34c5b0..ddc37edd85 100644 --- a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs +++ b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs @@ -93,7 +93,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController { // Get the config string string moduleString = - modulesConfig.GetString(node.Id, String.Empty); + modulesConfig.GetString("Setup_" + node.Id, String.Empty); // We have a selector if (moduleString != String.Empty) @@ -121,6 +121,31 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController } else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null) { + // Get the config string + string moduleString = + modulesConfig.GetString("Setup_" + node.Id, String.Empty); + + // We have a selector + if (moduleString != String.Empty) + { + // Allow disabling modules even if they don't have + // support for it + if (moduleString == "disabled") + continue; + + // Split off port, if present + string[] moduleParts = moduleString.Split(new char[] {'/'}, 2); + // Format is [port/][class] + string className = moduleParts[0]; + if (moduleParts.Length > 1) + className = moduleParts[1]; + + // Match the class name if given + if (className != String.Empty && + node.Type.ToString() != className) + continue; + } + m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type); m_nonSharedModules.Add(node); } @@ -137,11 +162,11 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController // foreach (TypeExtensionNode node in m_sharedModules) { - Object[] ctorArgs = new Object[] {0}; + Object[] ctorArgs = new Object[] {(uint)0}; // Read the config again string moduleString = - modulesConfig.GetString(node.Id, String.Empty); + modulesConfig.GetString("Setup_" + node.Id, String.Empty); // Get the port number, if there is one if (moduleString != String.Empty) @@ -302,7 +327,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController // Read the config string moduleString = - modulesConfig.GetString(node.Id, String.Empty); + modulesConfig.GetString("Setup_" + node.Id, String.Empty); // Get the port number, if there is one if (moduleString != String.Empty) diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index 2da774f755..ad67c440bb 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs @@ -50,8 +50,16 @@ namespace OpenSim.Client.Linden /// public class LLProxyLoginModule : ISharedRegionModule { + private uint m_port = 0; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public LLProxyLoginModule(uint port) + { + m_log.DebugFormat("[CLIENT]: LLProxyLoginModule port {0}", port); + m_port = port; + } + protected bool RegionLoginsEnabled { get @@ -148,8 +156,8 @@ namespace OpenSim.Client.Linden protected void AddHttpHandlers() { //we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change? - MainServer.Instance.AddXmlRPCHandler("expect_user", ExpectUser, false); - MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser, false); + MainServer.GetHttpServer(m_port).AddXmlRPCHandler("expect_user", ExpectUser, false); + MainServer.GetHttpServer(m_port).AddXmlRPCHandler("logoff_user", LogOffUser, false); } protected void AddScene(Scene scene) diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 21033b3809..7da4893b62 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -42,8 +42,10 @@ namespace OpenSim.Framework set { instance = value; } } - public IHttpServer GetHttpServer(uint port) + public static IHttpServer GetHttpServer(uint port) { + if (port == 0) + return Instance; if (port == Instance.Port) return Instance; diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 3bc9b6ccdb..6da0f1e8a1 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -32,3 +32,7 @@ ;Include-CenomeCache = "config-include/CenomeCache.ini" ;AssetCaching = "GlynnTuckerAssetCache" + + ;; Optionally, the port for the LLProxyLoginModule module can be changed + + ;Setup_LLProxyLoginModule = "9090/"