From 2ea40e63e8dac426f5338d16d5b2f006b51935f5 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 19 Mar 2012 22:34:04 +0100
Subject: [PATCH] channel_read: force window adjusts!

if there's not enough room to receive the data that's being requested,
the window adjustment needs to be sent to the remote and thus the force
option has to be used. _libssh2_channel_receive_window_adjust() would
otherwise "queue" small window adjustments for a later packet but that
is really terribly for the small buffer read that for example is the
final little piece of a very large file as then there is no logical next
packet!

Reported by: Armen Babakhanian
Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0130.shtml
---
 src/channel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/channel.c b/src/channel.c
index 9e29492..5181f6f 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -1898,7 +1898,7 @@ libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id, char *buf,
     if(buflen > recv_window) {
         BLOCK_ADJUST(rc, channel->session,
                      _libssh2_channel_receive_window_adjust(channel, buflen,
-                                                            0, NULL));
+                                                            1, NULL));
     }
 
     BLOCK_ADJUST(rc, channel->session,
-- 
1.7.9.1

