aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--zenserver/zenserver.cpp12
2 files changed, 9 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d9461b3f..ebde92b4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -126,6 +126,7 @@
- `--clean` Delete and create a new oplog before starting import
- Improvement: Faster oplog replay - reduces time to open an existing oplog
- Improvement: Clearer error messages and logging when requests to project store fails
+- Changed: Exit with failure code on port conflict rather than reporting crash to Sentry
- Changed: Removed remnants of old mesh experiment
- Changed: Remove obsolete export-project command
- Changed: Removed remnants import-project command
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);