From 6c9f55ea8013bfe2cea5b8c17811f2d46c69b9b3 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 11 Jul 2026 21:37:00 +0000 Subject: [PATCH] transport: rename darwin_sockopts to sockopts_macos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The module is gated target_os="macos" (not the broader Darwin/iOS family), so the name now tracks the cfg and matches the *_macos.rs file convention (io_macos.rs). Drops the redundant inner #![cfg(target_os="macos")] (the decl gate already covers it) and corrects a stale top comment that claimed the module stays visible on Linux — it is macos-decl-gated, so it never was. Mechanical rename; no logic change. --- src/transport/udp/io.rs | 4 ++-- src/transport/udp/mod.rs | 4 ++-- .../udp/{darwin_sockopts.rs => sockopts_macos.rs} | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) rename src/transport/udp/{darwin_sockopts.rs => sockopts_macos.rs} (96%) diff --git a/src/transport/udp/io.rs b/src/transport/udp/io.rs index 979f5af..efde04e 100644 --- a/src/transport/udp/io.rs +++ b/src/transport/udp/io.rs @@ -800,7 +800,7 @@ pub use platform::{AsyncUdpSocket, UdpRawSocket}; /// /// Gated to Linux/macOS: the rest of `io.rs` compiles more broadly /// (Windows uses `tokio::net::UdpSocket`), but the connected fast path -/// is libc-syscall + `darwin_sockopts` specific. +/// is libc-syscall + `sockopts_macos` specific. #[cfg(any(target_os = "linux", target_os = "macos"))] mod connected { // The connected-UDP fast path is infra-ready but not yet wired into @@ -873,7 +873,7 @@ mod connected { set_sockopt_int(raw, libc::SOL_SOCKET, libc::SO_REUSEPORT, 1)?; #[cfg(target_os = "macos")] - crate::transport::udp::darwin_sockopts::apply_udp_socket_tuning(raw, "connected-udp-peer"); + crate::transport::udp::sockopts_macos::apply_udp_socket_tuning(raw, "connected-udp-peer"); // Buffer sizes — try the FORCE variants first (succeed if we // have CAP_NET_ADMIN), then fall back to the ceiling-clamped diff --git a/src/transport/udp/mod.rs b/src/transport/udp/mod.rs index 1d8a64e..d7a4fbe 100644 --- a/src/transport/udp/mod.rs +++ b/src/transport/udp/mod.rs @@ -6,9 +6,9 @@ use super::{ DiscoveredPeer, PacketTx, ReceivedPacket, Transport, TransportAddr, TransportError, TransportId, TransportState, TransportType, }; -#[cfg(target_os = "macos")] -pub(crate) mod darwin_sockopts; pub(crate) mod io; +#[cfg(target_os = "macos")] +pub(crate) mod sockopts_macos; #[cfg(any(target_os = "linux", target_os = "macos"))] pub(crate) use io::open_connected_fd; mod stats; diff --git a/src/transport/udp/darwin_sockopts.rs b/src/transport/udp/sockopts_macos.rs similarity index 96% rename from src/transport/udp/darwin_sockopts.rs rename to src/transport/udp/sockopts_macos.rs index c54fc71..7f98cee 100644 --- a/src/transport/udp/darwin_sockopts.rs +++ b/src/transport/udp/sockopts_macos.rs @@ -1,6 +1,5 @@ -// Applied inside `io::open_connected_fd` (dormant in this PR; see -// `io.rs`). Linux toolchain only checks gates — keep the module -// visible on Linux so clippy doesn't lose track. +// Applied inside `io::open_connected_fd` (see `io.rs`), dormant until +// the connected-UDP fast path is wired into dispatch — hence the allow. #![allow(dead_code)] //! Darwin UDP socket tuning. @@ -10,8 +9,6 @@ //! service type is the one low-cost Darwin hint that can change how the //! socket is queued by the host networking stack and Wi-Fi WMM. -#![cfg(target_os = "macos")] - use std::io; use std::os::fd::RawFd; use std::sync::OnceLock;