Subject: Re: libssh2_channel_write_ex may incorrectly return EAGAIN

Re: libssh2_channel_write_ex may incorrectly return EAGAIN

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 13 Nov 2010 10:55:06 +0100 (CET)

On Sat, 13 Nov 2010, Peter Stuge 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?

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.

I'll get to this later today I hope.

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

I'm not sure exactly what you refer to, but feel free to clean up!

BTW, thanks a lot for jumping in and helping out!

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