On Mon, Apr 05, 2010 at 03:30:38AM +0530, Perl Whore wrote:
> I've set mirror command to use pget, which splits files into chunks.
> But when xfer:verify is enabled, it checks the hash as soon as a chunk
> completes, and then it kills the rest of the transfers and leaves only
> a single thread running.
>
> Expected behaviour: xfer:verify-command should be executed only after
> all the chunks complete, i.e., after the file transfer is completed.

Please test this patch.

--
   Alexander.
Index: FileCopy.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/FileCopy.cc,v
retrieving revision 1.157
diff -u -p -r1.157 FileCopy.cc
--- FileCopy.cc 29 Apr 2010 11:00:41 -0000      1.157
+++ FileCopy.cc 30 Apr 2010 11:46:11 -0000
@@ -729,6 +729,7 @@ FileCopyPeer::FileCopyPeer(dir_t m) : IO
    can_seek0=false;
    date_set=false;
    do_set_date=true;
+   do_verify=true;
    ascii=false;
    range_start=0;
    range_limit=FILE_END;
@@ -834,8 +835,10 @@ int FileCopyPeerFA::Do()
            fxp_eof:
               // FIXME: set date for real.
               date_set=true;
-              if(!verify)
+              if(!verify && do_verify)
                  verify=new FileVerificator(session,file);
+              else
+                 done=true;
               return MOVED;
            }
            else if(res==FA::IN_PROGRESS)
@@ -1427,8 +1430,10 @@ int FileCopyPeerFDStream::Do()
            }
            if(stream && my_stream && !stream->Done())
               return m;
-           if(!verify)
+           if(!verify && do_verify)
               verify=new FileVerificator(stream);
+           else
+              done=true;
            return MOVED;
         }
         if(seek_pos==0)
Index: FileCopy.h
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/FileCopy.h,v
retrieving revision 1.84
diff -u -p -r1.84 FileCopy.h
--- FileCopy.h  29 Apr 2010 11:00:42 -0000      1.84
+++ FileCopy.h  30 Apr 2010 11:46:32 -0000
@@ -54,6 +54,7 @@ protected:
    bool can_seek0;
    bool date_set;
    bool do_set_date;
+   bool do_verify;
    bool removing;
    bool file_removed;
 
@@ -90,6 +91,7 @@ public:
    void SetEntitySize(off_t s) { e_size=s; }
 
    void DontCopyDate() { do_set_date=false; }
+   void DontVerify() { do_verify=false; }
    bool NeedDate() { return do_set_date; }
 
    void SetRange(const off_t s,const off_t lim);
@@ -225,6 +227,7 @@ public:
    void SetError(const char *str);
 
    void DontCopyDate() { put->DontCopyDate(); }
+   void DontVerify() { put->DontVerify(); }
    void Ascii() { get->Ascii(); put->Ascii(); }
    void DontFailIfBroken() { fail_if_broken=false; }
    void FailIfCannotSeek() { fail_if_cannot_seek=true; }
Index: pgetJob.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/pgetJob.cc,v
retrieving revision 1.57
diff -u -p -r1.57 pgetJob.cc
--- pgetJob.cc  29 Apr 2010 11:00:43 -0000      1.57
+++ pgetJob.cc  30 Apr 2010 11:40:33 -0000
@@ -345,6 +345,7 @@ pgetJob::ChunkXfer *pgetJob::NewChunk(co
    c1->SetRange(start,limit);
    c1->SetSize(GetSize());
    c1->DontCopyDate();
+   c1->DontVerify();
    c1->FailIfCannotSeek();
 
    ChunkXfer *chunk=new ChunkXfer(c1,remote,start,limit);

Reply via email to