diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index d66892b0173..998268c9a0b 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -72,13 +72,11 @@ #include #include -#include -#include - #include #include #include #include +#include #include #include @@ -156,37 +154,38 @@ public: void start() override { - m_connection = QSsh::SshConnectionManager::acquireConnection(device()->sshParameters()); - if (!m_connection) { - reportFailure(); - return; - } - - connect(m_connection, &QSsh::SshConnection::errorOccurred, this, [this] { - reportFailure(); - }); - - auto connected = [this] { - *m_localServerAddress = m_connection->connectionInfo().localAddress; + QTC_ASSERT(!m_process, return); + m_process.reset(new QtcProcess); + m_process->setCommand({device()->mapToGlobalPath("echo"), "-n $SSH_CLIENT", CommandLine::Raw}); + connect(m_process.get(), &QtcProcess::done, this, [this] { + if (m_process->error() != QProcess::UnknownError) { + reportFailure(); + return; + } + const QByteArrayList data = m_process->readAllStandardOutput().split(' '); + if (data.size() != 3) { + reportFailure(); + return; + } + QHostAddress hostAddress; + if (!hostAddress.setAddress(QString::fromLatin1(data.first()))) { + reportFailure(); + return; + } + *m_localServerAddress = hostAddress; reportStarted(); - }; - if (m_connection->state() == QSsh::SshConnection::Connected) { - connected(); - } else { - connect(m_connection, &QSsh::SshConnection::connected, this, connected); - m_connection->connectToHost(); - } + m_process.release()->deleteLater(); + }); + m_process->start(); } void stop() override { - if (m_connection) - QSsh::SshConnectionManager::releaseConnection(m_connection); reportStopped(); } private: - QSsh::SshConnection *m_connection = nullptr; + std::unique_ptr m_process = nullptr; QHostAddress *m_localServerAddress = nullptr; }; diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h index 99808a97c20..1e4e245cd78 100644 --- a/src/plugins/valgrind/memchecktool.h +++ b/src/plugins/valgrind/memchecktool.h @@ -26,7 +26,7 @@ #pragma once -#include +#include namespace Valgrind { namespace Internal {