From 478acfff34b94c7c42bdb927be531b669c43af72 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Jun 2012 01:24:36 +0100 Subject: When setting debug http level, do this for all known http servers, not just the main instance. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 20 +++++------ OpenSim/Framework/Servers/MainServer.cs | 41 ++++++++++++++++------ 2 files changed, 40 insertions(+), 21 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 35a0be4..6b52485 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -53,6 +53,16 @@ namespace OpenSim.Framework.Servers.HttpServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); + /// + /// Control the printing of certain debug messages. + /// + /// + /// If DebugLevel >= 1, then short warnings are logged when receiving bad input data. + /// If DebugLevel >= 2, then long warnings are logged when receiving bad input data. + /// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged. + /// + public int DebugLevel { get; set; } + private volatile int NotSocketErrors = 0; public volatile bool HTTPDRunning = false; @@ -79,16 +89,6 @@ namespace OpenSim.Framework.Servers.HttpServer private PollServiceRequestManager m_PollServiceManager; - /// - /// Control the printing of certain debug messages. - /// - /// - /// If DebugLevel >= 1, then short warnings are logged when receiving bad input data. - /// If DebugLevel >= 2, then long warnings are logged when receiving bad input data. - /// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged. - /// - public int DebugLevel { get; set; } - public uint SSLPort { get { return m_sslport; } diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index ea972ef..efac6e1 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -38,8 +38,23 @@ namespace OpenSim.Framework.Servers private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static BaseHttpServer instance = null; - private static Dictionary m_Servers = - new Dictionary(); + private static Dictionary m_Servers = new Dictionary(); + + public static int DebugLevel + { + get { return s_debugLevel; } + set + { + s_debugLevel = value; + Instance.DebugLevel = s_debugLevel; + + lock (m_Servers) + foreach (BaseHttpServer server in m_Servers.Values) + server.DebugLevel = s_debugLevel; + } + } + + private static int s_debugLevel; public static BaseHttpServer Instance { @@ -53,7 +68,8 @@ namespace OpenSim.Framework.Servers /// public static void AddHttpServer(BaseHttpServer server) { - m_Servers.Add(server.Port, server); + lock (m_Servers) + m_Servers.Add(server.Port, server); } /// @@ -87,18 +103,21 @@ namespace OpenSim.Framework.Servers if (instance != null && port == Instance.Port) return Instance; - if (m_Servers.ContainsKey(port)) - return m_Servers[port]; + lock (m_Servers) + { + if (m_Servers.ContainsKey(port)) + return m_Servers[port]; - m_Servers[port] = new BaseHttpServer(port); + m_Servers[port] = new BaseHttpServer(port); - if (ipaddr != null) - m_Servers[port].ListenIPAddress = ipaddr; + if (ipaddr != null) + m_Servers[port].ListenIPAddress = ipaddr; - m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port); - m_Servers[port].Start(); + m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port); + m_Servers[port].Start(); + } return m_Servers[port]; } } -} +} \ No newline at end of file -- cgit v1.1