On Mon, 19 Mar 2012, Daniel Stenberg wrote:

I can confirm that this is a regression that I too can repeat! Just downloaded a 102400000 bytes file several times that stopped at 102399950 each time using current git.

Hi again,

Please try the attached patch. It seems to fix the issue for me, the logic makes perfect sense to me and I'm sorry for being the one who caused this regression... :-(

--

 / daniel.haxx.se
From 2ea40e63e8dac426f5338d16d5b2f006b51935f5 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <dan...@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

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to