Get rid of some unnecessary null checks in RegionApplicationBase.StartupSpecific() - a constructor can never return null.

Also adds some method doc to MainServer
0.7.4.1
Justin Clark-Casey (justincc) 2012-06-15 00:40:12 +01:00
parent 93ba0332c4
commit 6993a26ba5
2 changed files with 33 additions and 14 deletions

View File

@ -47,20 +47,43 @@ namespace OpenSim.Framework.Servers
set { instance = value; } set { instance = value; }
} }
public static IHttpServer GetHttpServer(uint port) /// <summary>
{ /// Add an already started HTTP server to the collection of known servers.
return GetHttpServer(port,null); /// </summary>
} /// <param name='server'></param>
public static void AddHttpServer(BaseHttpServer server) public static void AddHttpServer(BaseHttpServer server)
{ {
m_Servers.Add(server.Port, server); m_Servers.Add(server.Port, server);
} }
/// <summary>
/// Get the default http server or an http server for a specific port.
/// </summary>
/// <remarks>
/// If the requested HTTP server doesn't already exist then a new one is instantiated and started.
/// </remarks>
/// <returns></returns>
/// <param name='port'>If 0 then the default HTTP server is returned.</param>
public static IHttpServer GetHttpServer(uint port)
{
return GetHttpServer(port, null);
}
/// <summary>
/// Get the default http server, an http server for a specific port
/// and/or an http server bound to a specific address
/// </summary>
/// <remarks>
/// If the requested HTTP server doesn't already exist then a new one is instantiated and started.
/// </remarks>
/// <returns></returns>
/// <param name='port'>If 0 then the default HTTP server is returned.</param>
/// <param name='ipaddr'>A specific IP address to bind to. If null then the default IP address is used.</param>
public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr)
{ {
if (port == 0) if (port == 0)
return Instance; return Instance;
if (instance != null && port == Instance.Port) if (instance != null && port == Instance.Port)
return Instance; return Instance;

View File

@ -99,17 +99,13 @@ namespace OpenSim.Region.ClientStack
// "OOB" Server // "OOB" Server
if (m_networkServersInfo.ssl_listener) if (m_networkServersInfo.ssl_listener)
{ {
BaseHttpServer server = null; BaseHttpServer server = new BaseHttpServer(
server = new BaseHttpServer(
m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
m_networkServersInfo.cert_pass); m_networkServersInfo.cert_pass);
// Add the server to m_Servers
if(server != null) m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
{ MainServer.AddHttpServer(server);
m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); server.Start();
MainServer.AddHttpServer(server);
server.Start();
}
} }
base.StartupSpecific(); base.StartupSpecific();