Skip to content

Commit 20b1bd7

Browse files
committed
fix(mmserver): handle EAGAIN during sendmmsg
This is not actually sufficient for error handling in sendmmsg. The following cases are unconsidered: - Only some of the buffer are sent - Only some of one of the iovecs is sent We'll handle this when we migrate to rustix's sendmmsg, which is waiting on the following PRs: - bytecodealliance/rustix#1171 - bytecodealliance/rustix#1409 Note that those cases should be gracefully-ish handled by FEC and the protocol (they're equivalent to dropped or biffed packets).
1 parent bc36986 commit 20b1bd7

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

mm-server/src/server/sendmmsg.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,20 @@ impl<'a> SendMmsg<'a> {
4242
.map(ControlMessage::TxTime)
4343
.collect::<Vec<_>>();
4444

45-
nix::sys::socket::sendmmsg(
46-
fd.as_raw_fd(),
47-
&mut data,
48-
&self.iovs,
49-
&self.addrs,
50-
&cmsgs,
51-
MsgFlags::empty(),
52-
)?;
45+
loop {
46+
match nix::sys::socket::sendmmsg(
47+
fd.as_raw_fd(),
48+
&mut data,
49+
&self.iovs,
50+
&self.addrs,
51+
&cmsgs,
52+
MsgFlags::empty(),
53+
) {
54+
Ok(_) => break,
55+
Err(nix::errno::Errno::EAGAIN) => continue,
56+
Err(e) => return Err(e),
57+
};
58+
}
5359

5460
Ok(())
5561
}

0 commit comments

Comments
 (0)