From 7ed29ac2fd3f1769f56b9482197eccf823bc5c81 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 12 Dec 2024 21:27:27 +0100 Subject: [PATCH] fix(udp): retry send on first EINVAL --- quinn-udp/src/unix.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/quinn-udp/src/unix.rs b/quinn-udp/src/unix.rs index 55bd21059..d5c779ed3 100644 --- a/quinn-udp/src/unix.rs +++ b/quinn-udp/src/unix.rs @@ -332,8 +332,20 @@ fn send( if e.raw_os_error() == Some(libc::EINVAL) { // Some arguments to `sendmsg` are not supported. - // Switch to fallback mode. - state.set_sendmsg_einval(); + if !state.sendmsg_einval() { + // Switch to fallback mode. + state.set_sendmsg_einval(); + prepare_msg( + transmit, + &dst_addr, + &mut msg_hdr, + &mut iovec, + &mut cmsgs, + encode_src_ip, + state.sendmsg_einval(), + ); + continue; + } } // - EMSGSIZE is expected for MTU probes. Future work might be able to avoid