/* */ #include "BtCheckIntegrityEntry.h" #include "BtFileAllocationEntry.h" #include "RequestGroup.h" #include "PieceStorage.h" #include "DownloadEngine.h" #include "FileAllocationMan.h" #include "DiskAdaptor.h" namespace aria2 { BtCheckIntegrityEntry::BtCheckIntegrityEntry(RequestGroup* requestGroup): PieceHashCheckIntegrityEntry(requestGroup, 0) {} BtCheckIntegrityEntry::~BtCheckIntegrityEntry() {} Commands BtCheckIntegrityEntry::onDownloadIncomplete(DownloadEngine* e) { Commands commands; FileAllocationEntryHandle entry(new BtFileAllocationEntry(_requestGroup)); if(_requestGroup->needsFileAllocation()) { e->_fileAllocationMan->pushFileAllocationEntry(entry); } else { commands = entry->prepareForNextAction(e); } return commands; } Commands BtCheckIntegrityEntry::onDownloadFinished(DownloadEngine* e) { _requestGroup->getPieceStorage()->getDiskAdaptor()->onDownloadComplete(); // TODO Currently,when all the checksums // are valid, then aira2 goes to seeding mode. Sometimes it is better // to exit rather than doing seeding. So, it would be good to toggle this // behavior. return onDownloadIncomplete(e); } } // namespace aria2