mirror of
https://github.com/transmission/transmission
synced 2024-12-25 17:17:31 +00:00
fix: wrong tier value in torrent get tracker stat response (#5274)
This commit is contained in:
parent
1b8a1ea64a
commit
25f38d5ff3
2 changed files with 13 additions and 4 deletions
|
@ -1733,18 +1733,21 @@ tr_tracker_view tr_announcerTracker(tr_torrent const* tor, size_t nth)
|
||||||
TR_ASSERT(tr_isTorrent(tor));
|
TR_ASSERT(tr_isTorrent(tor));
|
||||||
TR_ASSERT(tor->torrent_announcer != nullptr);
|
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& tier : tor->torrent_announcer->tiers)
|
||||||
{
|
{
|
||||||
for (auto const& tracker : tier.trackers)
|
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);
|
TR_ASSERT(false);
|
||||||
|
|
|
@ -214,8 +214,14 @@ void RpcClient::localSessionCallback(tr_session* s, tr_variant* response, void*
|
||||||
|
|
||||||
auto* self = static_cast<RpcClient*>(vself);
|
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();
|
TrVariantPtr const json = createVariant();
|
||||||
*json = *response;
|
*json = *response;
|
||||||
|
|
||||||
variantInit(response, false);
|
variantInit(response, false);
|
||||||
|
|
||||||
// this callback is invoked in the libtransmission thread, so we don't want
|
// this callback is invoked in the libtransmission thread, so we don't want
|
||||||
|
|
Loading…
Reference in a new issue