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