From 618314985d6a632ccfd2001d969d32a5ee6e4ca1 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 11 Mar 2012 20:45:43 +0200 Subject: Proper handling of failing to bind server socket --- src/server.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index 767de035f..63bf794ab 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -109,6 +109,10 @@ void * ServerThread::Thread() { infostream<<"Server: PeerNotFoundException"<setAsyncFatalError(e.what()); + } } END_DEBUG_EXCEPTION_HANDLER(errorstream) @@ -837,6 +841,7 @@ Server::Server( m_path_world(path_world), m_path_config(path_config), m_gamespec(gamespec), + m_async_fatal_error(""), m_env(NULL), m_con(PROTOCOL_ID, 512, CONNECTION_TIMEOUT, this), m_authmanager(path_world+DIR_DELIM+"auth.txt"), @@ -865,6 +870,9 @@ Server::Server( m_step_dtime_mutex.Init(); m_step_dtime = 0.0; + if(path_world == "") + throw ServerError("Supplied empty world path"); + if(!gamespec.isValid()) throw ServerError("Supplied invalid gamespec"); @@ -1079,6 +1087,8 @@ Server::~Server() void Server::start(unsigned short port) { DSTACK(__FUNCTION_NAME); + infostream<<"Starting server on port "<