浏览代码

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