diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2016-10-04 11:28:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-10-04 13:15:32 (GMT) |
commit | 68277e16c474ca48e4aabd36603fd9ec4466fe28 (patch) | |
tree | 6896dcfd4a2dfa6e996589535f9b65346b3b0f14 /Source/cmServerConnection.h | |
parent | b99bbfe88d1bb02dc903507f3e1bbe716ac04c12 (diff) | |
download | CMake-68277e16c474ca48e4aabd36603fd9ec4466fe28.zip CMake-68277e16c474ca48e4aabd36603fd9ec4466fe28.tar.gz CMake-68277e16c474ca48e4aabd36603fd9ec4466fe28.tar.bz2 |
server-mode: Improve shutdown behavior
Add a signal handler to trigger shutdown and be more paranoid about
libuv doing things asynchronously. This should fix test cases not
shutting down properly.
Diffstat (limited to 'Source/cmServerConnection.h')
-rw-r--r-- | Source/cmServerConnection.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/cmServerConnection.h b/Source/cmServerConnection.h index 78842e7..3efe28d 100644 --- a/Source/cmServerConnection.h +++ b/Source/cmServerConnection.h @@ -24,7 +24,7 @@ public: bool ProcessEvents(std::string* errorMessage); void ReadData(const std::string& data); - void HandleEof(); + void TriggerShutdown(); void WriteData(const std::string& data); void ProcessNextRequest(); @@ -51,6 +51,8 @@ private: uv_loop_t* mLoop = nullptr; cmFileMonitor* mFileMonitor = nullptr; cmServer* Server = nullptr; + uv_signal_t* SIGINTHandler = nullptr; + uv_signal_t* SIGHUPHandler = nullptr; friend class LoopGuard; }; @@ -58,6 +60,7 @@ private: class cmServerStdIoConnection : public cmServerConnection { public: + cmServerStdIoConnection(); bool DoSetup(std::string* errorMessage) override; void TearDown() override; @@ -65,10 +68,12 @@ public: private: typedef union { - uv_tty_t tty; - uv_pipe_t pipe; + uv_tty_t* tty; + uv_pipe_t* pipe; } InOutUnion; + bool usesTty = false; + InOutUnion Input; InOutUnion Output; }; @@ -85,6 +90,6 @@ public: private: const std::string PipeName; - uv_pipe_t ServerPipe; - uv_pipe_t ClientPipe; + uv_pipe_t* ServerPipe = nullptr; + uv_pipe_t* ClientPipe = nullptr; }; |