From acd9bd6104a8e9427293bcdf67b4850f7982b1d4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 3 Apr 2012 22:36:19 +0200 Subject: [PATCH] always do "forced" window updates When calling _libssh2_channel_receive_window_adjust() internally, we now always use the 'force' option to prevent libssh2 to avoid sending the update if the update isn't big enough. It isn't fully analyzed but we have seen corner cases which made a necessary window update not get send due to this and then the other side doesn't send data our side then sits waiting for forever. --- src/channel.c | 2 +- src/packet.c | 2 +- src/sftp.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/channel.c b/src/channel.c index 5181f6f..63e5d5b 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1418,7 +1418,7 @@ _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid) rc = _libssh2_channel_receive_window_adjust(channel, channel->flush_refund_bytes, - 0, NULL); + 1, NULL); if (rc == LIBSSH2_ERROR_EAGAIN) return rc; } diff --git a/src/packet.c b/src/packet.c index 5852d0c..364b434 100644 --- a/src/packet.c +++ b/src/packet.c @@ -661,7 +661,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, rc = _libssh2_channel_receive_window_adjust(session-> packAdd_channelp, datalen - 13, - 0, NULL); + 1, NULL); if (rc == LIBSSH2_ERROR_EAGAIN) return rc; diff --git a/src/sftp.c b/src/sftp.c index 6d73751..96e00aa 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -285,7 +285,7 @@ sftp_packet_read(LIBSSH2_SFTP *sftp) /* ask for twice the data amount we need at once */ rc = _libssh2_channel_receive_window_adjust(channel, sftp->partial_len*2, - 0, NULL); + 1, NULL); /* store the state so that we continue with the correct operation at next invoke */ sftp->packet_state = (rc == LIBSSH2_ERROR_EAGAIN)? @@ -1262,7 +1262,7 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE * handle, char *buffer, rc = _libssh2_channel_receive_window_adjust(sftp->channel, max_read_ahead*8, - 0, NULL); + 1, NULL); /* if this returns EAGAIN, we will get back to this function at next call */ assert(rc != LIBSSH2_ERROR_EAGAIN || !filep->data_left);