Skip to content

Commit

Permalink
Apply review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Feb 7, 2024
1 parent ecd6e1b commit 92b148d
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 27 deletions.
2 changes: 1 addition & 1 deletion commons/zenoh-util/src/std_only/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ pub fn get_index_of_interface(addr: IpAddr) -> ZResult<u32> {
}
}

pub fn get_interfaces_by_addr(addr: IpAddr) -> ZResult<Vec<String>> {
pub fn get_interface_names_by_addr(addr: IpAddr) -> ZResult<Vec<String>> {
#[cfg(unix)]
{
if addr.is_unspecified() {
Expand Down
2 changes: 1 addition & 1 deletion io/zenoh-link-commons/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl From<&LinkUnicast> for Link {
mtu: link.get_mtu(),
is_reliable: link.is_reliable(),
is_streamed: link.is_streamed(),
interfaces: link.get_interfaces(),
interfaces: link.get_interface_names(),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion io/zenoh-link-commons/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub trait LinkUnicastTrait: Send + Sync {
fn get_dst(&self) -> &Locator;
fn is_reliable(&self) -> bool;
fn is_streamed(&self) -> bool;
fn get_interfaces(&self) -> Vec<String>;
fn get_interface_names(&self) -> Vec<String>;
async fn write(&self, buffer: &[u8]) -> ZResult<usize>;
async fn write_all(&self, buffer: &[u8]) -> ZResult<()>;
async fn read(&self, buffer: &mut [u8]) -> ZResult<usize>;
Expand Down
5 changes: 3 additions & 2 deletions io/zenoh-links/zenoh-link-quic/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ impl LinkUnicastTrait for LinkUnicastQuic {
}

#[inline(always)]
fn get_interfaces(&self) -> Vec<String> {
// Not supported for now
fn get_interface_names(&self) -> Vec<String> {
// @TODO: Not supported for now
log::debug!("The get_interface_names for LinkUnicastQuic is not supported");
vec![]
}

Expand Down
5 changes: 3 additions & 2 deletions io/zenoh-links/zenoh-link-serial/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ impl LinkUnicastTrait for LinkUnicastSerial {
}

#[inline(always)]
fn get_interfaces(&self) -> Vec<String> {
// Not supported for now
fn get_interface_names(&self) -> Vec<String> {
// @TODO: Not supported for now
log::debug!("The get_interface_names for LinkUnicastSerial is not supported");
vec![]
}

Expand Down
12 changes: 6 additions & 6 deletions io/zenoh-links/zenoh-link-tcp/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,19 @@ impl LinkUnicastTrait for LinkUnicastTcp {
}

#[inline(always)]
fn get_interfaces(&self) -> Vec<String> {
match zenoh_util::net::get_interfaces_by_addr(self.src_addr.ip()) {
fn get_interface_names(&self) -> Vec<String> {
match zenoh_util::net::get_interface_names_by_addr(self.src_addr.ip()) {
Ok(interfaces) => {
log::debug!(
"get_interfaces for {:?}: {:?}",
log::trace!(
"get_interface_names for {:?}: {:?}",
self.src_addr.ip(),
interfaces
);
interfaces
}
Err(e) => {
log::error!(
"get_interfaces for {:?} failed: {:?}",
log::debug!(
"get_interface_names for {:?} failed: {:?}",
self.src_addr.ip(),
e
);
Expand Down
5 changes: 3 additions & 2 deletions io/zenoh-links/zenoh-link-tls/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ impl LinkUnicastTrait for LinkUnicastTls {
}

#[inline(always)]
fn get_interfaces(&self) -> Vec<String> {
// Not supported for now
fn get_interface_names(&self) -> Vec<String> {
// @TODO: Not supported for now
log::debug!("The get_interface_names for LinkUnicastTls is not supported");
vec![]
}

Expand Down
12 changes: 6 additions & 6 deletions io/zenoh-links/zenoh-link-udp/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,19 @@ impl LinkUnicastTrait for LinkUnicastUdp {
}

#[inline(always)]
fn get_interfaces(&self) -> Vec<String> {
match zenoh_util::net::get_interfaces_by_addr(self.src_addr.ip()) {
fn get_interface_names(&self) -> Vec<String> {
match zenoh_util::net::get_interface_names_by_addr(self.src_addr.ip()) {
Ok(interfaces) => {
log::debug!(
"get_interfaces for {:?}: {:?}",
log::trace!(
"get_interface_names for {:?}: {:?}",
self.src_addr.ip(),
interfaces
);
interfaces
}
Err(e) => {
log::error!(
"get_interfaces for {:?} failed: {:?}",
log::debug!(
"get_interface_names for {:?} failed: {:?}",
self.src_addr.ip(),
e
);
Expand Down
5 changes: 3 additions & 2 deletions io/zenoh-links/zenoh-link-unixpipe/src/unix/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,9 @@ impl LinkUnicastTrait for UnicastPipe {
}

#[inline(always)]
fn get_interfaces(&self) -> Vec<String> {
// Not supported for now
fn get_interface_names(&self) -> Vec<String> {
// @TODO: Not supported for now
log::debug!("The get_interface_names for UnicastPipe is not supported");
vec![]
}

Expand Down
5 changes: 3 additions & 2 deletions io/zenoh-links/zenoh-link-unixsock_stream/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ impl LinkUnicastTrait for LinkUnicastUnixSocketStream {
}

#[inline(always)]
fn get_interfaces(&self) -> Vec<String> {
// Not supported for now
fn get_interface_names(&self) -> Vec<String> {
// @TODO: Not supported for now
log::debug!("The get_interface_names for LinkUnicastUnixSocketStream is not supported");
vec![]
}

Expand Down
5 changes: 3 additions & 2 deletions io/zenoh-links/zenoh-link-ws/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ impl LinkUnicastTrait for LinkUnicastWs {
}

#[inline(always)]
fn get_interfaces(&self) -> Vec<String> {
// Not supported for now
fn get_interface_names(&self) -> Vec<String> {
// @TODO: Not supported for now
log::debug!("The get_interface_names for LinkUnicastWs is not supported");
vec![]
}

Expand Down

0 comments on commit 92b148d

Please sign in to comment.