Commit 2101eff1 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

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: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent c88cf530
...@@ -201,6 +201,7 @@ SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn, ...@@ -201,6 +201,7 @@ SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn,
m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy
? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy); ? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy);
m_timeoutTimer.setSingleShot(true); m_timeoutTimer.setSingleShot(true);
m_timeoutTimer.setInterval(m_connParams.timeout * 1000);
m_keepAliveTimer.setSingleShot(true); m_keepAliveTimer.setSingleShot(true);
m_keepAliveTimer.setInterval(10000); m_keepAliveTimer.setInterval(10000);
connect(m_channelManager, SIGNAL(timeout()), this, SLOT(handleTimeout())); connect(m_channelManager, SIGNAL(timeout()), this, SLOT(handleTimeout()));
...@@ -614,7 +615,7 @@ void SshConnectionPrivate::sendKeepAlivePacket() ...@@ -614,7 +615,7 @@ void SshConnectionPrivate::sendKeepAlivePacket()
Q_ASSERT(m_lastInvalidMsgSeqNr == InvalidSeqNr); Q_ASSERT(m_lastInvalidMsgSeqNr == InvalidSeqNr);
m_lastInvalidMsgSeqNr = m_sendFacility.nextClientSeqNr(); m_lastInvalidMsgSeqNr = m_sendFacility.nextClientSeqNr();
m_sendFacility.sendInvalidPacket(); m_sendFacility.sendInvalidPacket();
m_timeoutTimer.start(5000); m_timeoutTimer.start();
} }
void SshConnectionPrivate::connectToHost() void SshConnectionPrivate::connectToHost()
...@@ -634,7 +635,7 @@ void SshConnectionPrivate::connectToHost() ...@@ -634,7 +635,7 @@ void SshConnectionPrivate::connectToHost()
connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(handleTimeout())); connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(handleTimeout()));
m_state = SocketConnecting; m_state = SocketConnecting;
m_keyExchangeState = NoKeyExchange; m_keyExchangeState = NoKeyExchange;
m_timeoutTimer.start(m_connParams.timeout * 1000); m_timeoutTimer.start();
m_socket->connectToHost(m_connParams.host, m_connParams.port); m_socket->connectToHost(m_connParams.host, m_connParams.port);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment