add SendResponse::poll_reset and SendStream::poll_reset to listen for reset streams (#279)

This commit is contained in:
Sean McArthur
2018-05-30 22:57:43 +02:00
committed by GitHub
parent 82addd6369
commit 3a4633d205
11 changed files with 281 additions and 11 deletions

View File

@@ -972,6 +972,22 @@ impl<B: IntoBuf> SendResponse<B> {
self.inner.send_reset(reason)
}
/// Polls to be notified when the client resets this stream.
///
/// If stream is still open, this returns `Ok(Async::NotReady)`, and
/// registers the task to be notified if a `RST_STREAM` is received.
///
/// If a `RST_STREAM` frame is received for this stream, calling this
/// method will yield the `Reason` for the reset.
///
/// # Error
///
/// Calling this method after having called `send_response` will return
/// a user error.
pub fn poll_reset(&mut self) -> Poll<Reason, ::Error> {
self.inner.poll_reset(proto::PollReset::AwaitingHeaders)
}
// TODO: Support reserving push promises.
}