diff --git a/src/libs/utils/ssh/sshconnectionmanager.cpp b/src/libs/utils/ssh/sshconnectionmanager.cpp index c92d4a33379..52f3192c77e 100644 --- a/src/libs/utils/ssh/sshconnectionmanager.cpp +++ b/src/libs/utils/ssh/sshconnectionmanager.cpp @@ -40,28 +40,10 @@ #include #include #include -#include namespace Utils { namespace Internal { -struct ConnectionInfo -{ - typedef QSharedPointer Ptr; - static ConnectionInfo::Ptr create(const SshConnection::Ptr &conn) - { - return Ptr(new ConnectionInfo(conn)); - } - - SshConnection::Ptr connection; - int refCount; - bool isConnecting; - -private: - ConnectionInfo(const SshConnection::Ptr &conn) - : connection(conn), refCount(1), isConnecting(false) {} -}; - class SshConnectionManagerPrivate : public QObject { Q_OBJECT @@ -78,8 +60,6 @@ public: SshConnectionManagerPrivate() { moveToThread(QCoreApplication::instance()->thread()); - connect(&m_cleanupTimer, SIGNAL(timeout()), SLOT(cleanup())); - m_cleanupTimer.start(5*60*1000); } QSharedPointer acquireConnection(const SshConnectionParameters &sshParams) @@ -188,11 +168,14 @@ private slots: { QMutexLocker locker(&m_listMutex); - SshConnection::Ptr connection(static_cast(sender())); - if (connection.isNull()) + SshConnection *currentConnection = qobject_cast(sender()); + if (!currentConnection) return; - m_unacquiredConnections.removeAll(connection); + for (int i = m_unacquiredConnections.count() - 1; i >= 0; --i) { + if (m_unacquiredConnections.at(i) == currentConnection) + m_unacquiredConnections.removeAt(i); + } } private: @@ -202,9 +185,7 @@ private: QList m_unacquiredConnections; QList m_acquiredConnections; QList m_deprecatedConnections; - QMutex m_listMutex; - QTimer m_cleanupTimer; }; QMutex SshConnectionManagerPrivate::instanceMutex;