/* */ #include "BtCheckIntegrityEntry.h" #include "BtFileAllocationEntry.h" #include "RequestGroup.h" #include "PieceStorage.h" #include "DownloadEngine.h" #include "DiskAdaptor.h" #include "prefs.h" #include "Option.h" namespace aria2 { BtCheckIntegrityEntry::BtCheckIntegrityEntry(RequestGroup* requestGroup): PieceHashCheckIntegrityEntry(requestGroup, 0) {} BtCheckIntegrityEntry::~BtCheckIntegrityEntry() {} void BtCheckIntegrityEntry::onDownloadIncomplete(std::deque& commands, DownloadEngine* e) { // Now reopen DiskAdaptor with read only disabled. _requestGroup->getPieceStorage()->getDiskAdaptor()->closeFile(); _requestGroup->getPieceStorage()->getDiskAdaptor()->disableReadOnly(); _requestGroup->getPieceStorage()->getDiskAdaptor()->openFile(); SharedHandle entry (new BtFileAllocationEntry(_requestGroup)); proceedFileAllocation(commands, entry, e); } void BtCheckIntegrityEntry::onDownloadFinished(std::deque& commands, 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. if(e->option->getAsBool(PREF_BT_HASH_CHECK_SEED)) { SharedHandle entry (new BtFileAllocationEntry(_requestGroup)); proceedFileAllocation(commands, entry, e); } } } // namespace aria2