server-mode: Pass server into cmServerProtocol
The information will be needed to send signals.
This commit is contained in:
parent
277ffa2881
commit
cc576c2c7f
|
@ -220,7 +220,7 @@ cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
if (!this->Protocol->Activate(request, &errorMessage)) {
|
if (!this->Protocol->Activate(this, request, &errorMessage)) {
|
||||||
this->Protocol = CM_NULLPTR;
|
this->Protocol = CM_NULLPTR;
|
||||||
return request.ReportError("Failed to activate protocol version: " +
|
return request.ReportError("Failed to activate protocol version: " +
|
||||||
errorMessage);
|
errorMessage);
|
||||||
|
|
|
@ -95,6 +95,7 @@ private:
|
||||||
|
|
||||||
mutable bool Writing = false;
|
mutable bool Writing = false;
|
||||||
|
|
||||||
friend class cmServerRequest;
|
|
||||||
friend class cmServerConnection;
|
friend class cmServerConnection;
|
||||||
|
friend class cmServerProtocol;
|
||||||
|
friend class cmServerRequest;
|
||||||
};
|
};
|
||||||
|
|
|
@ -109,9 +109,12 @@ Json::Value cmServerResponse::Data() const
|
||||||
return this->m_Data;
|
return this->m_Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmServerProtocol::Activate(const cmServerRequest& request,
|
bool cmServerProtocol::Activate(cmServer* server,
|
||||||
|
const cmServerRequest& request,
|
||||||
std::string* errorMessage)
|
std::string* errorMessage)
|
||||||
{
|
{
|
||||||
|
assert(server);
|
||||||
|
this->m_Server = server;
|
||||||
this->m_CMakeInstance = std::make_unique<cmake>();
|
this->m_CMakeInstance = std::make_unique<cmake>();
|
||||||
const bool result = this->DoActivate(request, errorMessage);
|
const bool result = this->DoActivate(request, errorMessage);
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
|
@ -87,7 +87,8 @@ public:
|
||||||
virtual bool IsExperimental() const = 0;
|
virtual bool IsExperimental() const = 0;
|
||||||
virtual const cmServerResponse Process(const cmServerRequest& request) = 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:
|
protected:
|
||||||
cmake* CMakeInstance() const;
|
cmake* CMakeInstance() const;
|
||||||
|
@ -97,6 +98,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<cmake> m_CMakeInstance;
|
std::unique_ptr<cmake> m_CMakeInstance;
|
||||||
|
cmServer* m_Server = nullptr; // not owned!
|
||||||
|
|
||||||
friend class cmServer;
|
friend class cmServer;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue