diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 7da4893b62..84cc05eb74 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -32,7 +32,7 @@ namespace OpenSim.Framework { public class MainServer { - private static BaseHttpServer instance; + private static BaseHttpServer instance = null; private static Dictionary m_Servers = new Dictionary(); @@ -46,7 +46,7 @@ namespace OpenSim.Framework { if (port == 0) return Instance; - if (port == Instance.Port) + if (instance != null && port == Instance.Port) return Instance; if (m_Servers.ContainsKey(port)) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index c9f2cfaee1..cfa94eaae5 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -53,6 +53,7 @@ namespace OpenSim protected string m_shutdownCommandsFile; protected bool m_gui = false; protected string m_consoleType = "local"; + protected uint m_consolePort = 0; private string m_timedScript = "disabled"; private Timer m_scriptTimer; @@ -79,6 +80,7 @@ namespace OpenSim else m_consoleType= startupConfig.GetString("console", String.Empty); + m_consolePort = (uint)startupConfig.GetInt("console_port", 0); m_timedScript = startupConfig.GetString("timer_Script", "disabled"); if (m_logFileAppender != null) { @@ -151,7 +153,16 @@ namespace OpenSim base.StartupSpecific(); if (m_console is RemoteConsole) - ((RemoteConsole)m_console).SetServer(m_httpServer); + { + if (m_consolePort == 0) + { + ((RemoteConsole)m_console).SetServer(m_httpServer); + } + else + { + ((RemoteConsole)m_console).SetServer(MainServer.GetHttpServer(m_consolePort)); + } + } //Run Startup Commands if (String.IsNullOrEmpty(m_startupCommandsFile)) diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index ed0210f190..77184a498a 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -49,6 +49,7 @@ namespace OpenSim.Server.Base protected uint m_Port = 0; protected Dictionary m_Servers = new Dictionary(); + protected uint m_consolePort = 0; public IHttpServer HttpServer { @@ -98,6 +99,7 @@ namespace OpenSim.Server.Base Thread.CurrentThread.Abort(); } + m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); m_Port = port; m_HttpServer = new BaseHttpServer(port); @@ -111,7 +113,10 @@ namespace OpenSim.Server.Base if (MainConsole.Instance is RemoteConsole) { - ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); + if (m_consolePort == 0) + ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); + else + ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort)); } } } diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index f3d222f446..12af0cd2c4 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example @@ -22,6 +22,7 @@ port = 8003 ; * Leave commented to diable logins to the console ;ConsoleUser = Test ;ConsolePass = secret +;ConsolePort = 0 ; * As an example, the below configuration precisely mimicks the legacy ; * asset server. It is read by the asset IN connector (defined above) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 43e1d50676..fa2a4a1ebd 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -326,6 +326,7 @@ ConsoleUser = "Test" ConsolePass = "secret" http_listener_port = 9000 + console_port = 0 default_location_x = 1000 default_location_y = 1000