diff options
author | Marco Bubke <marco.bubke@qt.io> | 2016-08-17 15:29:37 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2017-11-28 15:08:58 +0000 |
commit | f70bf3d2d16be3f4a7812bd0352da70fb7e0fa3b (patch) | |
tree | b22b54b5208093bed790f2b8b9d3728a7389b2f4 /src/plugins/clangpchmanager | |
parent | 45c667d52cffdd4bfd01f89e9794aef6f5f7298b (diff) |
Clang: Move QLocalServer in ConnectionClient
Before the QLocalServer was in the ConnectionServer so more than one
client could connect to the server. But we never used that possibility
which made the hand shaking much more difficult. It is now moved
in the client, so that there is always a QLocalServer.
Change-Id: Ifa357074b0c0809434c49d23b1cee38496f72f43
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/clangpchmanager')
-rw-r--r-- | src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp | 29 | ||||
-rw-r--r-- | src/plugins/clangpchmanager/pchmanagerconnectionclient.h | 5 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp b/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp index 9c4baa40c1b..bb41391645e 100644 --- a/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp +++ b/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp @@ -25,8 +25,9 @@ #include "pchmanagerconnectionclient.h" +#include <utils/temporarydirectory.h> + #include <QCoreApplication> -#include <QTemporaryDir> namespace ClangPchManager { @@ -41,35 +42,45 @@ QString currentProcessId() ClangPchManager::PchManagerConnectionClient::PchManagerConnectionClient( ClangBackEnd::PchManagerClientInterface *client) - : serverProxy_(client, ioDevice()) + : ConnectionClient(Utils::TemporaryDirectory::masterDirectoryPath() + + QStringLiteral("/ClangPchManagerBackEnd-") + + currentProcessId()), + m_serverProxy(client, ioDevice()) { + m_processCreator.setTemporaryDirectoryPattern("clangpchmanagerbackend-XXXXXX"); + stdErrPrefixer().setPrefix("PchManagerConnectionClient.stderr: "); stdOutPrefixer().setPrefix("PchManagerConnectionClient.stdout: "); } +PchManagerConnectionClient::~PchManagerConnectionClient() +{ + finishProcess(); +} + ClangBackEnd::PchManagerServerProxy &ClangPchManager::PchManagerConnectionClient::serverProxy() { - return serverProxy_; + return m_serverProxy; } void ClangPchManager::PchManagerConnectionClient::sendEndCommand() { - serverProxy_.end(); + m_serverProxy.end(); } void PchManagerConnectionClient::resetCounter() { - serverProxy_.resetCounter(); + m_serverProxy.resetCounter(); } -QString ClangPchManager::PchManagerConnectionClient::connectionName() const +QString PchManagerConnectionClient::outputName() const { - return temporaryDirectory().path() + QStringLiteral("/ClangPchManagerBackEnd-") + currentProcessId(); + return QStringLiteral("PchManagerConnectionClient"); } -QString PchManagerConnectionClient::outputName() const +void PchManagerConnectionClient::newConnectedServer(QIODevice *ioDevice) { - return QStringLiteral("PchManagerConnectionClient"); + m_serverProxy.setIoDevice(ioDevice); } } // namespace ClangPchManager diff --git a/src/plugins/clangpchmanager/pchmanagerconnectionclient.h b/src/plugins/clangpchmanager/pchmanagerconnectionclient.h index 72c04965e91..1566b08f47c 100644 --- a/src/plugins/clangpchmanager/pchmanagerconnectionclient.h +++ b/src/plugins/clangpchmanager/pchmanagerconnectionclient.h @@ -34,17 +34,18 @@ class PchManagerConnectionClient : public ClangBackEnd::ConnectionClient { public: PchManagerConnectionClient(ClangBackEnd::PchManagerClientInterface *client); + ~PchManagerConnectionClient(); ClangBackEnd::PchManagerServerProxy &serverProxy(); protected: void sendEndCommand() override; void resetCounter() override; - QString connectionName() const override; QString outputName() const override; + void newConnectedServer(QIODevice *ioDevice) override; private: - ClangBackEnd::PchManagerServerProxy serverProxy_; + ClangBackEnd::PchManagerServerProxy m_serverProxy; }; } // namespace ClangPchManager |