1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);

View file

@ -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