I wrote:
3. In release 1.4.3, src/channel.c, _libssh2_channel_write(), line 2017:return (rc==LIBSSH2_ERROR_EAGAIN?rc:0); Here rc is the result from _libssh2_transport_read(session). When the output buffer is full, but the input buffer wasn't, this returns 0. It seems to me (and please correct me if I am mistaken) that libssh2_channel_write_ex() should only return 0 if the buflen argument is itself zero. I think that the correct line here would be simply return LIBSSH2_ERROR_EAGAIN; This fixes an infinite loop in typical fwrite()-like code that assumes that (the equivalent of) write() will prefer reporting EAGAIN over returning zero.
On a related note... if the output socket gets shut down or otherwise blocked when the send window is exactly full, it's not clear to me how libssh2_channel_write_ex() will ever return anything other than 0 or LIBSSH2_ERROR_EAGAIN. Presumably calling send() would return an error, allowing a flag (local.eof?) to be set, but how can it ever get called? Shouldn't _ssh_transport_read() call send_existing()? Would that break the logjam? Nathan Myers [email protected] _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
