mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-12 15:57:57 +00:00
Merge pull request #11733 from sledgehammer999/tracker_error_count
Tracker is errored only if all local endpoints fail
This commit is contained in:
commit
45ed31fddc
@ -1693,7 +1693,17 @@ void TorrentHandle::handleTrackerErrorAlert(const lt::tracker_error_alert *p)
|
|||||||
|
|
||||||
m_trackerInfos[trackerUrl].lastMessage = message;
|
m_trackerInfos[trackerUrl].lastMessage = message;
|
||||||
|
|
||||||
m_session->handleTorrentTrackerError(this, trackerUrl);
|
// Starting with libtorrent 1.2.x each tracker has multiple local endpoints from which
|
||||||
|
// an announce is attempted. Some endpoints might succeed while others might fail.
|
||||||
|
// Emit the signal only if all endpoints have failed. TrackerEntry::isWorking() returns
|
||||||
|
// true if at least one endpoint works.
|
||||||
|
const QVector<TrackerEntry> trackerList = trackers();
|
||||||
|
const auto iter = std::find_if(trackerList.cbegin(), trackerList.cend(), [&trackerUrl](const TrackerEntry &entry)
|
||||||
|
{
|
||||||
|
return (entry.url() == trackerUrl);
|
||||||
|
});
|
||||||
|
if ((iter != trackerList.cend()) && !iter->isWorking())
|
||||||
|
m_session->handleTorrentTrackerError(this, trackerUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentHandle::handleTorrentCheckedAlert(const lt::torrent_checked_alert *p)
|
void TorrentHandle::handleTorrentCheckedAlert(const lt::torrent_checked_alert *p)
|
||||||
|
@ -54,9 +54,13 @@ QString TrackerEntry::url() const
|
|||||||
|
|
||||||
bool TrackerEntry::isWorking() const
|
bool TrackerEntry::isWorking() const
|
||||||
{
|
{
|
||||||
|
// lt::announce_entry::is_working() returns
|
||||||
|
// true when the tracker hasn't been tried yet.
|
||||||
#if (LIBTORRENT_VERSION_NUM < 10200)
|
#if (LIBTORRENT_VERSION_NUM < 10200)
|
||||||
return nativeEntry().is_working();
|
return nativeEntry().verified && nativeEntry().is_working();
|
||||||
#else
|
#else
|
||||||
|
if (!nativeEntry().verified)
|
||||||
|
return false;
|
||||||
const auto &endpoints = nativeEntry().endpoints;
|
const auto &endpoints = nativeEntry().endpoints;
|
||||||
return std::any_of(endpoints.begin(), endpoints.end()
|
return std::any_of(endpoints.begin(), endpoints.end()
|
||||||
, [](const lt::announce_endpoint &endpoint)
|
, [](const lt::announce_endpoint &endpoint)
|
||||||
@ -73,9 +77,7 @@ int TrackerEntry::tier() const
|
|||||||
|
|
||||||
TrackerEntry::Status TrackerEntry::status() const
|
TrackerEntry::Status TrackerEntry::status() const
|
||||||
{
|
{
|
||||||
// lt::announce_entry::is_working() returns
|
if (isWorking())
|
||||||
// true when the tracker hasn't been tried yet.
|
|
||||||
if (nativeEntry().verified && isWorking())
|
|
||||||
return Working;
|
return Working;
|
||||||
|
|
||||||
#if (LIBTORRENT_VERSION_NUM < 10200)
|
#if (LIBTORRENT_VERSION_NUM < 10200)
|
||||||
|
Loading…
Reference in New Issue
Block a user