From 05320b2093c68850157ae2753ba1810a158a969e Mon Sep 17 00:00:00 2001 From: Wynd Date: Mon, 23 Feb 2026 14:57:08 +0200 Subject: [PATCH] Cargo release profile and small logging changes --- Cargo.toml | 5 +++++ src/main.rs | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6b0da6a..68c5de2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,3 +23,8 @@ clap = { version = "4.5.60", features = ["derive"] } env_logger = "0.11.9" ipnet = "2.11.0" log = "0.4.29" + +[profile.release] +opt-level = "z" +strip = true +lto = true diff --git a/src/main.rs b/src/main.rs index ec63177..0faa37f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,12 +47,12 @@ fn handle_connection( let mut paths = vec![]; let mut buffer = ByteBuffer::default(); - if let Some(allowed_devices) = allowed_devices { - let remote_ip = conn - .peer_addr() - .expect("Could not get remote IP address") - .ip(); + let remote_ip = conn + .peer_addr() + .expect("Could not get remote IP address") + .ip(); + if let Some(allowed_devices) = allowed_devices { for allowed in allowed_devices { let allowed_net = ipnet::IpNet::from_str(&allowed).unwrap(); @@ -66,9 +66,11 @@ fn handle_connection( walk_dir(&export, &mut paths); - log::info!("Sending {} files", paths.len()); + let files_sent = paths.len(); - buffer.write_usize(paths.len()); + log::info!("Sending {files_sent} files to {remote_ip}"); + + buffer.write_usize(files_sent); for file in paths { let mut path = file.replace(&export, ""); @@ -76,7 +78,7 @@ fn handle_connection( path.remove(0); } - log::info!("Sending {path}"); + log::debug!("Sending {path}"); buffer.write_string(&path);