channel_write: if data has been sent, don't return EAGAIN
When sending data in a loop, we must not return EAGAIN if we managed to send data in an earlier round. This was reported in bug #126 => http://libssh2.stuge.se/ticket/126
This commit is contained in:
@@ -2038,6 +2038,11 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
|
||||
channel->write_s -
|
||||
channel->write_packet);
|
||||
if (rc == PACKET_EAGAIN) {
|
||||
if(wrote)
|
||||
/* some pieces of data was sent before the EAGAIN so
|
||||
we return that amount! */
|
||||
goto _channel_write_done;
|
||||
|
||||
return libssh2_error(session, rc,
|
||||
"Unable to send channel data");
|
||||
}
|
||||
@@ -2061,6 +2066,8 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
|
||||
}
|
||||
}
|
||||
|
||||
_channel_write_done:
|
||||
|
||||
LIBSSH2_FREE(session, channel->write_packet);
|
||||
channel->write_packet = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user