diff options
| author | Dan Engelbrecht <[email protected]> | 2024-04-25 12:57:10 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-04-25 12:57:10 +0200 |
| commit | 3f266e0005bedabaa9f814d13246a91518050e97 (patch) | |
| tree | bd9efc8202f6ff40c6b17d63f2cea633df039887 /src/zenutil/include | |
| parent | iterate cas chunks (#59) (diff) | |
| download | zen-3f266e0005bedabaa9f814d13246a91518050e97.tar.xz zen-3f266e0005bedabaa9f814d13246a91518050e97.zip | |
zenserverprocess hardening (#61)
* verify running process before creating event
* make sure we don't signal/wait for a zenserver instance that we did not wait for to get ready
Diffstat (limited to 'src/zenutil/include')
| -rw-r--r-- | src/zenutil/include/zenutil/zenserverprocess.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/zenutil/include/zenutil/zenserverprocess.h b/src/zenutil/include/zenutil/zenserverprocess.h index f7204fb43..8aa4a2773 100644 --- a/src/zenutil/include/zenutil/zenserverprocess.h +++ b/src/zenutil/include/zenutil/zenserverprocess.h @@ -67,7 +67,7 @@ struct ZenServerInstance ~ZenServerInstance(); int Shutdown(); - void SignalShutdown(); + bool SignalShutdown(); uint16_t WaitUntilReady(); [[nodiscard]] bool WaitUntilReady(int Timeout); void EnableTermination() { m_Terminate = true; } @@ -107,17 +107,17 @@ struct ZenServerInstance uint16_t GetBasePort() const { return m_BasePort; } private: - ZenServerEnvironment& m_Env; - ProcessHandle m_Process; - NamedEvent m_ReadyEvent; - NamedEvent m_ShutdownEvent; - bool m_Terminate = false; - bool m_ShutdownOnDestroy = true; - std::filesystem::path m_TestDir; - uint16_t m_BasePort = 0; - std::optional<int> m_OwnerPid; - std::string m_Name; - std::filesystem::path m_OutputCapturePath; + ZenServerEnvironment& m_Env; + ProcessHandle m_Process; + NamedEvent m_ReadyEvent; + std::unique_ptr<NamedEvent> m_ShutdownEvent; + bool m_Terminate = false; + bool m_ShutdownOnDestroy = true; + std::filesystem::path m_TestDir; + uint16_t m_BasePort = 0; + std::optional<int> m_OwnerPid; + std::string m_Name; + std::filesystem::path m_OutputCapturePath; void CreateShutdownEvent(int BasePort); void SpawnServer(int BasePort, std::string_view AdditionalServerArgs, int WaitTimeoutMs); |