From 005f0010ec4886434088569a71ac93e4cce70b4e Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Mon, 25 Nov 2019 15:34:37 +0200 Subject: [PATCH 1/2] Revert "Fix unable to remove web seeds" This reverts commit d657c872433aea21a2762880599e9dbee40db9a0. --- src/base/bittorrent/session.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index f306da2a2..2dc11cdd2 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -2055,10 +2055,6 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne , (patchedFastresumeData.constData() + patchedFastresumeData.size())}; p.flags |= lt::add_torrent_params::flag_use_resume_save_path; - // load from .torrent file when fastresume doesn't contain the required `info` dict - if (!patchedFastresumeData.contains("4:infod")) - p.ti = torrentInfo.nativeInfo(); - // Still setup the default parameters and let libtorrent handle // the parameter merging hasCompleteFastresume = false; @@ -2066,10 +2062,6 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne lt::error_code ec; p = lt::read_resume_data(fastresumeData, ec); - // load from .torrent file when fastresume doesn't contain the required `info` dict - if (!p.ti || !p.ti->is_valid()) - p.ti = torrentInfo.nativeInfo(); - // libtorrent will always apply `file_priorities` to torrents, // if the field is present then the fastresume is considered to // be correctly generated and should be complete. @@ -2106,9 +2098,9 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne static_cast(priority)); #endif }); - - p.ti = torrentInfo.nativeInfo(); } + + p.ti = torrentInfo.nativeInfo(); } // Common From 7aa01a1b51c374bac927d8fef8ed2b8080f58a70 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Mon, 25 Nov 2019 15:35:06 +0200 Subject: [PATCH 2/2] Revert "Always save info dict when saving fastresume" This reverts commit 4aab44e779833039be7d17ae541203918dbb18fd. --- src/base/bittorrent/session.cpp | 5 ----- src/base/bittorrent/torrenthandle.cpp | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 2dc11cdd2..90c3327e3 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -3852,11 +3852,6 @@ void Session::startUpTorrents() int resumedTorrentsCount = 0; const auto startupTorrent = [this, &resumeDataDir, &resumedTorrentsCount](const TorrentResumeData ¶ms) { - // TODO: Remove loading of .torrent files when starting up existing torrents - // Starting from v4.2.0, the required `info` dict will be stored in fastresume too - // (besides .torrent file), that means we can remove loading of .torrent files in - // a later release, such as v4.3.0. - const QString filePath = resumeDataDir.filePath(QString("%1.torrent").arg(params.hash)); qDebug() << "Starting up torrent" << params.hash << "..."; if (!addTorrent_impl(params.addTorrentData, params.magnetUri, TorrentInfo::loadFromFile(filePath), params.data)) diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 67e728a80..1cdaa59ef 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -569,7 +569,7 @@ bool TorrentHandle::needSaveResumeData() const void TorrentHandle::saveResumeData() { - m_nativeHandle.save_resume_data(lt::torrent_handle::save_info_dict); + m_nativeHandle.save_resume_data(); m_session->handleTorrentSaveResumeDataRequested(this); }