/* */ #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() { DownloadContextHandle dctx = _requestGroup->getDownloadContext(); return dctx->getPieceHashes().size() > 0 && dctx->getPieceHashes().size() == (uint32_t)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