mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
udp, ws load test: fix clippy errors
This commit is contained in:
parent
d92b11191a
commit
c202d9ba41
2 changed files with 20 additions and 20 deletions
|
|
@ -10,12 +10,12 @@ use crate::config::Config;
|
|||
pub fn clean_connections_and_torrents(state: &State){
|
||||
let now = Instant::now();
|
||||
|
||||
let mut connections = state.connections.lock();
|
||||
{
|
||||
let mut connections = state.connections.lock();
|
||||
|
||||
connections.retain(|_, v| v.0 > now);
|
||||
connections.shrink_to_fit();
|
||||
|
||||
::std::mem::drop(connections);
|
||||
connections.retain(|_, v| v.0 > now);
|
||||
connections.shrink_to_fit();
|
||||
}
|
||||
|
||||
let mut torrents = state.torrents.lock();
|
||||
|
||||
|
|
@ -101,24 +101,24 @@ pub fn gather_and_print_statistics(
|
|||
|
||||
let mut peers_per_torrent = Histogram::new();
|
||||
|
||||
let torrents = &mut state.torrents.lock();
|
||||
{
|
||||
let torrents = &mut state.torrents.lock();
|
||||
|
||||
for torrent in torrents.ipv4.values(){
|
||||
let num_peers = (torrent.num_seeders + torrent.num_leechers) as u64;
|
||||
for torrent in torrents.ipv4.values(){
|
||||
let num_peers = (torrent.num_seeders + torrent.num_leechers) as u64;
|
||||
|
||||
if let Err(err) = peers_per_torrent.increment(num_peers){
|
||||
eprintln!("error incrementing peers_per_torrent histogram: {}", err)
|
||||
if let Err(err) = peers_per_torrent.increment(num_peers){
|
||||
eprintln!("error incrementing peers_per_torrent histogram: {}", err)
|
||||
}
|
||||
}
|
||||
for torrent in torrents.ipv6.values(){
|
||||
let num_peers = (torrent.num_seeders + torrent.num_leechers) as u64;
|
||||
|
||||
if let Err(err) = peers_per_torrent.increment(num_peers){
|
||||
eprintln!("error incrementing peers_per_torrent histogram: {}", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for torrent in torrents.ipv6.values(){
|
||||
let num_peers = (torrent.num_seeders + torrent.num_leechers) as u64;
|
||||
|
||||
if let Err(err) = peers_per_torrent.increment(num_peers){
|
||||
eprintln!("error incrementing peers_per_torrent histogram: {}", err)
|
||||
}
|
||||
}
|
||||
|
||||
::std::mem::drop(torrents);
|
||||
|
||||
if peers_per_torrent.entries() != 0 {
|
||||
println!(
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ impl Connection {
|
|||
|
||||
connections.insert(*token_counter, connection);
|
||||
|
||||
*token_counter = *token_counter + 1;
|
||||
*token_counter += 1;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue