Subject: Re: SFTP issues

Re: SFTP issues

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Tue, 7 Feb 2012 16:46:46 +0000

On 7 February 2012 13:32, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Sun, 5 Feb 2012, Daniel Stenberg wrote:
>
>>> I think I've identified a pattern to the failures and a potential cause.
>>> If you find a moment to chat on IRC I could use some help with a couple of
>>> questions.
>
> If there are others interested in this work, me and Alexander had a go at
> his problem yesterday and together we managed to identify the problem and
> come up with a fix for it. The attached 0001*patch is that fix.

This patch is based on Dan's first one and changes sftp_read to use a
switch statement instead of gotos. I think it highlights (but doesn't
fix) a few issues:

- should 'already' be caulculated later as the processing of leftovers
can change the offset it is based on
- why do we not return immediately when we've processed leftovers; as
Peter pointed out, we aren't allowed to anything that could access the
transport layer anyway in that case so why carry on?
- why does the second 'phase' set the next state as state_idle rather
than state_sent2 (not that it's actually used but it documents intent)
- is total_read guaranteed to be > 0 at the end of the function (where
it previously MOOed)
- why check total_read in the second phase while-loop? the loop
doesn't change it

Alex

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Received on 2012-02-07