From 6993a26ba599ae38dc6f66332980657d5621987a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 15 Jun 2012 00:40:12 +0100
Subject: Get rid of some unnecessary null checks in
RegionApplicationBase.StartupSpecific() - a constructor can never return
null.
Also adds some method doc to MainServer
---
OpenSim/Framework/Servers/MainServer.cs | 31 +++++++++++++++++++---
.../Region/ClientStack/RegionApplicationBase.cs | 14 ++++------
2 files changed, 32 insertions(+), 13 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index b8ab8d9..ea972ef 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -47,20 +47,43 @@ namespace OpenSim.Framework.Servers
set { instance = value; }
}
- public static IHttpServer GetHttpServer(uint port)
+ ///
+ /// Add an already started HTTP server to the collection of known servers.
+ ///
+ ///
+ public static void AddHttpServer(BaseHttpServer server)
{
- return GetHttpServer(port,null);
+ m_Servers.Add(server.Port, server);
}
- public static void AddHttpServer(BaseHttpServer server)
+ ///
+ /// Get the default http server or an http server for a specific port.
+ ///
+ ///
+ /// If the requested HTTP server doesn't already exist then a new one is instantiated and started.
+ ///
+ ///
+ /// If 0 then the default HTTP server is returned.
+ public static IHttpServer GetHttpServer(uint port)
{
- m_Servers.Add(server.Port, server);
+ return GetHttpServer(port, null);
}
+ ///
+ /// Get the default http server, an http server for a specific port
+ /// and/or an http server bound to a specific address
+ ///
+ ///
+ /// If the requested HTTP server doesn't already exist then a new one is instantiated and started.
+ ///
+ ///
+ /// If 0 then the default HTTP server is returned.
+ /// A specific IP address to bind to. If null then the default IP address is used.
public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr)
{
if (port == 0)
return Instance;
+
if (instance != null && port == Instance.Port)
return Instance;
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 6e78d6d..27a5879 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -99,17 +99,13 @@ namespace OpenSim.Region.ClientStack
// "OOB" Server
if (m_networkServersInfo.ssl_listener)
{
- BaseHttpServer server = null;
- server = new BaseHttpServer(
+ BaseHttpServer server = new BaseHttpServer(
m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
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);
- server.Start();
- }
+
+ m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
+ MainServer.AddHttpServer(server);
+ server.Start();
}
base.StartupSpecific();
--
cgit v1.1