Subject: Re: libssh2_channel_write_ex may incorrectly return EAGAIN

Re: libssh2_channel_write_ex may incorrectly return EAGAIN

From: Peter Stuge <peter_at_stuge.se>
Date: Sat, 13 Nov 2010 00:14:33 +0100

Tommy Lindgren wrote:
> I think I have found an issue with libssh2_channel_write_ex. It seems
> like it can return LIBSSH2_ERROR_EAGAIN when it actually successfully
> wrote bytes to the socket. I suspect this happens when the send() call
> returns a value greater than 0 but less than the buffer length.
..
> I have tested this against the latest git code.

Yeah, channel_write() git now looks weird.

        rc = _libssh2_transport_send(session, channel->write_packet,
..
        else if (rc) {
            channel->write_state = libssh2_NB_state_idle;
            return _libssh2_error(session, rc,
                                  "Unable to send channel data");
        }

Also, I'm not happy that only one code path leading into
channel_write() actually has a debug message in _channel_write().

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-11-13