/* */ #include "ChecksumCheckIntegrityEntry.h" #include "RequestGroup.h" #include "DownloadContext.h" #include "FileEntry.h" #include "IteratableChecksumValidator.h" #include "DownloadEngine.h" #include "PieceStorage.h" #include "FileAllocationEntry.h" #include "StreamFileAllocationEntry.h" namespace aria2 { ChecksumCheckIntegrityEntry::ChecksumCheckIntegrityEntry (RequestGroup* requestGroup, std::unique_ptr nextCommand) : CheckIntegrityEntry{requestGroup, std::move(nextCommand)}, redownload_{false} {} ChecksumCheckIntegrityEntry::~ChecksumCheckIntegrityEntry() {} bool ChecksumCheckIntegrityEntry::isValidationReady() { const std::shared_ptr& dctx = getRequestGroup()->getDownloadContext(); return dctx->isChecksumVerificationAvailable(); } void ChecksumCheckIntegrityEntry::initValidator() { auto validator = make_unique (getRequestGroup()->getDownloadContext(), getRequestGroup()->getPieceStorage()); validator->init(); setValidator(std::move(validator)); } void ChecksumCheckIntegrityEntry::onDownloadFinished (std::vector>& commands, DownloadEngine* e) {} void ChecksumCheckIntegrityEntry::onDownloadIncomplete (std::vector>& commands, DownloadEngine* e) { if(redownload_) { proceedFileAllocation(commands, make_unique (getRequestGroup(), popNextCommand()), e); } } } // namespace aria2