mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 02:08:19 +03:00
parent
4f3dbf7f59
commit
a84259dd1a
1 changed files with 3 additions and 0 deletions
|
@ -600,6 +600,9 @@ void TorrentImpl::replaceTrackers(QVector<TrackerEntry> trackers)
|
|||
{
|
||||
// TODO: use std::erase_if() in C++20
|
||||
trackers.erase(std::remove_if(trackers.begin(), trackers.end(), [](const TrackerEntry &entry) { return entry.url.isEmpty(); }), trackers.end());
|
||||
// Filter out duplicate trackers
|
||||
const auto uniqueTrackers = QSet<TrackerEntry>(trackers.cbegin(), trackers.cend());
|
||||
trackers = QVector<TrackerEntry>(uniqueTrackers.cbegin(), uniqueTrackers.cend());
|
||||
std::sort(trackers.begin(), trackers.end()
|
||||
, [](const TrackerEntry &lhs, const TrackerEntry &rhs) { return lhs.tier < rhs.tier; });
|
||||
|
||||
|
|
Loading…
Reference in a new issue