forked from qt-creator/qt-creator
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:
@@ -123,7 +123,8 @@ public:
|
|||||||
SshConnection * const connection = new SshConnection(sshParams);
|
SshConnection * const connection = new SshConnection(sshParams);
|
||||||
connect(connection, &SshConnection::disconnected,
|
connect(connection, &SshConnection::disconnected,
|
||||||
this, &SshConnectionManager::cleanup);
|
this, &SshConnectionManager::cleanup);
|
||||||
m_acquiredConnections.append(connection);
|
if (SshSettings::connectionSharingEnabled())
|
||||||
|
m_acquiredConnections.append(connection);
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
@@ -133,13 +134,15 @@ public:
|
|||||||
QMutexLocker locker(&m_listMutex);
|
QMutexLocker locker(&m_listMutex);
|
||||||
|
|
||||||
const bool wasAquired = m_acquiredConnections.removeOne(connection);
|
const bool wasAquired = m_acquiredConnections.removeOne(connection);
|
||||||
QTC_ASSERT(wasAquired, return);
|
QTC_ASSERT(wasAquired == connection->sharingEnabled(), return);
|
||||||
if (m_acquiredConnections.contains(connection))
|
if (m_acquiredConnections.contains(connection))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool doDelete = false;
|
bool doDelete = false;
|
||||||
connection->moveToThread(QCoreApplication::instance()->thread());
|
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) {
|
|| connection->state() != SshConnection::Connected) {
|
||||||
doDelete = true;
|
doDelete = true;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user