From 742fa073cdfd72a3487dae0f6e703478ddcf26f2 Mon Sep 17 00:00:00 2001 From: JockLee <5155291+webees@users.noreply.github.com> Date: Wed, 11 Feb 2026 15:14:56 +0800 Subject: [PATCH] fix: resolve compilation warnings on Rust 1.93+ - Replace deprecated `TcpStream::set_linger()` with `SockRef::from().set_linger()` (tokio deprecated the method as SO_LINGER can block the thread on drop) - Prefix unused parameter `gw` with underscore in `add_interface_ipv4_address()` (the gateway param is unused on Linux as `ip addr add` does not accept it) --- leaf/src/common/cmd_linux.rs | 2 +- leaf/src/proxy/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/leaf/src/common/cmd_linux.rs b/leaf/src/common/cmd_linux.rs index 83281eb..cc9b769 100644 --- a/leaf/src/common/cmd_linux.rs +++ b/leaf/src/common/cmd_linux.rs @@ -113,7 +113,7 @@ pub fn get_default_interface() -> Result { pub fn add_interface_ipv4_address( name: &str, addr: Ipv4Addr, - gw: Ipv4Addr, + _gw: Ipv4Addr, mask: Ipv4Addr, ) -> Result<()> { Command::new("ip") diff --git a/leaf/src/proxy/mod.rs b/leaf/src/proxy/mod.rs index fa2db33..42ca5eb 100644 --- a/leaf/src/proxy/mod.rs +++ b/leaf/src/proxy/mod.rs @@ -191,7 +191,7 @@ impl TcpListener { pub async fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> { let (stream, addr) = self.inner.accept().await?; apply_socket_opts(&stream)?; - stream.set_linger(Some(Duration::ZERO))?; + SockRef::from(&stream).set_linger(Some(Duration::ZERO))?; Ok((stream, addr)) } }