From fb9d7030075a4e49470718a1385e33ae5753075e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Mon, 4 Jul 2022 08:52:58 +0200 Subject: [PATCH] udp: improve variable naming in read_requests --- aquatic_udp/src/workers/socket/requests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aquatic_udp/src/workers/socket/requests.rs b/aquatic_udp/src/workers/socket/requests.rs index c861134..779f080 100644 --- a/aquatic_udp/src/workers/socket/requests.rs +++ b/aquatic_udp/src/workers/socket/requests.rs @@ -31,7 +31,7 @@ pub fn read_requests( loop { match socket.recv_from(&mut buffer[..]) { - Ok((amt, src)) => { + Ok((bytes_read, src)) => { if src.port() == 0 { ::log::info!("Ignored request from {} because source port is zero", src); @@ -39,7 +39,7 @@ pub fn read_requests( } let res_request = - Request::from_bytes(&buffer[..amt], config.protocol.max_scrape_torrents); + Request::from_bytes(&buffer[..bytes_read], config.protocol.max_scrape_torrents); let src = CanonicalSocketAddr::new(src); @@ -48,12 +48,12 @@ pub fn read_requests( if res_request.is_ok() { requests_received_ipv4 += 1; } - bytes_received_ipv4 += amt; + bytes_received_ipv4 += bytes_read; } else { if res_request.is_ok() { requests_received_ipv6 += 1; } - bytes_received_ipv6 += amt; + bytes_received_ipv6 += bytes_read; } handle_request(