aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/MainServer.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/MainServer.cs41
1 files changed, 30 insertions, 11 deletions
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
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39 39
40 private static BaseHttpServer instance = null; 40 private static BaseHttpServer instance = null;
41 private static Dictionary<uint, BaseHttpServer> m_Servers = 41 private static Dictionary<uint, BaseHttpServer> m_Servers = new Dictionary<uint, BaseHttpServer>();
42 new Dictionary<uint, BaseHttpServer>(); 42
43 public static int DebugLevel
44 {
45 get { return s_debugLevel; }
46 set
47 {
48 s_debugLevel = value;
49 Instance.DebugLevel = s_debugLevel;
50
51 lock (m_Servers)
52 foreach (BaseHttpServer server in m_Servers.Values)
53 server.DebugLevel = s_debugLevel;
54 }
55 }
56
57 private static int s_debugLevel;
43 58
44 public static BaseHttpServer Instance 59 public static BaseHttpServer Instance
45 { 60 {
@@ -53,7 +68,8 @@ namespace OpenSim.Framework.Servers
53 /// <param name='server'></param> 68 /// <param name='server'></param>
54 public static void AddHttpServer(BaseHttpServer server) 69 public static void AddHttpServer(BaseHttpServer server)
55 { 70 {
56 m_Servers.Add(server.Port, server); 71 lock (m_Servers)
72 m_Servers.Add(server.Port, server);
57 } 73 }
58 74
59 /// <summary> 75 /// <summary>
@@ -87,18 +103,21 @@ namespace OpenSim.Framework.Servers
87 if (instance != null && port == Instance.Port) 103 if (instance != null && port == Instance.Port)
88 return Instance; 104 return Instance;
89 105
90 if (m_Servers.ContainsKey(port)) 106 lock (m_Servers)
91 return m_Servers[port]; 107 {
108 if (m_Servers.ContainsKey(port))
109 return m_Servers[port];
92 110
93 m_Servers[port] = new BaseHttpServer(port); 111 m_Servers[port] = new BaseHttpServer(port);
94 112
95 if (ipaddr != null) 113 if (ipaddr != null)
96 m_Servers[port].ListenIPAddress = ipaddr; 114 m_Servers[port].ListenIPAddress = ipaddr;
97 115
98 m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port); 116 m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port);
99 m_Servers[port].Start(); 117 m_Servers[port].Start();
118 }
100 119
101 return m_Servers[port]; 120 return m_Servers[port];
102 } 121 }
103 } 122 }
104} 123} \ No newline at end of file