If the port entry in [Network] for a server is missing, then actually tell the user that's the problem rather than simply exiting silently.

Also exit with Environment.Exit(), not by aborting the thread.
ghosts
Justin Clark-Casey (justincc) 2014-10-13 23:57:46 +01:00
parent 0437d44785
commit 2935e79ca3
1 changed files with 8 additions and 7 deletions

View File

@ -56,15 +56,16 @@ namespace OpenSim.Server.Base
if (networkConfig == null) if (networkConfig == null)
{ {
System.Console.WriteLine("Section 'Network' not found, server can't start"); System.Console.WriteLine("ERROR: Section [Network] not found, server can't start");
Thread.CurrentThread.Abort(); Environment.Exit(1);
} }
uint port = (uint)networkConfig.GetInt("port", 0); uint port = (uint)networkConfig.GetInt("port", 0);
if (port == 0) if (port == 0)
{ {
Thread.CurrentThread.Abort(); System.Console.WriteLine("ERROR: No 'port' entry found in [Network]. Server can't start");
Environment.Exit(1);
} }
bool ssl_main = networkConfig.GetBoolean("https_main",false); bool ssl_main = networkConfig.GetBoolean("https_main",false);
@ -93,13 +94,13 @@ namespace OpenSim.Server.Base
if ( cert_path == String.Empty ) if ( cert_path == String.Empty )
{ {
System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort(); Environment.Exit(1);
} }
string cert_pass = networkConfig.GetString("cert_pass",String.Empty); string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
if ( cert_pass == String.Empty ) if ( cert_pass == String.Empty )
{ {
System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort(); Environment.Exit(1);
} }
httpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass); httpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass);
@ -117,13 +118,13 @@ namespace OpenSim.Server.Base
if ( cert_path == String.Empty ) if ( cert_path == String.Empty )
{ {
System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort(); Environment.Exit(1);
} }
string cert_pass = networkConfig.GetString("cert_pass",String.Empty); string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
if ( cert_pass == String.Empty ) if ( cert_pass == String.Empty )
{ {
System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort(); Environment.Exit(1);
} }
MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));