Skip to content

Commit

Permalink
Log and ignore OS error 55 when sending multicast
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Oct 18, 2024
1 parent f51a5fd commit bad690a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions io/zenoh-links/zenoh-link-udp/src/multicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,23 @@ impl LinkMulticastTrait for LinkMulticastUdp {
}

async fn write(&self, buffer: &[u8]) -> ZResult<usize> {
self.unicast_socket
match self
.unicast_socket
.send_to(buffer, self.multicast_addr)
.await
.map_err(|e| {
let e = zerror!("Write error on UDP link {}: {}", self, e);
tracing::trace!("{}", e);
e.into()
})
{
Ok(size) => Ok(size),
std::io::Result::Err(e) => {
if let Some(55) = e.raw_os_error() {
// No buffer space available
tracing::trace!("{}", e);
Ok(0)
} else {
let e = zerror!("Write error on UDP link {}: {}", self, e);
Err(e.into())
}
}
}
}

async fn write_all(&self, buffer: &[u8]) -> ZResult<()> {
Expand Down

0 comments on commit bad690a

Please sign in to comment.