Skip to content

Commit

Permalink
address new review
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs committed Mar 22, 2024
1 parent e154864 commit af8f693
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions yamux/src/connection/closing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ where

loop {
match this.state {
State::FlushingPendingFrames => {
ready!(this.socket.poll_ready_unpin(cx))?;

match this.pending_frames.pop_front() {
Some(frame) => this.socket.start_send_unpin(frame)?,
None => this.state = State::ClosingStreamReceiver,
}
}
State::ClosingStreamReceiver => {
for stream in this.stream_receivers.iter_mut() {
stream.inner_mut().close();
Expand All @@ -74,14 +82,6 @@ where
}
}
}
State::FlushingPendingFrames => {
ready!(this.socket.poll_ready_unpin(cx))?;

match this.pending_frames.pop_front() {
Some(frame) => this.socket.start_send_unpin(frame)?,
None => this.state = State::ClosingStreamReceiver,
}
}
State::ClosingSocket => {
ready!(this.socket.poll_close_unpin(cx))?;

Expand All @@ -93,8 +93,8 @@ where
}

enum State {
FlushingPendingFrames,
ClosingStreamReceiver,
DrainingStreamReceiver,
FlushingPendingFrames,
ClosingSocket,
}

0 comments on commit af8f693

Please sign in to comment.