/* */ #include "PieceHashCheckIntegrityEntry.h" #include "RequestGroup.h" #include "IteratableChunkChecksumValidator.h" #include "DownloadContext.h" #include "PieceStorage.h" #include "a2functional.h" namespace aria2 { PieceHashCheckIntegrityEntry::PieceHashCheckIntegrityEntry (RequestGroup* requestGroup, std::unique_ptr nextCommand) : CheckIntegrityEntry{requestGroup, std::move(nextCommand)} {} PieceHashCheckIntegrityEntry::~PieceHashCheckIntegrityEntry() {} bool PieceHashCheckIntegrityEntry::isValidationReady() { const std::shared_ptr& dctx = getRequestGroup()->getDownloadContext(); return dctx->isPieceHashVerificationAvailable(); } void PieceHashCheckIntegrityEntry::initValidator() { #ifdef ENABLE_MESSAGE_DIGEST auto validator = make_unique (getRequestGroup()->getDownloadContext(), getRequestGroup()->getPieceStorage()); validator->init(); setValidator(std::move(validator)); #endif // ENABLE_MESSAGE_DIGEST } } // namespace aria2