- (Feb 12 2009) Romain Bondue extended Markus Moeller fix from Feb 8, based on
a previous (uncommitted) patch by Erik Brossler. It improves libssh2_channel_write_ex in blocking situations when the socket is set non- blocking.
This commit is contained in:
@@ -1771,8 +1771,9 @@ libssh2_channel_write_ex(LIBSSH2_CHANNEL * channel, int stream_id,
|
||||
channel->write_state = libssh2_NB_state_allocated;
|
||||
}
|
||||
|
||||
/* deduct the amount thet has already been sent */
|
||||
/* Deduct the amount that has already been sent, and set buf accordingly. */
|
||||
buflen -= channel->write_bufwrote;
|
||||
buf += channel->write_bufwrote;
|
||||
|
||||
while (buflen > 0) {
|
||||
if (channel->write_state == libssh2_NB_state_allocated) {
|
||||
@@ -1798,6 +1799,7 @@ libssh2_channel_write_ex(LIBSSH2_CHANNEL * channel, int stream_id,
|
||||
if (rc < 0) {
|
||||
/* Error or EAGAIN occurred, disconnect? */
|
||||
if (rc != PACKET_EAGAIN) {
|
||||
LIBSSH2_FREE(session, channel->write_packet);
|
||||
channel->write_state = libssh2_NB_state_idle;
|
||||
}
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user