From 421ae13d4084932f2504720eefdd8e6ed1cbffdc Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 3 Mar 2013 17:11:38 +0900 Subject: [PATCH] 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. --- src/RequestGroup.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index 02639f0f7..1491981db 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -228,7 +228,15 @@ SharedHandle 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