SSH: Do not manage unshared connections

Unshared connections are not re-usable, so our whole book-keeping
procedure is not needed for them.

Change-Id: I1b6ca3d1658d139b6687425cf32f821548dddade
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-01-28 16:12:30 +01:00
parent 08a9b2a26f
commit ff70b8a9fd

View File

@@ -123,7 +123,8 @@ public:
SshConnection * const connection = new SshConnection(sshParams);
connect(connection, &SshConnection::disconnected,
this, &SshConnectionManager::cleanup);
m_acquiredConnections.append(connection);
if (SshSettings::connectionSharingEnabled())
m_acquiredConnections.append(connection);
return connection;
}
@@ -133,13 +134,15 @@ public:
QMutexLocker locker(&m_listMutex);
const bool wasAquired = m_acquiredConnections.removeOne(connection);
QTC_ASSERT(wasAquired, return);
QTC_ASSERT(wasAquired == connection->sharingEnabled(), return);
if (m_acquiredConnections.contains(connection))
return;
bool doDelete = false;
connection->moveToThread(QCoreApplication::instance()->thread());
if (m_deprecatedConnections.removeOne(connection)
if (!connection->sharingEnabled()) {
doDelete = true;
} else if (m_deprecatedConnections.removeOne(connection)
|| connection->state() != SshConnection::Connected) {
doDelete = true;
} else {