Browse Source

Fix unable to remove web seeds

As suggested in post [1] we don't need to assign the `ti` field anymore when fastresme
already contains the `info` dict.

[1]: https://github.com/arvidn/libtorrent/issues/3946#issuecomment-523300003
adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
d657c87243
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 12
      src/base/bittorrent/session.cpp

12
src/base/bittorrent/session.cpp

@ -1929,6 +1929,10 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne @@ -1929,6 +1929,10 @@ 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;
@ -1936,6 +1940,10 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne @@ -1936,6 +1940,10 @@ 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->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.
@ -1972,9 +1980,9 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne @@ -1972,9 +1980,9 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne
static_cast<lt::download_priority_t::underlying_type>(priority));
#endif
});
}
p.ti = torrentInfo.nativeInfo();
p.ti = torrentInfo.nativeInfo();
}
}
// Common

Loading…
Cancel
Save