Use "additional trackers" when metadata retrieving

This can help when the DHT nodes are few.

PR #18251.
Closes #18244.
This commit is contained in:
Vladimir Golovnev 2022-12-22 08:21:29 +03:00 committed by GitHub
parent aeae065007
commit 594f9e8632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2931,6 +2931,19 @@ bool SessionImpl::downloadMetadata(const MagnetUri &magnetUri)
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
// Preallocation mode
if (isPreallocationEnabled())