channel_write: acknowledge transport errors
When draining data off the socket with _libssh2_transport_read() (which in turn has to be done so that we can be sure to have read any possible window-increasing packets), this code previously ignored errors which could lead to nasty loops. Now all error codes except EAGAIN will cause the error to be returned at once. Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0068.shtml Reported by: Matthew Booth
This commit is contained in:
parent
a46ef85a56
commit
fed0759720
@ -2008,6 +2008,9 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
|
||||
rc = _libssh2_transport_read(session);
|
||||
while (rc > 0);
|
||||
|
||||
if((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN))
|
||||
return rc;
|
||||
|
||||
if(channel->local.window_size <= 0)
|
||||
/* there's no room for data so we stop */
|
||||
return (rc==LIBSSH2_ERROR_EAGAIN?rc:0);
|
||||
|
Loading…
Reference in New Issue
Block a user