Skip to content

Commit

Permalink
Remove additive flag.
Browse files Browse the repository at this point in the history
Always interpret the initial window update as additive.
  • Loading branch information
twittner committed Aug 27, 2020
1 parent 3828b03 commit 0036c4c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
4 changes: 1 addition & 3 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T> {
if !self.config.lazy_open {
let mut frame = Frame::window_update(id, self.config.receive_window);
frame.header_mut().syn();
frame.header_mut().additive();
log::trace!("{}: sending initial {}", self.id, frame.header());
self.socket.get_mut().send(&frame).await.or(Err(ConnectionError::Closed))?
}
Expand Down Expand Up @@ -747,7 +746,6 @@ impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T> {
}

let is_finish = frame.header().flags().contains(header::FIN); // half-close
let is_additive = frame.header().flags().contains(header::ADD); // additive window update

if frame.header().flags().contains(header::SYN) { // new stream
if !self.is_valid_remote_id(stream_id, Tag::WindowUpdate) {
Expand All @@ -763,7 +761,7 @@ impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T> {
return Action::Terminate(Frame::protocol_error())
}
let stream = {
let credit = frame.header().credit() + if is_additive { DEFAULT_CREDIT } else { 0 };
let credit = frame.header().credit() + DEFAULT_CREDIT;
let config = self.config.clone();
let sender = self.stream_sender.clone();
let mut stream = Stream::new(stream_id, self.id, config, DEFAULT_CREDIT, credit, sender);
Expand Down
9 changes: 0 additions & 9 deletions src/frame/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ impl<T: HasSyn> Header<T> {
pub fn syn(&mut self) {
self.flags.0 |= SYN.0
}

/// Set the [`ADD`] flag.
pub fn additive(&mut self) {
self.flags.0 |= ADD.0
}
}

impl<T: HasAck> Header<T> {
Expand Down Expand Up @@ -349,10 +344,6 @@ pub const FIN: Flags = Flags(4);
/// Indicates an immediate stream reset.
pub const RST: Flags = Flags(8);

/// Temporary flag indicating that the initial window update is additive.
/// (See https://github.com/paritytech/yamux/issues/92)
pub const ADD: Flags = Flags(0x8000);

/// The serialised header size in bytes.
pub const HEADER_SIZE: usize = 12;

Expand Down

0 comments on commit 0036c4c

Please sign in to comment.