summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-09-09 10:50:23 (GMT)
committerTobias Hunger <tobias.hunger@qt.io>2016-09-22 14:30:02 (GMT)
commitcc576c2c7f3272ec5370dc3cb45838c20d1837f9 (patch)
tree602548f309c03bb384d81d254271fd6a01b15516 /Source
parent277ffa2881d4073a660490f959cb58ad0dcb3f82 (diff)
downloadCMake-cc576c2c7f3272ec5370dc3cb45838c20d1837f9.zip
CMake-cc576c2c7f3272ec5370dc3cb45838c20d1837f9.tar.gz
CMake-cc576c2c7f3272ec5370dc3cb45838c20d1837f9.tar.bz2
server-mode: Pass server into cmServerProtocol
The information will be needed to send signals.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmServer.cxx2
-rw-r--r--Source/cmServer.h3
-rw-r--r--Source/cmServerProtocol.cxx5
-rw-r--r--Source/cmServerProtocol.h4
4 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index b0675da..f7e5e3b 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -220,7 +220,7 @@ cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request)
}
std::string errorMessage;
- if (!this->Protocol->Activate(request, &errorMessage)) {
+ if (!this->Protocol->Activate(this, request, &errorMessage)) {
this->Protocol = CM_NULLPTR;
return request.ReportError("Failed to activate protocol version: " +
errorMessage);
diff --git a/Source/cmServer.h b/Source/cmServer.h
index dde5333..433b2ac 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -95,6 +95,7 @@ private:
mutable bool Writing = false;
- friend class cmServerRequest;
friend class cmServerConnection;
+ friend class cmServerProtocol;
+ friend class cmServerRequest;
};
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 030b0fd..16a6374 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -109,9 +109,12 @@ Json::Value cmServerResponse::Data() const
return this->m_Data;
}
-bool cmServerProtocol::Activate(const cmServerRequest& request,
+bool cmServerProtocol::Activate(cmServer* server,
+ const cmServerRequest& request,
std::string* errorMessage)
{
+ assert(server);
+ this->m_Server = server;
this->m_CMakeInstance = std::make_unique<cmake>();
const bool result = this->DoActivate(request, errorMessage);
if (!result)
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index bab949b..92c8162 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -87,7 +87,8 @@ public:
virtual bool IsExperimental() const = 0;
virtual const cmServerResponse Process(const cmServerRequest& request) = 0;
- bool Activate(const cmServerRequest& request, std::string* errorMessage);
+ bool Activate(cmServer* server, const cmServerRequest& request,
+ std::string* errorMessage);
protected:
cmake* CMakeInstance() const;
@@ -97,6 +98,7 @@ protected:
private:
std::unique_ptr<cmake> m_CMakeInstance;
+ cmServer* m_Server = nullptr; // not owned!
friend class cmServer;
};