Ticket #94 (closed defect)
channel_read returns LIBSSH2_ERROR_EAGAIN, no data on socket
|Reported by:||anonymous||Owned by:||bagder|
While using libssh2_channel_read_ex(), I found that when the last of the data has been read, the libssh2_channel_read_ex() may return LIBSSH2_ERROR_EAGAIN, but a poll() on the socket times out (eventually). I diagnosed this as packets (channel eof and channel close) in memory, but not processed, so libssh2_channel_eof() remains false. Root caused as a "single shot" call to _libssh2_transport_read() in channel_read(). No call to _libssh2_transport_read() should be made unless the caller continues to call the function until it returns a non-positive value (0 or negative). This will prevent it from leaving unprocessed buffers in memory.