From 409b8855608e954e0af38d8a5a71ed9ecce2db39 Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Fri, 23 Feb 2024 19:18:59 +0100 Subject: [PATCH] Fix windows/macos builds --- io/zenoh-links/zenoh-link-tcp/src/unicast.rs | 9 ++++++--- io/zenoh-links/zenoh-link-udp/src/unicast.rs | 10 ++++++---- io/zenoh-transport/tests/unicast_openclose.rs | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/io/zenoh-links/zenoh-link-tcp/src/unicast.rs b/io/zenoh-links/zenoh-link-tcp/src/unicast.rs index 066c5556af..e16b44aadd 100644 --- a/io/zenoh-links/zenoh-link-tcp/src/unicast.rs +++ b/io/zenoh-links/zenoh-link-tcp/src/unicast.rs @@ -23,13 +23,16 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::time::Duration; use zenoh_link_commons::{ - get_ip_interface_names, set_bind_to_device, LinkManagerUnicastTrait, LinkUnicast, - LinkUnicastTrait, ListenersUnicastIP, NewLinkChannelSender, BIND_INTERFACE, + get_ip_interface_names, LinkManagerUnicastTrait, LinkUnicast, LinkUnicastTrait, + ListenersUnicastIP, NewLinkChannelSender, BIND_INTERFACE, }; use zenoh_protocol::core::{EndPoint, Locator}; use zenoh_result::{bail, zerror, Error as ZError, ZResult}; use zenoh_sync::Signal; +#[cfg(unix)] +use zenoh_link_commons::set_bind_to_device; + use super::{ get_tcp_addrs, TCP_ACCEPT_THROTTLE_TIME, TCP_DEFAULT_MTU, TCP_LINGER_TIMEOUT, TCP_LOCATOR_PREFIX, @@ -219,7 +222,7 @@ impl LinkManagerUnicastTcp { async fn new_listener_inner( &self, addr: &SocketAddr, - iface: &Option, + #[warn(unused_variables)] iface: &Option, ) -> ZResult<(TcpListener, SocketAddr)> { // Bind the TCP socket let socket = TcpListener::bind(addr) diff --git a/io/zenoh-links/zenoh-link-udp/src/unicast.rs b/io/zenoh-links/zenoh-link-udp/src/unicast.rs index 3814d4c553..99577ae44b 100644 --- a/io/zenoh-links/zenoh-link-udp/src/unicast.rs +++ b/io/zenoh-links/zenoh-link-udp/src/unicast.rs @@ -28,15 +28,17 @@ use std::sync::{Arc, Mutex, Weak}; use std::time::Duration; use zenoh_core::{zasynclock, zlock}; use zenoh_link_commons::{ - get_ip_interface_names, set_bind_to_device, ConstructibleLinkManagerUnicast, - LinkManagerUnicastTrait, LinkUnicast, LinkUnicastTrait, ListenersUnicastIP, - NewLinkChannelSender, BIND_INTERFACE, + get_ip_interface_names, ConstructibleLinkManagerUnicast, LinkManagerUnicastTrait, LinkUnicast, + LinkUnicastTrait, ListenersUnicastIP, NewLinkChannelSender, BIND_INTERFACE, }; use zenoh_protocol::core::{EndPoint, Locator}; use zenoh_result::{bail, zerror, Error as ZError, ZResult}; use zenoh_sync::Mvar; use zenoh_sync::Signal; +#[cfg(unix)] +use zenoh_link_commons::set_bind_to_device; + type LinkHashMap = Arc>>>; type LinkInput = (Vec, usize); type LinkLeftOver = (Vec, usize, usize); @@ -306,7 +308,7 @@ impl LinkManagerUnicastUdp { async fn new_listener_inner( &self, addr: &SocketAddr, - iface: &Option, + #[warn(unused_variables)] iface: &Option, ) -> ZResult<(UdpSocket, SocketAddr)> { // Bind the UDP socket let socket = UdpSocket::bind(addr).await.map_err(|e| { diff --git a/io/zenoh-transport/tests/unicast_openclose.rs b/io/zenoh-transport/tests/unicast_openclose.rs index fa4b8614cf..b2526d2c7b 100644 --- a/io/zenoh-transport/tests/unicast_openclose.rs +++ b/io/zenoh-transport/tests/unicast_openclose.rs @@ -789,7 +789,7 @@ R+IdLiXcyIkg0m9N8I17p0ljCSkbrgGMD3bbePRTfg== } #[cfg(feature = "transport_tcp")] -#[cfg(unix)] +#[cfg(target_os = "linux")] #[test] #[should_panic(expected = "assertion failed: open_res.is_ok()")] fn openclose_tcp_only_with_interface_restriction() { @@ -808,7 +808,7 @@ fn openclose_tcp_only_with_interface_restriction() { } #[cfg(feature = "transport_udp")] -#[cfg(unix)] +#[cfg(target_os = "linux")] #[test] #[should_panic(expected = "assertion failed: open_res.is_ok()")] fn openclose_udp_only_with_interface_restriction() {