diff --git a/src/libs/utils/ssh/sshconnection.cpp b/src/libs/utils/ssh/sshconnection.cpp index 6a712817edb..0efdd0091e6 100644 --- a/src/libs/utils/ssh/sshconnection.cpp +++ b/src/libs/utils/ssh/sshconnection.cpp @@ -620,6 +620,8 @@ void SshConnectionPrivate::sendKeepAlivePacket() void SshConnectionPrivate::connectToHost() { + QTC_ASSERT(m_state == SocketUnconnected, return); + m_incomingData.clear(); m_incomingPacket.reset(); m_sendFacility.reset(); diff --git a/src/libs/utils/ssh/sshremoteprocessrunner.cpp b/src/libs/utils/ssh/sshremoteprocessrunner.cpp index 0d5fa24e932..6a751cc37e7 100644 --- a/src/libs/utils/ssh/sshremoteprocessrunner.cpp +++ b/src/libs/utils/ssh/sshremoteprocessrunner.cpp @@ -145,7 +145,8 @@ void SshRemoteProcessRunnerPrivate::run(const QByteArray &command) } else { connect(m_connection.data(), SIGNAL(connected()), SLOT(handleConnected())); - m_connection->connectToHost(); + if (m_connection->state() == SshConnection::Unconnected) + m_connection->connectToHost(); } } diff --git a/src/plugins/debugger/gdb/remotegdbprocess.cpp b/src/plugins/debugger/gdb/remotegdbprocess.cpp index f32af660e01..124e43f620d 100644 --- a/src/plugins/debugger/gdb/remotegdbprocess.cpp +++ b/src/plugins/debugger/gdb/remotegdbprocess.cpp @@ -98,7 +98,8 @@ void RemoteGdbProcess::realStart(const QString &cmd, const QStringList &args, handleConnected(); } else { connect(m_conn.data(), SIGNAL(connected()), this, SLOT(handleConnected())); - m_conn->connectToHost(); + if (m_conn->state() == SshConnection::Unconnected) + m_conn->connectToHost(); } } diff --git a/src/plugins/remotelinux/abstractmaemodeploystep.cpp b/src/plugins/remotelinux/abstractmaemodeploystep.cpp index e305bdc7195..32755502450 100644 --- a/src/plugins/remotelinux/abstractmaemodeploystep.cpp +++ b/src/plugins/remotelinux/abstractmaemodeploystep.cpp @@ -298,7 +298,8 @@ void AbstractMaemoDeployStep::connectToDevice() connect(m_connection.data(), SIGNAL(connected()), this, SLOT(handleConnected())); writeOutput(tr("Connecting to device...")); - m_connection->connectToHost(); + if (m_connection->state() == SshConnection::Unconnected) + m_connection->connectToHost(); } } diff --git a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp index 57ecf01e0ad..340f4154bbf 100644 --- a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp +++ b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp @@ -105,7 +105,8 @@ void RemoteLinuxApplicationRunner::start() handleConnected(); } else { emit reportProgress(tr("Connecting to device...")); - m_connection->connectToHost(); + if (m_connection->state() == Utils::SshConnection::Unconnected) + m_connection->connectToHost(); } } diff --git a/src/plugins/valgrind/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrind/valgrindprocess.cpp index 2be53c433ad..b2da5551f2c 100644 --- a/src/plugins/valgrind/valgrind/valgrindprocess.cpp +++ b/src/plugins/valgrind/valgrind/valgrindprocess.cpp @@ -186,7 +186,8 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString this, SLOT(connected())); connect(m_connection.data(), SIGNAL(error(Utils::SshError)), this, SLOT(error(Utils::SshError))); - m_connection->connectToHost(); + if (m_connection->state() == Utils::SshConnection::Unconnected) + m_connection->connectToHost(); } else { connected(); }