Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't close multicast transport on OS error 55 #1548

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 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,31 @@ 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) => {
#[cfg(not(target_os = "macos"))]
{
let e = zerror!("Write error on UDP link {}: {}", self, e);
tracing::trace!("{}", e);
Err(e.into())
}
#[cfg(target_os = "macos")]
if let Some(55) = e.raw_os_error() {
OlivierHecart marked this conversation as resolved.
Show resolved Hide resolved
// No buffer space available
tracing::trace!("Write error on UDP link {}: {}", self, e);
Ok(0)
} else {
let e = zerror!("Write error on UDP link {}: {}", self, e);
tracing::trace!("{}", e);
Err(e.into())
}
}
}
}

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