From a03006a753486e64717d6e3afa91e0c6d043c557 Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Fri, 25 Oct 2024 00:53:47 +0800 Subject: [PATCH] chore: fix build warning for Windows --- crates/shadowsocks-service/src/local/redir/sys/mod.rs | 2 +- crates/shadowsocks-service/src/server/udprelay.rs | 2 -- crates/shadowsocks/src/net/sys/mod.rs | 2 +- src/service/local.rs | 5 +++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/shadowsocks-service/src/local/redir/sys/mod.rs b/crates/shadowsocks-service/src/local/redir/sys/mod.rs index 5438fd2b339f..64a290d1b8bd 100644 --- a/crates/shadowsocks-service/src/local/redir/sys/mod.rs +++ b/crates/shadowsocks-service/src/local/redir/sys/mod.rs @@ -36,6 +36,6 @@ where let handle = socket.as_raw_socket(); let sock = unsafe { Socket::from_raw_socket(handle) }; let result = sock.set_only_v6(ipv6_only); - sock.into_raw_socket(); + let _ = sock.into_raw_socket(); result } diff --git a/crates/shadowsocks-service/src/server/udprelay.rs b/crates/shadowsocks-service/src/server/udprelay.rs index 5d64343b3f70..e6835454bd2d 100644 --- a/crates/shadowsocks-service/src/server/udprelay.rs +++ b/crates/shadowsocks-service/src/server/udprelay.rs @@ -28,8 +28,6 @@ use shadowsocks::{ ServerConfig, }; use tokio::{runtime::Handle, sync::mpsc, task::JoinHandle, time}; -#[cfg(windows)] -use windows_sys::Win32::Networking::WinSock::WSAEAFNOSUPPORT; use crate::net::{ packet_window::PacketWindowFilter, utils::to_ipv4_mapped, MonProxySocket, UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE, diff --git a/crates/shadowsocks/src/net/sys/mod.rs b/crates/shadowsocks/src/net/sys/mod.rs index b36033a79781..6540508e951c 100644 --- a/crates/shadowsocks/src/net/sys/mod.rs +++ b/crates/shadowsocks/src/net/sys/mod.rs @@ -87,7 +87,7 @@ where let sock = unsafe { Socket::from_raw_socket(handle) }; let result = socket_bind_dual_stack_inner(&sock, addr, ipv6_only); - sock.into_raw_socket(); + let _ = sock.into_raw_socket(); result } diff --git a/src/service/local.rs b/src/service/local.rs index 50e977d51fca..8e108e70ead9 100644 --- a/src/service/local.rs +++ b/src/service/local.rs @@ -1,11 +1,12 @@ //! Local server launchers +#[cfg(unix)] +use std::sync::Arc; use std::{ future::Future, net::IpAddr, path::PathBuf, process::ExitCode, - sync::Arc, time::{Duration, Instant}, }; @@ -1065,7 +1066,7 @@ struct ServerReloader { } impl ServerReloader { - #[cfg_attr(not(any(unix, feature = "local-online-config")), allow(dead_code))] + #[cfg_attr(not(unix), allow(dead_code))] async fn run_once(&self) -> Result<(), Box> { let start_time = Instant::now();