refactor: avoid `front()` prior to loop (#7068)

* refactor: avoid `front()` prior to loop

* Update libtransmission/peer-mgr.cc

Co-authored-by: Yat Ho <lagoho7@gmail.com>

---------

Co-authored-by: Yat Ho <lagoho7@gmail.com>
This commit is contained in:
Cœur 2024-08-23 17:34:44 +02:00 committed by GitHub
parent 3e5a77d176
commit 07172d9f4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -1647,7 +1647,7 @@ uint64_t tr_peerMgrGetDesiredAvailable(tr_torrent const* tor)
return 0;
}
auto available = swarm->peers.front()->has();
auto available = tr_bitfield{ tor->piece_count() };
for (auto const* const peer : swarm->peers)
{
available |= peer->has();