From 421ae9d9c9cfe1398f8bf6e2dd7d90c8e8f36018 Mon Sep 17 00:00:00 2001 From: Roman Borschel Date: Wed, 28 Oct 2020 16:33:48 +0100 Subject: [PATCH] Be lenient with duplicate Close frames. (#1816) --- muxers/mplex/CHANGELOG.md | 9 +++++++++ muxers/mplex/Cargo.toml | 2 +- muxers/mplex/src/io.rs | 6 ++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/muxers/mplex/CHANGELOG.md b/muxers/mplex/CHANGELOG.md index 0564ba13f2a..32651b14e27 100644 --- a/muxers/mplex/CHANGELOG.md +++ b/muxers/mplex/CHANGELOG.md @@ -1,3 +1,12 @@ +# 0.23.1 [2020-10-28] + +- Be lenient with duplicate `Close` frames received. Version + `0.23.0` started treating duplicate `Close` frames for a + substream as a protocol violation. As some libp2p implementations + seem to occasionally send such frames and it is a harmless + redundancy, this releases reverts back to the pre-0.23 behaviour + of ignoring duplicate `Close` frames. + # 0.23.0 [2020-10-16] - More granular execution of pending flushes, better logging and diff --git a/muxers/mplex/Cargo.toml b/muxers/mplex/Cargo.toml index 28fb06e96d0..0ee903608da 100644 --- a/muxers/mplex/Cargo.toml +++ b/muxers/mplex/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-mplex" edition = "2018" description = "Mplex multiplexing protocol for libp2p" -version = "0.23.0" +version = "0.23.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/muxers/mplex/src/io.rs b/muxers/mplex/src/io.rs index 9277b39af84..ffead520ee7 100644 --- a/muxers/mplex/src/io.rs +++ b/muxers/mplex/src/io.rs @@ -666,11 +666,9 @@ where if let Some(state) = self.substreams.remove(&id) { match state { SubstreamState::RecvClosed { .. } | SubstreamState::Closed { .. } => { - debug!("{}: Received unexpected `Close` frame for closed substream {}", + debug!("{}: Ignoring `Close` frame for closed substream {}", self.id, id); - return self.on_error( - io::Error::new(io::ErrorKind::Other, - "Protocol error: Received `Close` frame for closed substream.")) + self.substreams.insert(id, state); }, SubstreamState::Reset { buf } => { debug!("{}: Ignoring `Close` frame for already reset substream {}",