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

Specify a closed stream with the CANCEL code as valid #600

Closed
wants to merge 8 commits into from
4 changes: 3 additions & 1 deletion src/proto/streams/recv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@ 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()? {
return Poll::Ready(Ok(Response::new(())));
}

stream.recv_task = Some(cx.waker().clone());
Poll::Pending
Expand Down
1 change: 1 addition & 0 deletions src/proto/streams/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ impl State {
pub fn ensure_recv_open(&self) -> Result<bool, proto::Error> {
// TODO: Is this correct?
match self.inner {
Closed(Cause::Error(Error::Reset(_, Reason::CANCEL, _))) => Ok(false),
Closed(Cause::Error(ref e)) => Err(e.clone()),
Closed(Cause::ScheduledLibraryReset(reason)) => {
Err(proto::Error::library_go_away(reason))
Expand Down
5 changes: 4 additions & 1 deletion src/proto/streams/streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,10 @@ impl Inner {
}

// The stream must be receive open
stream.state.ensure_recv_open()?;
if !stream.state.ensure_recv_open()? {
return Ok(());
}

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