summaryrefslogtreecommitdiff
path: root/src/libs
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@nokia.com>2011-07-05 18:01:58 +0200
committerChristian Kandeler <christian.kandeler@nokia.com>2011-07-06 13:09:05 +0200
commitee635dcf9e865c7bc405b81b09f0df5245c4b32a (patch)
tree34a66714a67ba82a115e5c9cde2eb49e2ead112a /src/libs
parent7ecf1e75d42e981a9f98e59742188ff6f712c024 (diff)
downloadqt-creator-ee635dcf9e865c7bc405b81b09f0df5245c4b32a.tar.gz
SSH: Don't allow connectToHost() while already connecting/connected.
Also fix callers potentially violating this policy. Change-Id: I630f1c544885df93a81e217e792363c0c2314108 Reviewed-on: http://codereview.qt.nokia.com/1186 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/utils/ssh/sshconnection.cpp2
-rw-r--r--src/libs/utils/ssh/sshremoteprocessrunner.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/libs/utils/ssh/sshconnection.cpp b/src/libs/utils/ssh/sshconnection.cpp
index 6a712817ed..0efdd0091e 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 0d5fa24e93..6a751cc37e 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();
}
}