/* */ #include "CheckIntegrityEntry.h" #include "IteratableValidator.h" #include "RequestGroup.h" #include "PieceStorage.h" #include "DiskAdaptor.h" #include "prefs.h" #include "FileAllocationEntry.h" #include "DownloadEngine.h" #include "Option.h" #include "DownloadContext.h" #include "RequestGroupMan.h" #include "ServerStatMan.h" namespace aria2 { CheckIntegrityEntry::CheckIntegrityEntry(RequestGroup* requestGroup, Command* nextCommand): RequestGroupEntry(requestGroup, nextCommand) {} CheckIntegrityEntry::~CheckIntegrityEntry() {} void CheckIntegrityEntry::validateChunk() { validator_->validateChunk(); } uint64_t CheckIntegrityEntry::getTotalLength() { if(validator_.isNull()) { return 0; } else { return validator_->getTotalLength(); } } off_t CheckIntegrityEntry::getCurrentLength() { if(validator_.isNull()) { return 0; } else { return validator_->getCurrentOffset(); } } bool CheckIntegrityEntry::finished() { return validator_->finished(); } void CheckIntegrityEntry::cutTrailingGarbage() { getRequestGroup()->getPieceStorage()->getDiskAdaptor()->cutTrailingGarbage(); } void CheckIntegrityEntry::proceedFileAllocation (std::vector& commands, const SharedHandle& entry, DownloadEngine* e) { if(getRequestGroup()->needsFileAllocation()) { e->getFileAllocationMan()->pushEntry(entry); } else { entry->prepareForNextAction(commands, e); } // Disable directIO when fallocation() is going to be used. if(getRequestGroup()->getOption()->get(PREF_FILE_ALLOCATION) == V_FALLOC) { entry->disableDirectIO(); } } void CheckIntegrityEntry::setValidator (const SharedHandle& validator) { validator_ = validator; } } // namespace aria2