diff --git a/src/proto/streams/recv.rs b/src/proto/streams/recv.rs index d0db00dd8..9be3c9d32 100644 --- a/src/proto/streams/recv.rs +++ b/src/proto/streams/recv.rs @@ -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 diff --git a/src/proto/streams/state.rs b/src/proto/streams/state.rs index 1ca8f5afb..b1d82136f 100644 --- a/src/proto/streams/state.rs +++ b/src/proto/streams/state.rs @@ -433,6 +433,7 @@ impl State { pub fn ensure_recv_open(&self) -> Result { // 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)) diff --git a/src/proto/streams/streams.rs b/src/proto/streams/streams.rs index eab362f73..f898d9e02 100644 --- a/src/proto/streams/streams.rs +++ b/src/proto/streams/streams.rs @@ -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 => {