Skip to content

Commit

Permalink
Restrict vsock for unix only
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Mar 15, 2024
1 parent 2a18834 commit a5b9979
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions io/zenoh-link/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ use zenoh_link_unixpipe::{
LinkManagerUnicastPipe, UnixPipeConfigurator, UnixPipeLocatorInspector, UNIXPIPE_LOCATOR_PREFIX,
};

#[cfg(feature = "transport_vsock")]
#[cfg(all(feature = "transport_vsock", target_family = "unix"))]
pub use zenoh_link_vsock as vsock;
#[cfg(feature = "transport_vsock")]
#[cfg(all(feature = "transport_vsock", target_family = "unix"))]
use zenoh_link_vsock::{LinkManagerUnicastVsock, VsockLocatorInspector, VSOCK_LOCATOR_PREFIX};

pub use zenoh_link_commons::*;
Expand All @@ -97,7 +97,7 @@ pub const PROTOCOLS: &[&str] = &[
serial::SERIAL_LOCATOR_PREFIX,
#[cfg(feature = "transport_unixpipe")]
unixpipe::UNIXPIPE_LOCATOR_PREFIX,
#[cfg(feature = "transport_vsock")]
#[cfg(all(feature = "transport_vsock", target_family = "unix"))]
vsock::VSOCK_LOCATOR_PREFIX,
];

Expand All @@ -119,7 +119,7 @@ pub struct LocatorInspector {
serial_inspector: SerialLocatorInspector,
#[cfg(feature = "transport_unixpipe")]
unixpipe_inspector: UnixPipeLocatorInspector,
#[cfg(feature = "transport_vsock")]
#[cfg(all(feature = "transport_vsock", target_family = "unix"))]
vsock_inspector: VsockLocatorInspector,
}
impl LocatorInspector {
Expand All @@ -146,7 +146,7 @@ impl LocatorInspector {
SERIAL_LOCATOR_PREFIX => self.serial_inspector.is_multicast(locator).await,
#[cfg(feature = "transport_unixpipe")]
UNIXPIPE_LOCATOR_PREFIX => self.unixpipe_inspector.is_multicast(locator).await,
#[cfg(feature = "transport_vsock")]
#[cfg(all(feature = "transport_vsock", target_family = "unix"))]
VSOCK_LOCATOR_PREFIX => self.vsock_inspector.is_multicast(locator).await,
_ => bail!("Unsupported protocol: {}.", protocol),
}
Expand Down Expand Up @@ -237,7 +237,7 @@ impl LinkManagerBuilderUnicast {
UNIXPIPE_LOCATOR_PREFIX => {
Ok(std::sync::Arc::new(LinkManagerUnicastPipe::new(_manager)))
}
#[cfg(feature = "transport_vsock")]
#[cfg(all(feature = "transport_vsock", target_family = "unix"))]
VSOCK_LOCATOR_PREFIX => Ok(std::sync::Arc::new(LinkManagerUnicastVsock::new(_manager))),
_ => bail!("Unicast not supported for {} protocol", protocol),
}
Expand Down

0 comments on commit a5b9979

Please sign in to comment.