/* */ #include "PieceHashCheckIntegrityEntry.h" #include "RequestGroup.h" #include "IteratableChunkChecksumValidator.h" #include "DownloadContext.h" #include "PieceStorage.h" namespace aria2 { PieceHashCheckIntegrityEntry::PieceHashCheckIntegrityEntry(RequestGroup* requestGroup, Command* nextCommand): CheckIntegrityEntry(requestGroup, nextCommand) {} PieceHashCheckIntegrityEntry::~PieceHashCheckIntegrityEntry() {} bool PieceHashCheckIntegrityEntry::isValidationReady() { const SharedHandle& dctx = _requestGroup->getDownloadContext(); return !dctx->getPieceHashAlgo().empty() && dctx->getPieceHashes().size() > 0 && dctx->getPieceHashes().size() == dctx->getNumPieces(); } void PieceHashCheckIntegrityEntry::initValidator() { #ifdef ENABLE_MESSAGE_DIGEST IteratableChunkChecksumValidatorHandle validator (new IteratableChunkChecksumValidator(_requestGroup->getDownloadContext(), _requestGroup->getPieceStorage())); validator->init(); _validator = validator; #endif // ENABLE_MESSAGE_DIGEST } } // namespace aria2