Subject: Re: libssh2_sftp_seek64 doesn't work

Re: libssh2_sftp_seek64 doesn't work

From: Alexander Lamaison <awl03_at_doc.ic.ac.uk>
Date: Fri, 26 Aug 2011 15:16:49 +0100

On Friday, August 26, 2011, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 26 Aug 2011, Henrik Nordström wrote:
>
>> It looks reasonable, but sftp_packetlist_flush() looks dangerous to me
(actually in general, not specific to your change). What if it's in the
middle of sending a request?
>
> The only way seek64() would call sftp_packetlist_flush() while being in a
middle of a request would be if the immediate call to sftp_read() returned
EAGAIN.
>
> In general our API is designed to assume that you will call the same
function again after an EAGAIN has been called. To change that rule, we'll
have to add more logic to prevent that another packet gets sent if
previously an incomplete packet was sent.

What about aborting an in-progress operation? How would you do this using
the libssh2 API? Up till now I've only been using libssh2 in blocking mode
but, in the near future, I was hoping to use it non-blocking to improve
user-interaction. My aim was to put the user always in control such that if
something takes too long and they get impatient they cab simply abort the
current operation. I imagined that I would do this by setting a flag and
then simply not continue the loop on the next EAGAIN. Would this be a bad
way to do it?

Alex

--
Swish: Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-08-26