From 3c71ad4fce745876f7e7ad33b846518f2d50edf6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 11 Aug 2011 14:32:05 +0200 Subject: [PATCH] _libssh2_channel_write: handle window_size == 0 better When about to send data on the channel and the window size is 0, we must not just return 0 if the transport_read() function returned EAGAIN as it then causes a busy-loop. Bug: http://libssh2.org/mail/libssh2-devel-archive-2011-08/0011.shtml --- src/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/channel.c b/src/channel.c index efb2b48..be6a680 100644 --- a/src/channel.c +++ b/src/channel.c @@ -2022,7 +2022,7 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id, if(channel->local.window_size <= 0) /* there's no room for data so we stop */ - return 0; + return (rc==LIBSSH2_ERROR_EAGAIN?rc:0); channel->write_bufwrite = buflen;