/* */ #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" 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() { _requestGroup->getPieceStorage()->getDiskAdaptor()->cutTrailingGarbage(); } void CheckIntegrityEntry::proceedFileAllocation (std::deque& commands, const SharedHandle& entry, DownloadEngine* e) { if(_requestGroup->needsFileAllocation()) { e->_fileAllocationMan->pushEntry(entry); } else { entry->prepareForNextAction(commands, e); } // Disable directIO when fallocation() is going to be used. if(_requestGroup->getOption()->get(PREF_FILE_ALLOCATION) == V_FALLOC) { entry->disableDirectIO(); } } } // namespace aria2