mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03: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
9b267690cc
commit
1b0fd45643
1 changed files with 7 additions and 6 deletions
|
@ -72,11 +72,14 @@ namespace
|
||||||
return scheme;
|
return scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
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())
|
||||||
|
@ -388,10 +391,8 @@ void TrackerFiltersList::addItem(const QString &tracker, const BitTorrent::Torre
|
||||||
void TrackerFiltersList::removeItem(const QString &tracker, const BitTorrent::TorrentID &id)
|
void TrackerFiltersList::removeItem(const QString &tracker, const BitTorrent::TorrentID &id)
|
||||||
{
|
{
|
||||||
const QString host = getHost(tracker);
|
const QString host = getHost(tracker);
|
||||||
QSet<BitTorrent::TorrentID> torrentIDs = m_trackers.value(host);
|
|
||||||
|
|
||||||
if (torrentIDs.empty())
|
QSet<BitTorrent::TorrentID> torrentIDs = m_trackers.value(host);
|
||||||
return;
|
|
||||||
torrentIDs.remove(id);
|
torrentIDs.remove(id);
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
Loading…
Reference in a new issue