Skip to content

Commit

Permalink
Merge pull request #115 from romanb/v0.8.1
Browse files Browse the repository at this point in the history
v0.8.1
  • Loading branch information
romanb authored Feb 16, 2021
2 parents 4712012 + 0dd1812 commit 22a7052
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Rust

on:
push:
branches: [ develop ]
branches: [ develop, master ]
pull_request:
branches: [ develop ]
branches: [ develop, master ]

env:
CARGO_TERM_COLOR: always
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.8.1

- Avoid possible premature stream resets of streams that have been properly
closed and already dropped but receive window update or other frames while
the remaining buffered frames are still sent out. Incoming frames for
unknown streams are now ignored, instead of triggering a stream reset for
the remote.

# 0.8.0

- Upgrade step 4 of 4. This version always assumes the new semantics and
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yamux"
version = "0.8.0"
version = "0.8.1"
authors = ["Parity Technologies <[email protected]>"]
license = "Apache-2.0 OR MIT"
description = "Multiplexer over reliable, ordered connections"
Expand Down
30 changes: 20 additions & 10 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,13 @@ impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T> {
return Action::Update(frame)
}
} else if !is_finish {
log::debug!("{}/{}: data for unknown stream", self.id, stream_id);
let mut header = Header::data(stream_id, 0);
header.rst();
return Action::Reset(Frame::new(header))
log::debug!("{}/{}: data for unknown stream, ignoring", self.id, stream_id);
// We do not consider this a protocol violation and thus do not send a stream reset
// because we may still be processing pending `StreamCommand`s of this stream that were
// sent before it has been dropped and "garbage collected". Such a stream reset would
// interfere with the frames that still need to be sent, causing premature stream
// termination for the remote.
// See https://github.com/paritytech/yamux/issues/110 for details.
}

Action::None
Expand Down Expand Up @@ -782,9 +785,12 @@ impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T> {
}
} else if !is_finish {
log::debug!("{}/{}: window update for unknown stream", self.id, stream_id);
let mut header = Header::data(stream_id, 0);
header.rst();
return Action::Reset(Frame::new(header))
// We do not consider this a protocol violation and thus do not send a stream reset
// because we may still be processing pending `StreamCommand`s of this stream that were
// sent before it has been dropped and "garbage collected". Such a stream reset would
// interfere with the frames that still need to be sent, causing premature stream
// termination for the remote.
// See https://github.com/paritytech/yamux/issues/110 for details.
}

Action::None
Expand All @@ -801,9 +807,13 @@ impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T> {
return Action::Ping(Frame::new(hdr))
}
log::debug!("{}/{}: ping for unknown stream", self.id, stream_id);
let mut header = Header::data(stream_id, 0);
header.rst();
Action::Reset(Frame::new(header))
// We do not consider this a protocol violation and thus do not send a stream reset
// because we may still be processing pending `StreamCommand`s of this stream that were
// sent before it has been dropped and "garbage collected". Such a stream reset would
// interfere with the frames that still need to be sent, causing premature stream
// termination for the remote.
// See https://github.com/paritytech/yamux/issues/110 for details.
Action::None
}

fn next_stream_id(&mut self) -> Result<StreamId> {
Expand Down

0 comments on commit 22a7052

Please sign in to comment.