diff options
Diffstat (limited to 'zenserver/zenserver.cpp')
| -rw-r--r-- | zenserver/zenserver.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 9eae2761d..355df4523 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -969,16 +969,19 @@ ZenEntryPoint::Run() if (Entry) { - // Instance already running for this port? Should double check pid - - ZEN_WARN("Looks like there is already a process listening to this port (pid: {})", Entry->Pid); - if (ServerOptions.OwnerPid) { + ZEN_WARN("Looks like there is already a process listening to this port {} (pid: {})", ServerOptions.BasePort, Entry->Pid); + Entry->AddSponsorProcess(ServerOptions.OwnerPid); std::exit(0); } + else + { + ZEN_WARN("Exiting since there is already a process listening to port {} (pid: {})", ServerOptions.BasePort, Entry->Pid); + std::exit(1); + } } Entry = ServerState.Register(ServerOptions.BasePort); @@ -993,6 +996,7 @@ ZenEntryPoint::Run() Server.SetContentRoot(ServerOptions.ContentDir); Server.SetTestMode(ServerOptions.IsTest); Server.SetDedicatedMode(ServerOptions.IsDedicated); + int EffectiveBasePort = Server.Initialize(ServerOptions, Entry); Entry->EffectiveListenPort = uint16_t(EffectiveBasePort); |