Skip to content

Commit

Permalink
fix(s2n-quic-platform): handle ConnectionReset errors on windows UDP …
Browse files Browse the repository at this point in the history
…sockets (aws#1448)
  • Loading branch information
PeteAudinate committed Mar 10, 2023
1 parent 0f8bea0 commit abf3731
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions quic/s2n-quic-platform/src/socket/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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)]
Expand Down Expand Up @@ -157,6 +162,9 @@ impl<B: Buffer> Queue<B> {
Err(err) if err.was_interrupted() => {
break;
}
Err(err) if err.connection_reset() => {
count += 1;
}
Err(err) => {
entries.finish(count);

Expand Down

0 comments on commit abf3731

Please sign in to comment.