RemoteLinux: Use SSH connection sharing in device tester

No need to connect more than once during the testing process.

Change-Id: I2401a2c1e5b940b6b12e86182d37a099e94680dd
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2018-12-12 17:16:49 +01:00
parent ccefa38e19
commit cc812e841b

View File

@@ -31,6 +31,7 @@
#include <ssh/sftptransfer.h> #include <ssh/sftptransfer.h>
#include <ssh/sshremoteprocess.h> #include <ssh/sshremoteprocess.h>
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
#include <ssh/sshconnectionmanager.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QSsh; using namespace QSsh;
@@ -65,6 +66,8 @@ GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent)
GenericLinuxDeviceTester::~GenericLinuxDeviceTester() GenericLinuxDeviceTester::~GenericLinuxDeviceTester()
{ {
if (d->connection)
releaseConnection(d->connection);
delete d; delete d;
} }
@@ -73,7 +76,8 @@ void GenericLinuxDeviceTester::testDevice(const IDevice::ConstPtr &deviceConfigu
QTC_ASSERT(d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
d->deviceConfiguration = deviceConfiguration; d->deviceConfiguration = deviceConfiguration;
d->connection = new SshConnection(deviceConfiguration->sshParameters(), this); forceNewConnection(deviceConfiguration->sshParameters());
d->connection = acquireConnection(deviceConfiguration->sshParameters());
connect(d->connection, &SshConnection::connected, connect(d->connection, &SshConnection::connected,
this, &GenericLinuxDeviceTester::handleConnected); this, &GenericLinuxDeviceTester::handleConnected);
connect(d->connection, &SshConnection::errorOccurred, connect(d->connection, &SshConnection::errorOccurred,
@@ -208,7 +212,7 @@ void GenericLinuxDeviceTester::setFinished(TestResult result)
} }
if (d->connection) { if (d->connection) {
disconnect(d->connection, nullptr, this, nullptr); disconnect(d->connection, nullptr, this, nullptr);
d->connection->deleteLater(); releaseConnection(d->connection);
d->connection = nullptr; d->connection = nullptr;
} }
emit finished(result); emit finished(result);