From 3e809de1cf2c9e5f2e84c7021b76c9b1b9e75671 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 6 Jun 2012 15:16:03 +0200 Subject: [PATCH] SSH: Fix send buffer flushing. There might be more data to send than what fits into one packet. This case was not handled correctly. Change-Id: I5a415223c37ec8a041503d901bbcc81e903f46d9 Reviewed-by: Daniel Molkentin --- src/libs/ssh/sshchannel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/ssh/sshchannel.cpp b/src/libs/ssh/sshchannel.cpp index 0d8fbfbaaec..60164f44077 100644 --- a/src/libs/ssh/sshchannel.cpp +++ b/src/libs/ssh/sshchannel.cpp @@ -116,9 +116,11 @@ void AbstractSshChannel::handleWindowAdjust(quint32 bytesToAdd) void AbstractSshChannel::flushSendBuffer() { - const quint32 bytesToSend = qMin(m_remoteMaxPacketSize, - qMin(m_remoteWindowSize, m_sendBuffer.size())); - if (bytesToSend > 0) { + while (true) { + const quint32 bytesToSend = qMin(m_remoteMaxPacketSize, + qMin(m_remoteWindowSize, m_sendBuffer.size())); + if (bytesToSend == 0) + break; const QByteArray &data = m_sendBuffer.left(bytesToSend); m_sendFacility.sendChannelDataPacket(m_remoteChannel, data); m_sendBuffer.remove(0, bytesToSend);