mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-13 08:17:57 +00:00
Fix wrong 'tracker error' count
This happens when a torrent contains some tracker URLs that share the same domain. Closes #17808.
This commit is contained in:
parent
21aabfdcb5
commit
6fa4305aba
@ -70,11 +70,14 @@ namespace
|
|||||||
return !scheme.isEmpty() ? scheme : u"http"_qs;
|
return !scheme.isEmpty() ? scheme : u"http"_qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getHost(const QString &tracker)
|
QString getHost(const QString &url)
|
||||||
{
|
{
|
||||||
// We want the domain + tld. Subdomains should be disregarded
|
// We want the domain + tld. Subdomains should be disregarded
|
||||||
const QUrl url {tracker};
|
// If failed to parse the domain or IP address, original input should be returned
|
||||||
const QString host {url.host()};
|
|
||||||
|
const QString host = QUrl(url).host();
|
||||||
|
if (host.isEmpty())
|
||||||
|
return url;
|
||||||
|
|
||||||
// host is in IP format
|
// host is in IP format
|
||||||
if (!QHostAddress(host).isNull())
|
if (!QHostAddress(host).isNull())
|
||||||
@ -505,10 +508,8 @@ void TrackerFiltersList::addItems(const QString &trackerURL, const QVector<BitTo
|
|||||||
void TrackerFiltersList::removeItem(const QString &trackerURL, const BitTorrent::TorrentID &id)
|
void TrackerFiltersList::removeItem(const QString &trackerURL, const BitTorrent::TorrentID &id)
|
||||||
{
|
{
|
||||||
const QString host = getHost(trackerURL);
|
const QString host = getHost(trackerURL);
|
||||||
QSet<BitTorrent::TorrentID> torrentIDs = m_trackers.value(host).torrents;
|
|
||||||
if (torrentIDs.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
QSet<BitTorrent::TorrentID> torrentIDs = m_trackers.value(host).torrents;
|
||||||
torrentIDs.remove(id);
|
torrentIDs.remove(id);
|
||||||
|
|
||||||
QListWidgetItem *trackerItem = nullptr;
|
QListWidgetItem *trackerItem = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user