From d6e5155acf2c7a649785ed9b4a1068cf42d9f244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Thu, 14 Apr 2022 22:23:21 +0200 Subject: [PATCH] udp: rename MAX_PACKET_SIZE to BUFFER_SIZE --- aquatic_udp/src/common.rs | 6 +++--- aquatic_udp/src/workers/socket.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aquatic_udp/src/common.rs b/aquatic_udp/src/common.rs index 2b42542..db7c47c 100644 --- a/aquatic_udp/src/common.rs +++ b/aquatic_udp/src/common.rs @@ -15,7 +15,7 @@ use aquatic_udp_protocol::*; use crate::config::Config; -pub const MAX_PACKET_SIZE: usize = 8192; +pub const BUFFER_SIZE: usize = 8192; /// HMAC (BLAKE3) based ConnectionID creator and validator /// @@ -299,7 +299,7 @@ mod tests { // Assumes that announce response with maximum amount of ipv6 peers will // be the longest #[test] - fn test_max_package_size() { + fn test_buffer_size() { use aquatic_udp_protocol::*; let config = Config::default(); @@ -325,7 +325,7 @@ mod tests { println!("Buffer len: {}", buf.len()); - assert!(buf.len() <= MAX_PACKET_SIZE); + assert!(buf.len() <= BUFFER_SIZE); } #[quickcheck] diff --git a/aquatic_udp/src/workers/socket.rs b/aquatic_udp/src/workers/socket.rs index d3eda3c..b70107c 100644 --- a/aquatic_udp/src/workers/socket.rs +++ b/aquatic_udp/src/workers/socket.rs @@ -140,7 +140,7 @@ pub fn run_socket_worker( response_receiver: Receiver<(ConnectedResponse, CanonicalSocketAddr)>, priv_dropper: PrivilegeDropper, ) { - let mut buffer = [0u8; MAX_PACKET_SIZE]; + let mut buffer = [0u8; BUFFER_SIZE]; let mut socket = UdpSocket::from_std(create_socket(&config, priv_dropper).expect("create socket"));