#255: libssh2_channel_write_ex returns zero --------------------+-------------------- Reporter: ncm | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Keywords: | Blocked By: Blocks: | --------------------+-------------------- Sometimes {{{libssh2_channel_write_ex()}}} returns zero when writing from a non-zero-length buffer. As I understand it, this should never happen: it should either return a positive number of bytes written, or a negative value such as {{{_EAGAIN}}}.
The zero may be coming from {{{src/channel.c}}}, {{{_libssh2_channel_write()}}}, c. line 2015, when rc is zero: {{{ if(channel->local.window_size <= 0) /* there's no room for data so we stop */ return (rc==LIBSSH2_ERROR_EAGAIN?rc:0); }}} {{{rc}}} gets its value from {{{_libssh2_transport_read()}}}, which returns zero when {{{session->socket_state}}} is {{{LIBSSH2_SOCKET_DISCONNECTED}}}. I have not discovered any other way for {{{_transport_read()}}} to return zero. Another way for {{{_write_ex()}}} to return zero would be if {{{channel->local.packet_size}}} were to be set to zero. Also, it seems as if {{{session->socket_block_directions}}} should be assigned {{{LIBSSH2_SESSION_BLOCK_INBOUND}}} when {{{channel->local.window_size}}} is found to be zero, but it is not. -- Ticket URL: <https://trac.libssh2.org/ticket/255> libssh2 <https://trac.libssh2.org/> C library for writing portable SSH2 clients _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel