forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "refactoringconnectionclient.h"
|
||||
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
@@ -39,8 +41,13 @@ QString currentProcessId()
|
||||
}
|
||||
|
||||
RefactoringConnectionClient::RefactoringConnectionClient(RefactoringClientInterface *client)
|
||||
: serverProxy_(client, ioDevice())
|
||||
: ConnectionClient(Utils::TemporaryDirectory::masterDirectoryPath()
|
||||
+ QStringLiteral("/ClangRefactoringBackEnd-")
|
||||
+ currentProcessId()),
|
||||
m_serverProxy(client, nullptr)
|
||||
{
|
||||
m_processCreator.setTemporaryDirectoryPattern("clangrefactoringbackend-XXXXXX");
|
||||
|
||||
stdErrPrefixer().setPrefix("RefactoringConnectionClient.stderr: ");
|
||||
stdOutPrefixer().setPrefix("RefactoringConnectionClient.stdout: ");
|
||||
}
|
||||
@@ -52,22 +59,17 @@ RefactoringConnectionClient::~RefactoringConnectionClient()
|
||||
|
||||
RefactoringServerProxy &RefactoringConnectionClient::serverProxy()
|
||||
{
|
||||
return serverProxy_;
|
||||
return m_serverProxy;
|
||||
}
|
||||
|
||||
void RefactoringConnectionClient::sendEndCommand()
|
||||
{
|
||||
serverProxy_.end();
|
||||
m_serverProxy.end();
|
||||
}
|
||||
|
||||
void RefactoringConnectionClient::resetCounter()
|
||||
{
|
||||
serverProxy_.resetCounter();
|
||||
}
|
||||
|
||||
QString RefactoringConnectionClient::connectionName() const
|
||||
{
|
||||
return temporaryDirectory().path() + QStringLiteral("/ClangRefactoringBackEnd-") + currentProcessId();
|
||||
m_serverProxy.resetCounter();
|
||||
}
|
||||
|
||||
QString RefactoringConnectionClient::outputName() const
|
||||
@@ -75,4 +77,9 @@ QString RefactoringConnectionClient::outputName() const
|
||||
return QStringLiteral("RefactoringConnectionClient");
|
||||
}
|
||||
|
||||
void RefactoringConnectionClient::newConnectedServer(QIODevice *ioDevice)
|
||||
{
|
||||
m_serverProxy.setIoDevice(ioDevice);
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Reference in New Issue
Block a user