From db65eaa8244603e5ef7c5fbc60add10e41a5477a Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 29 Jul 2026 20:12:29 +0800 Subject: [PATCH] fix(net): make udp batch cfgs match the bsd module routing for tvos/watchos `net/sys/unix/bsd/mod.rs` already routes macos, ios, watchos and tvos to `bsd/macos.rs`, and that module unconditionally imports `net::udp::{BatchRecvMessage, BatchSendMessage}`. But the nine cfg gates in `net/udp.rs` list only macos and ios among the Apple platforms, so on watchos and tvos those items are configured out while the importer is still compiled -- E0432, the crate does not build. Add watchos and tvos to the nine gates so the two lists agree. --- crates/shadowsocks/src/net/udp.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/shadowsocks/src/net/udp.rs b/crates/shadowsocks/src/net/udp.rs index 2bd6509e..d24afa48 100644 --- a/crates/shadowsocks/src/net/udp.rs +++ b/crates/shadowsocks/src/net/udp.rs @@ -5,6 +5,8 @@ target_os = "android", target_os = "macos", target_os = "ios", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] use std::io::{ErrorKind, IoSlice, IoSliceMut}; @@ -20,6 +22,8 @@ use std::{ target_os = "android", target_os = "macos", target_os = "ios", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] use futures::future; @@ -30,6 +34,8 @@ use futures::ready; target_os = "android", target_os = "macos", target_os = "ios", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] use tokio::io::Interest; @@ -48,6 +54,8 @@ use super::{ target_os = "android", target_os = "macos", target_os = "ios", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] pub struct BatchSendMessage<'a> { @@ -65,6 +73,8 @@ pub struct BatchSendMessage<'a> { target_os = "android", target_os = "macos", target_os = "ios", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] pub struct BatchRecvMessage<'a> { @@ -298,6 +308,8 @@ impl UdpSocket { target_os = "android", target_os = "macos", target_os = "ios", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] pub fn poll_batch_send( @@ -327,6 +339,8 @@ impl UdpSocket { target_os = "android", target_os = "macos", target_os = "ios", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] pub async fn batch_send(&self, msgs: &mut [BatchSendMessage<'_>]) -> io::Result { @@ -339,6 +353,8 @@ impl UdpSocket { target_os = "android", target_os = "ios", target_os = "macos", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] pub fn poll_batch_recv( @@ -368,6 +384,8 @@ impl UdpSocket { target_os = "android", target_os = "macos", target_os = "ios", + target_os = "watchos", + target_os = "tvos", target_os = "freebsd" ))] pub async fn batch_recv(&self, msgs: &mut [BatchRecvMessage<'_>]) -> io::Result {