From dba598a7fa2fc00aa1858e2c4bf15a69542b5596 Mon Sep 17 00:00:00 2001 From: DuProcess <273172371+DuProcess@users.noreply.github.com> Date: Thu, 16 Jul 2026 22:15:22 -0400 Subject: [PATCH] Treat more network churn errors as transient --- src/bin/dosh-client.rs | 15 +++++++++++++++ src/udp.rs | 11 +++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/bin/dosh-client.rs b/src/bin/dosh-client.rs index b553b6b..0971949 100644 --- a/src/bin/dosh-client.rs +++ b/src/bin/dosh-client.rs @@ -13766,6 +13766,12 @@ mod tests { assert!(is_transient_udp_send_error( &std::io::Error::from_raw_os_error(libc::EADDRNOTAVAIL) )); + assert!(is_transient_udp_send_error( + &std::io::Error::from_raw_os_error(libc::ENOBUFS) + )); + assert!(is_transient_udp_send_error( + &std::io::Error::from_raw_os_error(libc::ECONNABORTED) + )); assert!(!is_transient_udp_send_error( &std::io::Error::from_raw_os_error(libc::EINVAL) )); @@ -13773,6 +13779,9 @@ mod tests { #[cfg(windows)] { + assert!(is_transient_udp_send_error( + &std::io::Error::from_raw_os_error(10035) + )); // WSAEWOULDBLOCK assert!(is_transient_udp_send_error( &std::io::Error::from_raw_os_error(10051) )); // WSAENETUNREACH @@ -13782,6 +13791,12 @@ mod tests { assert!(is_transient_udp_send_error( &std::io::Error::from_raw_os_error(10049) )); // WSAEADDRNOTAVAIL + assert!(is_transient_udp_send_error( + &std::io::Error::from_raw_os_error(10053) + )); // WSAECONNABORTED + assert!(is_transient_udp_send_error( + &std::io::Error::from_raw_os_error(10055) + )); // WSAENOBUFS assert!(!is_transient_udp_send_error( &std::io::Error::from_raw_os_error(10022) )); // WSAEINVAL diff --git a/src/udp.rs b/src/udp.rs index e9038fd..d04edc2 100644 --- a/src/udp.rs +++ b/src/udp.rs @@ -86,10 +86,12 @@ fn is_transient_udp_os_error(code: i32) -> bool { matches!( code, libc::EADDRNOTAVAIL + | libc::ECONNABORTED | libc::ECONNREFUSED | libc::ECONNRESET | libc::EHOSTDOWN | libc::EHOSTUNREACH + | libc::ENOBUFS | libc::ENETDOWN | libc::ENETRESET | libc::ENETUNREACH @@ -101,11 +103,14 @@ fn is_transient_udp_os_error(code: i32) -> bool { fn is_transient_udp_os_error(code: i32) -> bool { matches!( code, - 10049 // WSAEADDRNOTAVAIL + 10035 // WSAEWOULDBLOCK + | 10049 // WSAEADDRNOTAVAIL | 10050 // WSAENETDOWN | 10051 // WSAENETUNREACH | 10052 // WSAENETRESET + | 10053 // WSAECONNABORTED | 10054 // WSAECONNRESET + | 10055 // WSAENOBUFS | 10060 // WSAETIMEDOUT | 10061 // WSAECONNREFUSED | 10064 // WSAEHOSTDOWN @@ -195,10 +200,12 @@ mod tests { fn classifies_unix_network_churn_as_transient() { for code in [ libc::EADDRNOTAVAIL, + libc::ECONNABORTED, libc::ECONNREFUSED, libc::ECONNRESET, libc::EHOSTDOWN, libc::EHOSTUNREACH, + libc::ENOBUFS, libc::ENETDOWN, libc::ENETRESET, libc::ENETUNREACH, @@ -214,7 +221,7 @@ mod tests { #[test] fn classifies_windows_network_churn_as_transient() { for code in [ - 10049, 10050, 10051, 10052, 10054, 10060, 10061, 10064, 10065, + 10035, 10049, 10050, 10051, 10052, 10053, 10054, 10055, 10060, 10061, 10064, 10065, ] { let err = std::io::Error::from_raw_os_error(code); assert!(is_transient_udp_error(&err));