From 9bc303d2937ab2f62e146f7fdde6444ed8cb50c9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 20 Oct 2009 16:57:22 +0100 Subject: Add MainServer.GetHttpServer(port) method for using multiple listener ports in region modules --- OpenSim/Framework/MainServer.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Framework/MainServer.cs') diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index b5f947e..21033b3 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -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 m_Servers = + new Dictionary(); 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]; + } } } -- cgit v1.1