From 0cedfec630c1557aba1fed0dea0fd8c431014fc1 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 9 Dec 2021 20:03:26 -0600 Subject: [PATCH] fixup! refactor: add tr_torrentTrackers() (#2282) (#2294) ensure announcer tracker count is correct --- libtransmission/announcer.cc | 8 ++++++++ libtransmission/announcer.h | 2 ++ libtransmission/torrent.cc | 2 +- libtransmission/torrent.h | 7 ------- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libtransmission/announcer.cc b/libtransmission/announcer.cc index 39517e27c..c69badb52 100644 --- a/libtransmission/announcer.cc +++ b/libtransmission/announcer.cc @@ -1802,6 +1802,14 @@ static tr_tracker_view trackerView(tr_torrent const& tor, int tier_index, tr_tie return view; } +size_t tr_announcerTrackerCount(tr_torrent const* tor) +{ + TR_ASSERT(tr_isTorrent(tor)); + TR_ASSERT(tor->tiers != nullptr); + + return tor->tiers->tracker_count; +} + tr_tracker_view tr_announcerTracker(tr_torrent const* tor, size_t nth) { TR_ASSERT(tr_isTorrent(tor)); diff --git a/libtransmission/announcer.h b/libtransmission/announcer.h index 6959c5f3f..1b047dea2 100644 --- a/libtransmission/announcer.h +++ b/libtransmission/announcer.h @@ -95,6 +95,8 @@ time_t tr_announcerNextManualAnnounce(tr_torrent const*); tr_tracker_view tr_announcerTracker(tr_torrent const* torrent, size_t i); +size_t tr_announcerTrackerCount(tr_torrent const* tor); + /*** **** ***/ diff --git a/libtransmission/torrent.cc b/libtransmission/torrent.cc index 11e8eda38..fc42eec04 100644 --- a/libtransmission/torrent.cc +++ b/libtransmission/torrent.cc @@ -1255,7 +1255,7 @@ tr_tracker_view tr_torrentTracker(tr_torrent const* tor, size_t i) size_t tr_torrentTrackerCount(tr_torrent const* tor) { - return tor->trackerCount(); + return tr_announcerTrackerCount(tor); } /*** diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index bc62488ef..39c7ce30d 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -348,13 +348,6 @@ public: return info.webseeds[i]; } - /// TRACKERS - - auto trackerCount() const - { - return info.trackerCount; - } - /// CHECKSUMS bool ensurePieceIsChecked(tr_piece_index_t piece)