Skip to content

Commit 633116e

Browse files
authored
fix: do not ignore result of ensure_recv_open (#687)
1 parent 46fb80b commit 633116e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/proto/streams/recv.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,13 @@ impl Recv {
318318
Some(Event::Headers(Client(response))) => Poll::Ready(Ok(response)),
319319
Some(_) => panic!("poll_response called after response returned"),
320320
None => {
321-
stream.state.ensure_recv_open()?;
321+
if !stream.state.ensure_recv_open()? {
322+
proto_err!(stream: "poll_response: stream={:?} is not opened;", stream.id);
323+
return Poll::Ready(Err(Error::library_reset(
324+
stream.id,
325+
Reason::PROTOCOL_ERROR,
326+
)));
327+
}
322328

323329
stream.recv_task = Some(cx.waker().clone());
324330
Poll::Pending

src/proto/streams/streams.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,11 @@ impl Inner {
726726
}
727727

728728
// The stream must be receive open
729-
stream.state.ensure_recv_open()?;
729+
if !stream.state.ensure_recv_open()? {
730+
proto_err!(conn: "recv_push_promise: initiating stream is not opened");
731+
return Err(Error::library_go_away(Reason::PROTOCOL_ERROR));
732+
}
733+
730734
stream.key()
731735
}
732736
None => {

0 commit comments

Comments
 (0)