Skip to content

Commit

Permalink
Remove trackers from previous category when moved to new one
Browse files Browse the repository at this point in the history
  • Loading branch information
glassez committed Oct 30, 2024
1 parent 84d8952 commit 9e22129
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/gui/transferlistfilters/trackersfilterwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,11 @@ void TrackersFilterWidget::handleTrackerStatusesUpdated(const BitTorrent::Torren
{
if (trackerEntryStatus.state == BitTorrent::TrackerEndpointState::Working)
{
// remove tracker from "error" and "tracker error" categories
if (errorHashesIt != m_errors.end())
{
errorHashesIt->remove(trackerEntryStatus.url);
}

if (trackerErrorHashesIt != m_trackerErrors.end())
{
trackerErrorHashesIt->remove(trackerEntryStatus.url);
}

const bool hasNoWarningMessages = std::all_of(trackerEntryStatus.endpoints.cbegin(), trackerEntryStatus.endpoints.cend()
, [](const BitTorrent::TrackerEndpointStatus &endpointEntry)
Expand All @@ -426,12 +422,24 @@ void TrackersFilterWidget::handleTrackerStatusesUpdated(const BitTorrent::Torren
else if ((trackerEntryStatus.state == BitTorrent::TrackerEndpointState::NotWorking)
|| (trackerEntryStatus.state == BitTorrent::TrackerEndpointState::Unreachable))
{
// remove tracker from "tracker error" and "warning" categories
if (warningHashesIt != m_warnings.end())
warningHashesIt->remove(trackerEntryStatus.url);
if (trackerErrorHashesIt != m_trackerErrors.end())
trackerErrorHashesIt->remove(trackerEntryStatus.url);

if (errorHashesIt == m_errors.end())
errorHashesIt = m_errors.insert(id, {});
errorHashesIt->insert(trackerEntryStatus.url);
}
else if (trackerEntryStatus.state == BitTorrent::TrackerEndpointState::TrackerError)
{
// remove tracker from "error" and "warning" categories
if (warningHashesIt != m_warnings.end())
warningHashesIt->remove(trackerEntryStatus.url);
if (errorHashesIt != m_errors.end())
errorHashesIt->remove(trackerEntryStatus.url);

if (trackerErrorHashesIt == m_trackerErrors.end())
trackerErrorHashesIt = m_trackerErrors.insert(id, {});
trackerErrorHashesIt->insert(trackerEntryStatus.url);
Expand Down

0 comments on commit 9e22129

Please sign in to comment.