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)
This commit is contained in:
JockLee authored and eycorsican committed 2026-02-19 12:40:54 +08:00
1 parent 5c33e7fd82
commit 742fa073cd
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -113,7 +113,7 @@ pub fn get_default_interface() -> Result<String> {
pub fn add_interface_ipv4_address(
name: &str,
addr: Ipv4Addr,
gw: Ipv4Addr,
_gw: Ipv4Addr,
mask: Ipv4Addr,
) -> Result<()> {
Command::new("ip")
+1 -1
View File
@@ -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))
}
}