diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index c766b3c0f..cece6fcb2 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -186,12 +186,8 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) { trackersErrors.remove(hash); // Remove it from ratio table ratioData.remove(hash); - int index = fullAllocationModeList.indexOf(hash); - if(index != -1) { - fullAllocationModeList.removeAt(index); - } // Remove it from pausedTorrents list - index = pausedTorrents.indexOf(hash); + int index = pausedTorrents.indexOf(hash); if(index != -1) { pausedTorrents.removeAt(index); } @@ -424,10 +420,6 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) { // Adding files to bittorrent session if(has_filtered_files(hash)) { h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false, true); - int index = fullAllocationModeList.indexOf(hash); - if(index == -1) { - fullAllocationModeList << hash; - } qDebug(" -> Full allocation mode"); }else{ h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, true, true); @@ -1109,10 +1101,6 @@ void bittorrent::reloadTorrent(const QTorrentHandle &h) { QString fileName = h.name(); QString hash = h.hash(); torrent_info t = h.get_torrent_info(); - int index = fullAllocationModeList.indexOf(hash); - if(index == -1) { - fullAllocationModeList << hash; - } qDebug("Reloading torrent: %s", fileName.toUtf8().data()); entry resumeData; // Checking if torrentBackup Dir exists @@ -1169,12 +1157,6 @@ session_status bittorrent::getSessionStatus() const{ return s->status(); } -bool bittorrent::inFullAllocationMode(QString hash) const{ - if(fullAllocationModeList.indexOf(hash) != -1) - return true; - return false; -} - QString bittorrent::getSavePath(QString hash) { QFile savepath_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".savepath"); QByteArray line; diff --git a/src/bittorrent.h b/src/bittorrent.h index c96e43399..006b30b6b 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -53,7 +53,6 @@ class bittorrent : public QObject{ QHash ETAs; QHash > ratioData; QTimer *ETARefresher; - QStringList fullAllocationModeList; QHash > > trackersErrors; deleteThread *deleter; QStringList pausedTorrents; @@ -77,7 +76,6 @@ class bittorrent : public QObject{ int getListenPort() const; QStringList getTorrentsToPauseAfterChecking() const; long getETA(QString hash) const; - bool inFullAllocationMode(QString hash) const; float getRealRatio(QString hash) const; session* getSession() const; QList > getTrackersErrors(QString hash) const; diff --git a/src/properties_imp.cpp b/src/properties_imp.cpp index e2319b5e7..49cef70ae 100644 --- a/src/properties_imp.cpp +++ b/src/properties_imp.cpp @@ -589,10 +589,12 @@ void properties::savePiecesPriorities(){ pieces_file.write(misc::toQByteArray(priority)+"\n"); } pieces_file.close(); - if(hasFilteredFiles && !BTSession->inFullAllocationMode(hash)){ + // If h.has_filtered_pieces() s true, then the torrent + // is already in full allocation mode, no need to + // reload it. + if(hasFilteredFiles && !h.has_filtered_pieces()){ BTSession->pauseAndReloadTorrent(h); } - BTSession->loadFilesPriorities(h); emit filteredFilesChanged(hash); has_filtered_files = hasFilteredFiles; } diff --git a/src/qtorrenthandle.cpp b/src/qtorrenthandle.cpp index b8272f2fa..fd7b73710 100644 --- a/src/qtorrenthandle.cpp +++ b/src/qtorrenthandle.cpp @@ -131,7 +131,7 @@ size_type QTorrentHandle::actual_size() const{ Q_ASSERT(h.is_valid()); size_type size = 0; std::vector piece_priorities = h.piece_priorities(); - for(unsigned int i = 0; i piece_priorities = h.piece_priorities(); + for(unsigned int i = 0; i