SSH: Take more care when closing channels.

We can't just pretend a channel is already gone after we request it to
close; it's only closed when the server has sent the acknowledgement.

Change-Id: Ib6e8b9bf77635995259885af13755f5fc0e825a9
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Christian Kandeler
2012-08-17 17:33:06 +02:00
parent 1e71dccc9e
commit d6e85d5522
5 changed files with 25 additions and 6 deletions

View File

@@ -194,13 +194,18 @@ QSharedPointer<SftpChannel> SshConnection::createSftpChannel()
int SshConnection::closeAllChannels()
{
try {
return d->m_channelManager->closeAllChannels();
return d->m_channelManager->closeAllChannels(Internal::SshChannelManager::CloseAllRegular);
} catch (const Botan::Exception &e) {
qDebug("%s: %s", Q_FUNC_INFO, e.what());
return -1;
}
}
int SshConnection::channelCount() const
{
return d->m_channelManager->channelCount();
}
namespace Internal {
SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn,
@@ -680,7 +685,7 @@ void SshConnectionPrivate::closeConnection(SshErrorCode sshError,
m_keepAliveTimer.stop();
disconnect(&m_keepAliveTimer, 0, this, 0);
try {
m_channelManager->closeAllChannels();
m_channelManager->closeAllChannels(SshChannelManager::CloseAllAndReset);
m_sendFacility.sendDisconnectPacket(sshError, serverErrorString);
} catch (Botan::Exception &) {} // Nothing sensible to be done here.
if (m_error != SshNoError)