From 2101eff1ef10b06fd6636f5d1693c18a9654ce9c Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Tue, 28 Jun 2011 18:08:12 +0200 Subject: [PATCH] SSH: Set keep-alive timer period to connection timeout. The Qt SDK's Qemu can be so slow that a single packet takes more than the old fixed value of five seconds for a round trip. Change-Id: I06f442c3c080fec8d1b1d10bd26e2e27b06e6863 Reviewed-on: http://codereview.qt.nokia.com/854 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com> --- src/libs/utils/ssh/sshconnection.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/ssh/sshconnection.cpp b/src/libs/utils/ssh/sshconnection.cpp index 8b6aa6ec640..6a712817edb 100644 --- a/src/libs/utils/ssh/sshconnection.cpp +++ b/src/libs/utils/ssh/sshconnection.cpp @@ -201,6 +201,7 @@ SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn, m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy ? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy); m_timeoutTimer.setSingleShot(true); + m_timeoutTimer.setInterval(m_connParams.timeout * 1000); m_keepAliveTimer.setSingleShot(true); m_keepAliveTimer.setInterval(10000); connect(m_channelManager, SIGNAL(timeout()), this, SLOT(handleTimeout())); @@ -614,7 +615,7 @@ void SshConnectionPrivate::sendKeepAlivePacket() Q_ASSERT(m_lastInvalidMsgSeqNr == InvalidSeqNr); m_lastInvalidMsgSeqNr = m_sendFacility.nextClientSeqNr(); m_sendFacility.sendInvalidPacket(); - m_timeoutTimer.start(5000); + m_timeoutTimer.start(); } void SshConnectionPrivate::connectToHost() @@ -634,7 +635,7 @@ void SshConnectionPrivate::connectToHost() connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(handleTimeout())); m_state = SocketConnecting; m_keyExchangeState = NoKeyExchange; - m_timeoutTimer.start(m_connParams.timeout * 1000); + m_timeoutTimer.start(); m_socket->connectToHost(m_connParams.host, m_connParams.port); } -- GitLab