On Thu, 9 Feb 2012, Peter Stuge wrote:
>> 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.
I'm not sure we're ready to make that promise in the API and statement in the
documentation. I'd rather say that returning 0 might mean EOF.
> Just use EAGAIN and avoid recreating the complexity inside the SFTP layer
> when the above layer handles the case anyway.
Sorry, I missed what simplicity you gain with EAGAIN instead of 0?
As I read it (and I'm not 100% sure we're talking about the same code now), it
would be the perfect example where EAGAIN would be wrong since there could
possibly be data already drained from the socket and kept internally by
libssh2 and EAGAIN would then wrongly lure the application to wait for the
socket again while in reality there is data to handle already.
-- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2012-02-09