Add MainServer.GetHttpServer(port) method for using multiple listener

ports in region modules
prioritization
Melanie 2009-10-20 16:57:22 +01:00
parent 26863c04a5
commit 9bc303d293
1 changed files with 17 additions and 0 deletions

View File

@ -26,17 +26,34 @@
*/
using OpenSim.Framework.Servers.HttpServer;
using System.Collections.Generic;
namespace OpenSim.Framework
{
public class MainServer
{
private static BaseHttpServer instance;
private static Dictionary<uint, BaseHttpServer> m_Servers =
new Dictionary<uint, BaseHttpServer>();
public static BaseHttpServer Instance
{
get { return instance; }
set { instance = value; }
}
public IHttpServer GetHttpServer(uint port)
{
if (port == Instance.Port)
return Instance;
if (m_Servers.ContainsKey(port))
return m_Servers[port];
m_Servers[port] = new BaseHttpServer(port);
m_Servers[port].Start();
return m_Servers[port];
}
}
}