From 83ef6575002004f4e4629d65ab433b5a70bc9cfa Mon Sep 17 00:00:00 2001 From: Doug A Date: Fri, 10 Mar 2023 13:40:59 -0400 Subject: [PATCH] fix(webrtc): gracefully handle resets of individual connections Fixes https://github.com/libp2p/rust-libp2p/issues/3574 Pull-Request: #3575. --- transports/webrtc/CHANGELOG.md | 4 ++++ transports/webrtc/src/tokio/udp_mux.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/transports/webrtc/CHANGELOG.md b/transports/webrtc/CHANGELOG.md index 5b4212e9..3428a425 100644 --- a/transports/webrtc/CHANGELOG.md +++ b/transports/webrtc/CHANGELOG.md @@ -1,7 +1,11 @@ # 0.4.0-alpha.3 - unreleased +- Gracefully handle `ConnectionReset` error on individual connections, avoiding shutdown of the entire listener upon disconnect of a single client. + See [PR 3575]. + - Migrate from `prost` to `quick-protobuf`. This removes `protoc` dependency. See [PR 3312]. +[PR 3575]: https://github.com/libp2p/rust-libp2p/pull/3575 [PR 3312]: https://github.com/libp2p/rust-libp2p/pull/3312 # 0.4.0-alpha.2 diff --git a/transports/webrtc/src/tokio/udp_mux.rs b/transports/webrtc/src/tokio/udp_mux.rs index de0b31c6..4e432c2e 100644 --- a/transports/webrtc/src/tokio/udp_mux.rs +++ b/transports/webrtc/src/tokio/udp_mux.rs @@ -398,8 +398,11 @@ impl UDPMuxNewAddr { continue; } - Poll::Ready(Err(err)) if err.kind() == ErrorKind::TimedOut => {} Poll::Pending => {} + Poll::Ready(Err(err)) if err.kind() == ErrorKind::TimedOut => {} + Poll::Ready(Err(err)) if err.kind() == ErrorKind::ConnectionReset => { + log::debug!("ConnectionReset by remote client {err:?}") + } Poll::Ready(Err(err)) => { log::error!("Could not read udp packet: {}", err); return Poll::Ready(UDPMuxEvent::Error(err));