diff options
Diffstat (limited to 'OpenSim/Server/Base/HttpServerBase.cs')
-rw-r--r-- | OpenSim/Server/Base/HttpServerBase.cs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 791e1ef..ed0210f 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Threading; | 30 | using System.Threading; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -40,17 +41,40 @@ namespace OpenSim.Server.Base | |||
40 | { | 41 | { |
41 | // Logger | 42 | // Logger |
42 | // | 43 | // |
43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 45 | ||
45 | // The http server instance | 46 | // The http server instance |
46 | // | 47 | // |
47 | protected BaseHttpServer m_HttpServer = null; | 48 | protected BaseHttpServer m_HttpServer = null; |
49 | protected uint m_Port = 0; | ||
50 | protected Dictionary<uint, BaseHttpServer> m_Servers = | ||
51 | new Dictionary<uint, BaseHttpServer>(); | ||
48 | 52 | ||
49 | public IHttpServer HttpServer | 53 | public IHttpServer HttpServer |
50 | { | 54 | { |
51 | get { return m_HttpServer; } | 55 | get { return m_HttpServer; } |
52 | } | 56 | } |
53 | 57 | ||
58 | public uint DefaultPort | ||
59 | { | ||
60 | get { return m_Port; } | ||
61 | } | ||
62 | |||
63 | public IHttpServer GetHttpServer(uint port) | ||
64 | { | ||
65 | m_Log.InfoFormat("[SERVER]: Requested port {0}", port); | ||
66 | if (port == m_Port) | ||
67 | return HttpServer; | ||
68 | |||
69 | if (m_Servers.ContainsKey(port)) | ||
70 | return m_Servers[port]; | ||
71 | |||
72 | m_Servers[port] = new BaseHttpServer(port); | ||
73 | m_Servers[port].Start(); | ||
74 | |||
75 | return m_Servers[port]; | ||
76 | } | ||
77 | |||
54 | // Handle all the automagical stuff | 78 | // Handle all the automagical stuff |
55 | // | 79 | // |
56 | public HttpServerBase(string prompt, string[] args) : base(prompt, args) | 80 | public HttpServerBase(string prompt, string[] args) : base(prompt, args) |
@@ -74,6 +98,8 @@ namespace OpenSim.Server.Base | |||
74 | Thread.CurrentThread.Abort(); | 98 | Thread.CurrentThread.Abort(); |
75 | } | 99 | } |
76 | 100 | ||
101 | m_Port = port; | ||
102 | |||
77 | m_HttpServer = new BaseHttpServer(port); | 103 | m_HttpServer = new BaseHttpServer(port); |
78 | 104 | ||
79 | MainServer.Instance = m_HttpServer; | 105 | MainServer.Instance = m_HttpServer; |