From c02d7f211307d5e5eb880ba16253ffe6cec5ac22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 16 Oct 2021 01:47:10 +0200 Subject: [PATCH] aquatic_ws: run rustfmt --- aquatic_ws/src/lib/common.rs | 7 +------ aquatic_ws/src/lib/handler.rs | 4 ++-- aquatic_ws_load_test/src/network.rs | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/aquatic_ws/src/lib/common.rs b/aquatic_ws/src/lib/common.rs index 074a415..dcaa96f 100644 --- a/aquatic_ws/src/lib/common.rs +++ b/aquatic_ws/src/lib/common.rs @@ -95,11 +95,7 @@ impl TorrentMaps { Self::clean_torrent_map(config, &self.access_list, &mut self.ipv6); } - fn clean_torrent_map( - config: &Config, - access_list: &AccessList, - torrent_map: &mut TorrentMap - ) { + fn clean_torrent_map(config: &Config, access_list: &AccessList, torrent_map: &mut TorrentMap) { let now = Instant::now(); torrent_map.retain(|info_hash, torrent_data| { @@ -133,7 +129,6 @@ impl TorrentMaps { torrent_map.shrink_to_fit(); } - } #[derive(Clone)] diff --git a/aquatic_ws/src/lib/handler.rs b/aquatic_ws/src/lib/handler.rs index 4fe1685..d862926 100644 --- a/aquatic_ws/src/lib/handler.rs +++ b/aquatic_ws/src/lib/handler.rs @@ -102,14 +102,14 @@ pub fn handle_announce_requests( let info_hash_allowed = torrent_maps .access_list .allows(config.access_list.mode, &request.info_hash.0); - + if !info_hash_allowed { let response = OutMessage::ErrorResponse(ErrorResponse { failure_reason: "Info hash not allowed".into(), action: Some(ErrorResponseAction::Announce), info_hash: Some(request.info_hash), }); - + out_message_sender.send(request_sender_meta, response); wake_socket_workers[request_sender_meta.worker_index] = true; diff --git a/aquatic_ws_load_test/src/network.rs b/aquatic_ws_load_test/src/network.rs index 38c8713..0a6cf8c 100644 --- a/aquatic_ws_load_test/src/network.rs +++ b/aquatic_ws_load_test/src/network.rs @@ -156,11 +156,11 @@ impl Connection { .statistics .responses_error .fetch_add(1, Ordering::SeqCst); - + eprintln!("received error response: {:?}", response.failure_reason); self.can_send = true; - }, + } Err(err) => { eprintln!("error deserializing offer: {:?}", err); }