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.
pull/57/head
Tatsuhiro Tsujikawa 2013-03-03 17:11:38 +09:00
parent 841fdbb965
commit 421ae13d40
1 changed files with 9 additions and 1 deletions

View File

@ -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