feat(http2): quickly cancel when receiving RST_STREAM

Update Http2 proto to cancel quick when the stream is reset, on an
`RST_STREAM` frame.

Closes: #1549
This commit is contained in:
Josh Leeb-du Toit
2018-06-26 04:14:35 +10:00
committed by Sean McArthur
parent 2a3844acc3
commit ffdb478831
2 changed files with 30 additions and 1 deletions

View File

@@ -116,6 +116,13 @@ where
None => return Err(::Error::new_canceled(None::<::Error>)),
}
}
} else {
if let Async::Ready(reason) =
self.body_tx.poll_reset().map_err(|e| ::Error::new_h2(e))?
{
debug!("stream received RST_STREAM: {:?}", reason);
return Err(::Error::new_h2(reason.into()));
}
}
match try_ready!(self.stream.poll_data().map_err(|e| self.on_err(e))) {
@@ -148,6 +155,13 @@ where
}
}
} else {
if let Async::Ready(reason) =
self.body_tx.poll_reset().map_err(|e| ::Error::new_h2(e))?
{
debug!("stream received RST_STREAM: {:?}", reason);
return Err(::Error::new_h2(reason.into()));
}
match try_ready!(self.stream.poll_trailers().map_err(|e| self.on_err(e))) {
Some(trailers) => {
self.body_tx