diff options
| author | Dan Engelbrecht <[email protected]> | 2023-02-13 11:40:54 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-13 03:40:54 -0800 |
| commit | f5e5724b6e7c0457e631cee04034101eb40eb477 (patch) | |
| tree | caa27f412a163a3acb238097cdb3bfd9f278becf /zenserver/zenserver.cpp | |
| parent | FileCas (#226) (diff) | |
| download | zen-f5e5724b6e7c0457e631cee04034101eb40eb477.tar.xz zen-f5e5724b6e7c0457e631cee04034101eb40eb477.zip | |
no sentry report on port conflict (#228)
* Exit with failure code on port conflict rather than reporting crash to Sentry
* changelog
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); |