aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/MainServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/MainServer.cs')
-rw-r--r--OpenSim/Framework/Servers/MainServer.cs60
1 files changed, 56 insertions, 4 deletions
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index becbbc2..07ff60c 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -30,13 +30,15 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Net; 31using System.Net;
32using log4net; 32using log4net;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
33using OpenSim.Framework.Servers.HttpServer; 35using OpenSim.Framework.Servers.HttpServer;
34 36
35namespace OpenSim.Framework.Servers 37namespace OpenSim.Framework.Servers
36{ 38{
37 public class MainServer 39 public class MainServer
38 { 40 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 42
41 private static BaseHttpServer instance = null; 43 private static BaseHttpServer instance = null;
42 private static Dictionary<uint, BaseHttpServer> m_Servers = new Dictionary<uint, BaseHttpServer>(); 44 private static Dictionary<uint, BaseHttpServer> m_Servers = new Dictionary<uint, BaseHttpServer>();
@@ -88,6 +90,57 @@ namespace OpenSim.Framework.Servers
88 } 90 }
89 91
90 /// <summary> 92 /// <summary>
93 /// Get all the registered servers.
94 /// </summary>
95 /// <remarks>
96 /// Returns a copy of the dictionary so this can be iterated through without locking.
97 /// </remarks>
98 /// <value></value>
99 public static Dictionary<uint, BaseHttpServer> Servers
100 {
101 get { return new Dictionary<uint, BaseHttpServer>(m_Servers); }
102 }
103
104
105 public static void RegisterHttpConsoleCommands(ICommandConsole console)
106 {
107 console.Commands.AddCommand(
108 "Comms", false, "debug http", "debug http [<level>]",
109 "Turn on inbound non-poll http request debugging.",
110 "If level <= 0, then no extra logging is done.\n"
111 + "If level >= 1, then short warnings are logged when receiving bad input data.\n"
112 + "If level >= 2, then long warnings are logged when receiving bad input data.\n"
113 + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n"
114 + "If no level is specified then the current level is returned.",
115 HandleDebugHttpCommand);
116 }
117
118 /// <summary>
119 /// Turn on some debugging values for OpenSim.
120 /// </summary>
121 /// <param name="args"></param>
122 private static void HandleDebugHttpCommand(string module, string[] args)
123 {
124 if (args.Length == 3)
125 {
126 int newDebug;
127 if (int.TryParse(args[2], out newDebug))
128 {
129 MainServer.DebugLevel = newDebug;
130 MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug);
131 }
132 }
133 else if (args.Length == 2)
134 {
135 MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel);
136 }
137 else
138 {
139 MainConsole.Instance.Output("Usage: debug http 0..3");
140 }
141 }
142
143 /// <summary>
91 /// Register an already started HTTP server to the collection of known servers. 144 /// Register an already started HTTP server to the collection of known servers.
92 /// </summary> 145 /// </summary>
93 /// <param name='server'></param> 146 /// <param name='server'></param>
@@ -171,11 +224,10 @@ namespace OpenSim.Framework.Servers
171 if (ipaddr != null) 224 if (ipaddr != null)
172 m_Servers[port].ListenIPAddress = ipaddr; 225 m_Servers[port].ListenIPAddress = ipaddr;
173 226
174 m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port);
175 m_Servers[port].Start(); 227 m_Servers[port].Start();
176 }
177 228
178 return m_Servers[port]; 229 return m_Servers[port];
230 }
179 } 231 }
180 } 232 }
181} \ No newline at end of file 233} \ No newline at end of file