Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.8.1 #115

Merged
merged 2 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <admin@parity.io>"]
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