mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 10:15:31 +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){
|
pub fn clean_connections_and_torrents(state: &State){
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
let mut connections = state.connections.lock();
|
{
|
||||||
|
let mut connections = state.connections.lock();
|
||||||
|
|
||||||
connections.retain(|_, v| v.0 > now);
|
connections.retain(|_, v| v.0 > now);
|
||||||
connections.shrink_to_fit();
|
connections.shrink_to_fit();
|
||||||
|
}
|
||||||
::std::mem::drop(connections);
|
|
||||||
|
|
||||||
let mut torrents = state.torrents.lock();
|
let mut torrents = state.torrents.lock();
|
||||||
|
|
||||||
|
|
@ -101,24 +101,24 @@ pub fn gather_and_print_statistics(
|
||||||
|
|
||||||
let mut peers_per_torrent = Histogram::new();
|
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(){
|
for torrent in torrents.ipv4.values(){
|
||||||
let num_peers = (torrent.num_seeders + torrent.num_leechers) as u64;
|
let num_peers = (torrent.num_seeders + torrent.num_leechers) as u64;
|
||||||
|
|
||||||
if let Err(err) = peers_per_torrent.increment(num_peers){
|
if let Err(err) = peers_per_torrent.increment(num_peers){
|
||||||
eprintln!("error incrementing peers_per_torrent histogram: {}", err)
|
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 {
|
if peers_per_torrent.entries() != 0 {
|
||||||
println!(
|
println!(
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ impl Connection {
|
||||||
|
|
||||||
connections.insert(*token_counter, connection);
|
connections.insert(*token_counter, connection);
|
||||||
|
|
||||||
*token_counter = *token_counter + 1;
|
*token_counter += 1;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue