mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic: handlers: minor syntax and comment improvements
This commit is contained in:
parent
6fca5cd9d5
commit
4127cbc7c9
1 changed files with 5 additions and 7 deletions
|
|
@ -221,14 +221,12 @@ pub fn handle_announce_requests(
|
|||
.or_default();
|
||||
|
||||
let opt_removed_peer_status = if peer_status == PeerStatus::Stopped {
|
||||
torrent_data.peers.remove(&peer_key)
|
||||
.map(|peer| peer.status)
|
||||
torrent_data.peers.remove(&peer_key).map(|peer| peer.status)
|
||||
} else {
|
||||
torrent_data.peers.insert(peer_key, peer)
|
||||
.map(|peer| peer.status)
|
||||
torrent_data.peers.insert(peer_key, peer).map(|peer| peer.status)
|
||||
};
|
||||
|
||||
let max_num_peers_to_take = calc_number_of_peers_to_take(
|
||||
let max_num_peers_to_take = calc_max_num_peers_to_take(
|
||||
config,
|
||||
request.peers_wanted.0
|
||||
);
|
||||
|
|
@ -308,7 +306,7 @@ pub fn handle_scrape_requests(
|
|||
|
||||
/// Extract response peers
|
||||
///
|
||||
/// If there are more peers in map that `number_of_peers_to_take`, do a
|
||||
/// If there are more peers in map than `max_num_peers_to_take`, do a
|
||||
/// half-random selection of peers from first and second halves of map,
|
||||
/// in order to avoid returning too homogeneous peers.
|
||||
///
|
||||
|
|
@ -362,7 +360,7 @@ pub fn extract_response_peers(
|
|||
|
||||
|
||||
#[inline]
|
||||
fn calc_number_of_peers_to_take(
|
||||
fn calc_max_num_peers_to_take(
|
||||
config: &Config,
|
||||
peers_wanted: i32,
|
||||
) -> usize {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue