/* */ #include "TorrentDownloadEngine.h" void TorrentDownloadEngine::onEndOfRun() { torrentMan->diskWriter->closeFile(); if(filenameFixed && torrentMan->downloadComplete()) { torrentMan->remove(); } else { torrentMan->save(); } } void TorrentDownloadEngine::afterEachIteration() { if(!filenameFixed && torrentMan->downloadComplete()) { torrentMan->diskWriter->closeFile(); torrentMan->save(); torrentMan->fixFilename(); filenameFixed = true; torrentMan->diskWriter->openExistingFile(torrentMan->getTempFilePath()); } }