From 55acb20f6db06452b8e363f0cb86ff609b1bb3a6 Mon Sep 17 00:00:00 2001 From: DDuarte Date: Sat, 15 Aug 2015 12:36:00 +0100 Subject: Core/Bnetserver: Catch and log an exception that happens when WorldserverListenPort is already used Closes #15284 --- src/server/bnetserver/Realms/WorldListener.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/server') diff --git a/src/server/bnetserver/Realms/WorldListener.cpp b/src/server/bnetserver/Realms/WorldListener.cpp index bcfc5d685c1..d6a12453644 100644 --- a/src/server/bnetserver/Realms/WorldListener.cpp +++ b/src/server/bnetserver/Realms/WorldListener.cpp @@ -63,9 +63,18 @@ void WorldListener::Run() void WorldListener::HandleOpen() { - _worldSocket->bind(std::string("tcp://*:") + std::to_string(_worldListenPort)); + try + { + _worldSocket->bind(std::string("tcp://*:") + std::to_string(_worldListenPort)); + } + catch (zmqpp::zmq_internal_exception& ex) + { + TC_LOG_FATAL("server.ipc", "Could not bind to WorldserverListenPort %u. Exception: %s. Shutting down bnetserver.", _worldListenPort, ex.what()); + abort(); + } + _poller->add(*_worldSocket); - TC_LOG_INFO("server.ipc", "Listening on connections from worldservers..."); + TC_LOG_INFO("server.ipc", "Listening on connections from worldservers on port %u...", _worldListenPort); } void WorldListener::HandleClose() -- cgit v1.2.3