mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #11104 from Chocobo1/resume
Fix unable to remove web seeds
This commit is contained in:
commit
4363082173
@ -1929,6 +1929,10 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne
|
|||||||
, (patchedFastresumeData.constData() + patchedFastresumeData.size())};
|
, (patchedFastresumeData.constData() + patchedFastresumeData.size())};
|
||||||
p.flags |= lt::add_torrent_params::flag_use_resume_save_path;
|
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
|
// Still setup the default parameters and let libtorrent handle
|
||||||
// the parameter merging
|
// the parameter merging
|
||||||
hasCompleteFastresume = false;
|
hasCompleteFastresume = false;
|
||||||
@ -1936,6 +1940,10 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne
|
|||||||
lt::error_code ec;
|
lt::error_code ec;
|
||||||
p = lt::read_resume_data(fastresumeData, ec);
|
p = lt::read_resume_data(fastresumeData, ec);
|
||||||
|
|
||||||
|
// load from .torrent file when fastresume doesn't contain the required `info` dict
|
||||||
|
if (!p.ti->is_valid())
|
||||||
|
p.ti = torrentInfo.nativeInfo();
|
||||||
|
|
||||||
// libtorrent will always apply `file_priorities` to torrents,
|
// libtorrent will always apply `file_priorities` to torrents,
|
||||||
// if the field is present then the fastresume is considered to
|
// if the field is present then the fastresume is considered to
|
||||||
// be correctly generated and should be complete.
|
// be correctly generated and should be complete.
|
||||||
@ -1972,10 +1980,10 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne
|
|||||||
static_cast<lt::download_priority_t::underlying_type>(priority));
|
static_cast<lt::download_priority_t::underlying_type>(priority));
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
p.ti = torrentInfo.nativeInfo();
|
p.ti = torrentInfo.nativeInfo();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Common
|
// Common
|
||||||
#if (LIBTORRENT_VERSION_NUM < 10200)
|
#if (LIBTORRENT_VERSION_NUM < 10200)
|
||||||
@ -3653,6 +3661,11 @@ void Session::startUpTorrents()
|
|||||||
int resumedTorrentsCount = 0;
|
int resumedTorrentsCount = 0;
|
||||||
const auto startupTorrent = [this, &resumeDataDir, &resumedTorrentsCount](const TorrentResumeData ¶ms)
|
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));
|
const QString filePath = resumeDataDir.filePath(QString("%1.torrent").arg(params.hash));
|
||||||
qDebug() << "Starting up torrent" << params.hash << "...";
|
qDebug() << "Starting up torrent" << params.hash << "...";
|
||||||
if (!addTorrent_impl(params.addTorrentData, params.magnetUri, TorrentInfo::loadFromFile(filePath), params.data))
|
if (!addTorrent_impl(params.addTorrentData, params.magnetUri, TorrentInfo::loadFromFile(filePath), params.data))
|
||||||
|
@ -552,7 +552,7 @@ bool TorrentHandle::needSaveResumeData() const
|
|||||||
|
|
||||||
void TorrentHandle::saveResumeData()
|
void TorrentHandle::saveResumeData()
|
||||||
{
|
{
|
||||||
m_nativeHandle.save_resume_data();
|
m_nativeHandle.save_resume_data(lt::torrent_handle::save_info_dict);
|
||||||
m_session->handleTorrentSaveResumeDataRequested(this);
|
m_session->handleTorrentSaveResumeDataRequested(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user