Skip to content

Commit

Permalink
chore(local): local-redir build warning fixed on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed Oct 17, 2023
1 parent cf8d84b commit 07b2b38
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
26 changes: 13 additions & 13 deletions crates/shadowsocks-service/src/local/redir/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ where
result
}

#[cfg(windows)]
pub fn set_ipv6_only<S>(socket: &S, ipv6_only: bool) -> io::Result<()>
where
S: std::os::windows::io::AsRawSocket,
{
use std::os::windows::io::{FromRawSocket, IntoRawSocket};

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();
result
}
// #[cfg(windows)]
// pub fn set_ipv6_only<S>(socket: &S, ipv6_only: bool) -> io::Result<()>
// where
// S: std::os::windows::io::AsRawSocket,
// {
// use std::os::windows::io::{FromRawSocket, IntoRawSocket};
//
// 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();
// result
// }
1 change: 1 addition & 0 deletions crates/shadowsocks-service/src/local/redir/udprelay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl UdpInboundWrite for UdpRedirInboundWriter {
// then we should always use IPv6 sockets for sending IPv4 packets.
static SUPPORT_IPV6_TRANSPARENT: AtomicBool = AtomicBool::new(true);

#[allow(unused_mut)]
let mut addr = match *remote_addr {
Address::SocketAddress(sa) => {
if SUPPORT_IPV6_TRANSPARENT.load(Ordering::Relaxed) {
Expand Down

0 comments on commit 07b2b38

Please sign in to comment.