diff options
Diffstat (limited to 'src/zenserver/main.cpp')
| -rw-r--r-- | src/zenserver/main.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp index b0d945814..6d9a478be 100644 --- a/src/zenserver/main.cpp +++ b/src/zenserver/main.cpp @@ -117,6 +117,14 @@ ZenEntryPoint::Run() ServerState.Initialize(); ServerState.Sweep(); + auto NotifyReady = [&] { + if (!m_ServerOptions.ChildId.empty()) + { + NamedEvent ParentEvent{m_ServerOptions.ChildId}; + ParentEvent.Set(); + } + }; + uint32_t AttachSponsorProcessRetriesLeft = 3; ZenServerState::ZenServerEntry* Entry = ServerState.Lookup(m_ServerOptions.BasePort); while (Entry) @@ -155,6 +163,7 @@ ZenEntryPoint::Run() // Sponsor processes are checked every second, so 2 second wait time should be enough if (Entry->AddSponsorProcess(m_ServerOptions.OwnerPid, 2000)) { + NotifyReady(); std::exit(0); } if (AttachSponsorProcessRetriesLeft-- > 0) @@ -294,12 +303,7 @@ ZenEntryPoint::Run() Server.SetIsReadyFunc([&] { m_LockFile.Update(MakeLockData(true), Ec); - - if (!m_ServerOptions.ChildId.empty()) - { - NamedEvent ParentEvent{m_ServerOptions.ChildId}; - ParentEvent.Set(); - } + NotifyReady(); }); Server.Run(); |