Skip to content

Commit

Permalink
Be lenient with duplicate Close frames. (#1816)
Browse files Browse the repository at this point in the history
  • Loading branch information
romanb committed Oct 28, 2020
1 parent bc11739 commit 421ae9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 9 additions & 0 deletions muxers/mplex/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion muxers/mplex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
6 changes: 2 additions & 4 deletions muxers/mplex/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}",
Expand Down

0 comments on commit 421ae9d

Please sign in to comment.