Subject: Re: libssh2_sftp_seek64 doesn't work

Re: libssh2_sftp_seek64 doesn't work

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 26 Aug 2011 15:25:56 +0200 (CEST)

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.

> Another possible issue is response packets arriving after the flush. If I am
> not mistaken these will accumulate in the brigade and not get freed.

Right, that's what I tried to explain. They will arrive and just get kept
until the sftp handle is freed. If you do a lot of seeks that may become a
problem and we should probably think of ways to improve that handling.

-- 
  / daniel.haxx.se

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