From bb68125b7336d17a5270326e519c3e68cf408c38 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 21 Oct 2024 18:11:15 +1100 Subject: [PATCH] Introduce `UdpSocketState::try_send` API for fallback --- quinn-udp/src/fallback.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/quinn-udp/src/fallback.rs b/quinn-udp/src/fallback.rs index f4963df92..fa81eb1b1 100644 --- a/quinn-udp/src/fallback.rs +++ b/quinn-udp/src/fallback.rs @@ -32,6 +32,9 @@ impl UdpSocketState { /// UDP transmission errors are considered non-fatal because higher-level protocols must /// employ retransmits and timeouts anyway in order to deal with UDP's unreliable nature. /// Thus, logging is most likely the only thing you can do with these errors. + /// + /// If you would like to handle these errors yourself, use [`UdpSocketState::try_send`] + /// instead. pub fn send(&self, socket: UdpSockRef<'_>, transmit: &Transmit<'_>) -> io::Result<()> { match send(socket, transmit) { Ok(()) => Ok(()), @@ -44,6 +47,11 @@ impl UdpSocketState { } } + /// Sends a [`Transmit`] on the given socket without any additional error handling. + pub fn try_send(&self, socket: UdpSockRef<'_>, transmit: &Transmit<'_>) -> io::Result<()> { + send(socket, transmit) + } + pub fn recv( &self, socket: UdpSockRef<'_>,