fix: wrong tier value in torrent get tracker stat response (#5274)

This commit is contained in:
Charles Kerr
2023-03-21 20:23:08 -05:00
committed by GitHub
parent 1b8a1ea64a
commit 25f38d5ff3
2 changed files with 13 additions and 4 deletions

View File

@@ -1733,18 +1733,21 @@ tr_tracker_view tr_announcerTracker(tr_torrent const* tor, size_t nth)
TR_ASSERT(tr_isTorrent(tor));
TR_ASSERT(tor->torrent_announcer != nullptr);
auto i = size_t{ 0 };
auto tier_index = size_t{ 0 };
auto tracker_index = size_t{ 0 };
for (auto const& tier : tor->torrent_announcer->tiers)
{
for (auto const& tracker : tier.trackers)
{
if (i == nth)
if (tracker_index == nth)
{
return trackerView(*tor, i, tier, tracker);
return trackerView(*tor, tier_index, tier, tracker);
}
++i;
++tracker_index;
}
++tier_index;
}
TR_ASSERT(false);