Be lenient with duplicate Close frames. (#1816)

This commit is contained in:
Roman Borschel
2020-10-28 16:33:48 +01:00
committed by GitHub
parent bc11739b41
commit 421ae9d9c9
3 changed files with 12 additions and 5 deletions

View File

@ -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] # 0.23.0 [2020-10-16]
- More granular execution of pending flushes, better logging and - More granular execution of pending flushes, better logging and

View File

@ -2,7 +2,7 @@
name = "libp2p-mplex" name = "libp2p-mplex"
edition = "2018" edition = "2018"
description = "Mplex multiplexing protocol for libp2p" description = "Mplex multiplexing protocol for libp2p"
version = "0.23.0" version = "0.23.1"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT" license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p" repository = "https://github.com/libp2p/rust-libp2p"

View File

@ -666,11 +666,9 @@ where
if let Some(state) = self.substreams.remove(&id) { if let Some(state) = self.substreams.remove(&id) {
match state { match state {
SubstreamState::RecvClosed { .. } | SubstreamState::Closed { .. } => { SubstreamState::RecvClosed { .. } | SubstreamState::Closed { .. } => {
debug!("{}: Received unexpected `Close` frame for closed substream {}", debug!("{}: Ignoring `Close` frame for closed substream {}",
self.id, id); self.id, id);
return self.on_error( self.substreams.insert(id, state);
io::Error::new(io::ErrorKind::Other,
"Protocol error: Received `Close` frame for closed substream."))
}, },
SubstreamState::Reset { buf } => { SubstreamState::Reset { buf } => {
debug!("{}: Ignoring `Close` frame for already reset substream {}", debug!("{}: Ignoring `Close` frame for already reset substream {}",