소스 검색

Run checksum check if -V and -c are used and file is completed

With -c option, aria2 can continue download after the existing file
position. If it is not completed, then after completion aria2 runs
checksum checking if available. But if existing file has already been
completed, then CreateRequestCommand exits without issuing checksum
checking. And aria2 treats it download error because it needs checksum
verification but it has not been done. This change fixes this by
properly checking download state and issue checksum checking before
CreateRequestCommand.
Tatsuhiro Tsujikawa 12 년 전
부모
커밋
421ae13d40
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      src/RequestGroup.cc

+ 9 - 1
src/RequestGroup.cc

@@ -228,7 +228,15 @@ SharedHandle<CheckIntegrityEntry> RequestGroup::createCheckIntegrityEntry()
     // infoFile exists.
     loadAndOpenFile(infoFile);
     checkEntry.reset(new StreamCheckIntegrityEntry(this));
-  } else if(isPreLocalFileCheckEnabled() && infoFile->exists()) {
+  } else if(isPreLocalFileCheckEnabled() &&
+            (infoFile->exists() ||
+             (File(getFirstFilePath()).exists() &&
+              option_->getAsBool(PREF_CONTINUE)))) {
+    // If infoFile exists or -c option is given, we need to check
+    // download has been completed (which is determined after
+    // loadAndOpenFile()). If so, use ChecksumCheckIntegrityEntry when
+    // verification is enabled, because CreateRequestCommand does not
+    // issue checksum verification and download fails without it.
     loadAndOpenFile(infoFile);
     if(downloadFinished()) {
 #ifdef ENABLE_MESSAGE_DIGEST