Browse Source

Use "additional trackers" when metadata retrieving

This can help when the DHT nodes are few.

PR #18251.
Closes #18244.
adaptive-webui-19844
Vladimir Golovnev 2 years ago committed by GitHub
parent
commit
594f9e8632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/base/bittorrent/sessionimpl.cpp

13
src/base/bittorrent/sessionimpl.cpp

@ -2931,6 +2931,19 @@ bool SessionImpl::downloadMetadata(const MagnetUri &magnetUri)
lt::add_torrent_params p = magnetUri.addTorrentParams(); lt::add_torrent_params p = magnetUri.addTorrentParams();
if (isAddTrackersEnabled())
{
// Use "additional trackers" when metadata retrieving (this can help when the DHT nodes are few)
p.trackers.reserve(p.trackers.size() + static_cast<std::size_t>(m_additionalTrackerList.size()));
p.tracker_tiers.reserve(p.trackers.size() + static_cast<std::size_t>(m_additionalTrackerList.size()));
p.tracker_tiers.resize(p.trackers.size(), 0);
for (const TrackerEntry &trackerEntry : asConst(m_additionalTrackerList))
{
p.trackers.push_back(trackerEntry.url.toStdString());
p.tracker_tiers.push_back(trackerEntry.tier);
}
}
// Flags // Flags
// Preallocation mode // Preallocation mode
if (isPreallocationEnabled()) if (isPreallocationEnabled())

Loading…
Cancel
Save