www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: SFTP issues

Re: SFTP issues

From: Peter Stuge <peter_at_stuge.se>
Date: Thu, 9 Feb 2012 15:06:23 +0100

Daniel Stenberg wrote:
>> I think it would be nice to return EAGAIN if we read 0 bytes from
>> transport.
>
> I don't. EAGAIN is only ever introduced in the transport layer when
> there's actually an EAGAIN from the socket layer. Introducing it
> elsewhere has always only introduced badness in the past and we've
> had to backpedal out from that several times.

It seems to me that the semantics are correct in this case.

> For example, EAGAIN implies that you need to call the same function
> again to make it "finish" what was previously started while 0 means
> that it wasn't abruptly stopped in the middle of something that
> needs to be continued but that other functions may very well be
> used.

Except sftp_read() returning 0 means EOF, unlike for the channel
functions. Just use EAGAIN and avoid recreating the complexity inside
the SFTP layer when the above layer handles the case anyway.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-02-09

the libssh2 team