diff --git a/libtransmission/peer-mgr.cc b/libtransmission/peer-mgr.cc index e2330be64..2b17315e5 100644 --- a/libtransmission/peer-mgr.cc +++ b/libtransmission/peer-mgr.cc @@ -2511,12 +2511,17 @@ namespace bandwidth_helpers { void pumpAllPeers(tr_peerMgr* mgr) { + auto peers = small::vector{}; for (auto* const tor : mgr->torrents_) { - for (auto const& peer : tor->swarm->peers) - { - peer->pulse(); - } + std::ranges::transform(tor->swarm->peers, std::back_inserter(peers), [](auto const& p) { return p.get(); }); + } + + thread_local auto urbg = tr_urbg{}; + std::ranges::shuffle(peers, urbg); + for (auto const& peer : peers) + { + peer->pulse(); } } } // namespace bandwidth_helpers