From 1e417d5b413b1ac9cb3260c9b92a927f9aedbdc1 Mon Sep 17 00:00:00 2001 From: Pete Burgers Date: Fri, 10 Mar 2023 15:30:21 +0000 Subject: [PATCH] fix(s2n-quic-platform): handle ConnectionReset on Win sockets (#1448) --- quic/s2n-quic-platform/src/socket/std.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/quic/s2n-quic-platform/src/socket/std.rs b/quic/s2n-quic-platform/src/socket/std.rs index f349917efd..a5822ddeba 100644 --- a/quic/s2n-quic-platform/src/socket/std.rs +++ b/quic/s2n-quic-platform/src/socket/std.rs @@ -45,6 +45,7 @@ pub trait Error { fn would_block(&self) -> bool; fn was_interrupted(&self) -> bool; fn permission_denied(&self) -> bool; + fn connection_reset(&self) -> bool; } #[cfg(feature = "std")] @@ -60,6 +61,10 @@ impl Error for std::io::Error { fn permission_denied(&self) -> bool { self.kind() == std::io::ErrorKind::PermissionDenied } + + fn connection_reset(&self) -> bool { + self.kind() == std::io::ErrorKind::ConnectionReset + } } #[derive(Debug, Default)] @@ -157,6 +162,9 @@ impl Queue { Err(err) if err.was_interrupted() => { break; } + Err(err) if err.connection_reset() => { + count += 1; + } Err(err) => { entries.finish(count);