/* */ #include "TorrentConsoleDownloadEngine.h" #include "Util.h" #include volatile sig_atomic_t btHaltRequested = 0; TorrentConsoleDownloadEngine::TorrentConsoleDownloadEngine() {} TorrentConsoleDownloadEngine::~TorrentConsoleDownloadEngine() {} void TorrentConsoleDownloadEngine::sendStatistics() { printf("\r "); printf("\r"); if(pieceStorage->downloadFinished()) { printf("Download Completed."); } else { printf("%s/%sB %d%% %s D:%.2f", Util::llitos(downloadLength, true).c_str(), Util::llitos(totalLength, true).c_str(), (totalLength == 0 ? 0 : (int)((downloadLength*100)/totalLength)), avgSpeed == 0 ? "-" : Util::secfmt(eta).c_str(), downloadSpeed/1024.0); } printf(" U:%.2f(%s) %d peers", uploadSpeed/1024.0, Util::llitos(uploadLength, true).c_str(), btRuntime->getConnections()); fflush(stdout); } void TorrentConsoleDownloadEngine::afterEachIteration() { if(btHaltRequested) { btRuntime->setHalt(true); } TorrentDownloadEngine::afterEachIteration(); }