Cargo release profile and small logging changes
parent
28ede25da8
commit
05320b2093
|
|
@ -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
|
||||
|
|
|
|||
10
src/main.rs
10
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();
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue