Re: SFTP file info and state machine
Date: Mon, 31 Jan 2011 18:40:26 -0500 (EST)
responding to self cause i just realized a few problems with my cunning plan....
----- Original Message -----
> ----- Original Message -----
> > On Fri, 28 Jan 2011, John Utz wrote:
> > > It seems to me that this job should be done only in the state
> > >
> > > "SSH_SFTP_QUOTE_STAT"
> > >
> > > instead of being spread between SSH_SFTP_QUOTE_STAT and
> > > SSH_SCP_TRANS_INIT
> > No, the QUOTE states are only used for quote commands and the
> > SSH_SFTP_QUOTE_STAT in specific is only used of a stat-using quote
> > command is
> > used.
> Thankyou for explaining that.
> > When doing SFTP download, the libssh2_sftp_stat_ex() command is
> > already used
> > in the SSH_SFTP_DOWNLOAD_STAT state and I figure you should be able
> > to
> > set the
> > information properly after that point.
> if you are only checking fileinfo, you dont make it to
> SSH_SFTP_DOWNLOAD_STAT, you only make it to SSH_SFTP_TRANS_INIT. There
> are several edges inside of the SSH_SFTP_TRANS_INIT case statement and
> SSH_SFTP_DOWNLOAD_STAT is but one of them.
> That explains why Sr. Mele chose to insert the code where he did. :-)
> I agree that the use of libssh2_sftp_stat_ex() is a good(best?) choice
> getting the file data, but it would be gratuitously consumptive to
> call it twice in the download case.
> Would it not be reasonable to add the libssh2_sftp_stat_ex() call to
> SSH_SFTP_TRANS_INIT and delete it from SSH_SFTP_DOWNLOAD_STAT?
dang it, the problem with this is that the 'size' variable is local to the SSH_SFTP_DOWNLOAD_STAT case and said case performs a non-trivial amount of cognition about the size of the file prior to actually performing the download.
i see no problem with that processing remaining where it is since it's the only state that cares about it, but that means that the 'size' variable would need to be scoped at the function level instead of the case statement level.
A quick survey of the code doesnt show any conflicts with doing that.
> commentary appreciated as always!
List admin: http://cool.haxx.se/list/listinfo/curl-library
Received on 2011-02-01