summaryrefslogtreecommitdiffstats
path: root/Source/cmServer.h
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-09-09 08:01:44 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-22 12:06:38 (GMT)
commit1d601c6cb978a3b6b6143fdf64e284fb3a098d1e (patch)
tree1f274c04ba934cbc06cff9b8f9d33b7defbc7212 /Source/cmServer.h
parent2c2ffd3874f749979d723d7a788d45e3830952d6 (diff)
downloadCMake-1d601c6cb978a3b6b6143fdf64e284fb3a098d1e.zip
CMake-1d601c6cb978a3b6b6143fdf64e284fb3a098d1e.tar.gz
CMake-1d601c6cb978a3b6b6143fdf64e284fb3a098d1e.tar.bz2
server-mode: Introduce cmServerConnection
Use it to split pipe and stdin/out handling out of cmServer itself. The server will shut down when it looses its connection to the client. This has the nice property that a crashing client will cause the server to terminate as the OS will close the connection on behave of the client.
Diffstat (limited to 'Source/cmServer.h')
-rw-r--r--Source/cmServer.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/Source/cmServer.h b/Source/cmServer.h
index 38a11bb..dde5333 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -24,6 +24,7 @@
#include <string>
#include <vector>
+class cmServerConnection;
class cmServerProtocol;
class cmServerRequest;
class cmServerResponse;
@@ -33,18 +34,18 @@ class cmServer
public:
class DebugInfo;
- cmServer(bool supportExperimental);
+ cmServer(cmServerConnection* conn, bool supportExperimental);
~cmServer();
- bool Serve();
-
- // for callbacks:
- void PopOne();
- void handleData(std::string const& data);
+ bool Serve(std::string* errorMessage);
private:
void RegisterProtocol(cmServerProtocol* protocol);
+ // Callbacks from cmServerConnection:
+ void PopOne();
+ void QueueRequest(const std::string& request);
+
static void reportProgress(const char* msg, float progress, void* data);
static void reportMessage(const char* msg, const char* title, bool& cancel,
void* data);
@@ -69,6 +70,7 @@ private:
static cmServerProtocol* FindMatchingProtocol(
const std::vector<cmServerProtocol*>& protocols, int major, int minor);
+ cmServerConnection* Connection = nullptr;
const bool SupportExperimental;
cmServerProtocol* Protocol = nullptr;
@@ -94,4 +96,5 @@ private:
mutable bool Writing = false;
friend class cmServerRequest;
+ friend class cmServerConnection;
};