Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: wrong tier value in torrent get tracker stat response (#5274)
  • Loading branch information
ckerr committed Mar 22, 2023
1 parent 1b8a1ea commit 25f38d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 7 additions & 4 deletions libtransmission/announcer.cc
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions qt/RpcClient.cc
Expand Up @@ -214,8 +214,14 @@ void RpcClient::localSessionCallback(tr_session* s, tr_variant* response, void*

auto* self = static_cast<RpcClient*>(vself);

if (self->verbose_)
{
fmt::print("{:s}:{:d} got response:\n{:s}\n", __FILE__, __LINE__, tr_variantToStr(response, TR_VARIANT_FMT_JSON));
}

TrVariantPtr const json = createVariant();
*json = *response;

variantInit(response, false);

// this callback is invoked in the libtransmission thread, so we don't want
Expand Down

0 comments on commit 25f38d5

Please sign in to comment.