diff options
Diffstat (limited to 'src/zenserver/zenserver.cpp')
| -rw-r--r-- | src/zenserver/zenserver.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp index 9f24960bd..48ea89204 100644 --- a/src/zenserver/zenserver.cpp +++ b/src/zenserver/zenserver.cpp @@ -8,6 +8,7 @@ #include <zencore/compactbinarybuilder.h> #include <zencore/compactbinaryvalidation.h> #include <zencore/config.h> +#include <zencore/except.h> #include <zencore/filesystem.h> #include <zencore/fmtutils.h> #include <zencore/iobuffer.h> @@ -148,9 +149,13 @@ ZenServer::Initialize(const ZenServerOptions& ServerOptions, ZenServerState::Zen std::string MutexName = fmt::format("zen_{}", ServerOptions.BasePort); - if (NamedMutex::Exists(MutexName) || ((m_ServerMutex.Create(MutexName) == false))) + if (NamedMutex::Exists(MutexName)) { - throw std::runtime_error(fmt::format("Failed to create mutex '{}' - is another instance already running?", MutexName).c_str()); + throw std::runtime_error(fmt::format("Mutex '{}' already exists - is another instance already running?", MutexName).c_str()); + } + if (m_ServerMutex.Create(MutexName) == false) + { + ThrowLastError(fmt::format("Failed to create mutex '{}'", MutexName).c_str()); } InitializeState(ServerOptions); |