Skip to content

Commit

Permalink
fix: do not ignore result of ensure_recv_open (hyperium#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
DDtKey authored and 0xE282B0 committed Jan 11, 2024
1 parent c27507e commit 41b30d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/proto/streams/recv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,13 @@ impl Recv {
Some(Event::Headers(Client(response))) => Poll::Ready(Ok(response)),
Some(_) => panic!("poll_response called after response returned"),
None => {
stream.state.ensure_recv_open()?;
if !stream.state.ensure_recv_open()? {
proto_err!(stream: "poll_response: stream={:?} is not opened;", stream.id);
return Poll::Ready(Err(Error::library_reset(
stream.id,
Reason::PROTOCOL_ERROR,
)));
}

stream.recv_task = Some(cx.waker().clone());
Poll::Pending
Expand Down
6 changes: 5 additions & 1 deletion src/proto/streams/streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,11 @@ impl Inner {
}

// The stream must be receive open
stream.state.ensure_recv_open()?;
if !stream.state.ensure_recv_open()? {
proto_err!(conn: "recv_push_promise: initiating stream is not opened");
return Err(Error::library_go_away(Reason::PROTOCOL_ERROR));
}

stream.key()
}
None => {
Expand Down

0 comments on commit 41b30d9

Please sign in to comment.