aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-04-25 12:57:10 +0200
committerGitHub Enterprise <[email protected]>2024-04-25 12:57:10 +0200
commit3f266e0005bedabaa9f814d13246a91518050e97 (patch)
treebd9efc8202f6ff40c6b17d63f2cea633df039887 /src/zenutil/include
parentiterate cas chunks (#59) (diff)
downloadzen-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.h24
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);