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 12:09:00 +0100

Daniel Stenberg wrote:
>> 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");
>> }
>
> I'm sorry, why is that weird?

Yeah, no, looking more closely at how _transport_send() works this is
fine. I was confusing it with how _send() works, returning number of
bytes rather than 0 for success.

> I have a different explanation to the problem and that is quite simply
> that_libssh2_channel_write() returns EAGAIN instead of a short return when
> the entire buffer isn't sent in the first case, which can lead to a "loss"
> of data returned.

That's what I thought the problem was above. But maybe it is there in
a different place. It fits with the error description.

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