Skip to content

Commit

Permalink
Fix windows/macos builds
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Feb 23, 2024
1 parent ebc9de1 commit 409b885
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
9 changes: 6 additions & 3 deletions io/zenoh-links/zenoh-link-tcp/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -219,7 +222,7 @@ impl LinkManagerUnicastTcp {
async fn new_listener_inner(
&self,
addr: &SocketAddr,
iface: &Option<String>,
#[warn(unused_variables)] iface: &Option<String>,
) -> ZResult<(TcpListener, SocketAddr)> {
// Bind the TCP socket
let socket = TcpListener::bind(addr)
Expand Down
10 changes: 6 additions & 4 deletions io/zenoh-links/zenoh-link-udp/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Mutex<HashMap<(SocketAddr, SocketAddr), Weak<LinkUnicastUdpUnconnected>>>>;
type LinkInput = (Vec<u8>, usize);
type LinkLeftOver = (Vec<u8>, usize, usize);
Expand Down Expand Up @@ -306,7 +308,7 @@ impl LinkManagerUnicastUdp {
async fn new_listener_inner(
&self,
addr: &SocketAddr,
iface: &Option<String>,
#[warn(unused_variables)] iface: &Option<String>,
) -> ZResult<(UdpSocket, SocketAddr)> {
// Bind the UDP socket
let socket = UdpSocket::bind(addr).await.map_err(|e| {
Expand Down
4 changes: 2 additions & 2 deletions io/zenoh-transport/tests/unicast_openclose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down

0 comments on commit 409b885

Please sign in to comment.