refactor(h1): use futures::ready! in a few places

This commit is contained in:
Markus Westerlind
2020-06-23 17:06:39 +02:00
committed by GitHub
parent 981d26d5a1
commit 07f2fd1775
2 changed files with 7 additions and 16 deletions

View File

@@ -214,8 +214,8 @@ where
let (reading, ret) = match self.state.reading {
Reading::Body(ref mut decoder) => {
match decoder.decode(cx, &mut self.io) {
Poll::Ready(Ok(slice)) => {
match ready!(decoder.decode(cx, &mut self.io)) {
Ok(slice) => {
let (reading, chunk) = if decoder.is_eof() {
debug!("incoming body completed");
(
@@ -237,8 +237,7 @@ where
};
(reading, Poll::Ready(chunk))
}
Poll::Pending => return Poll::Pending,
Poll::Ready(Err(e)) => {
Err(e) => {
debug!("incoming body decode error: {}", e);
(Reading::Closed, Poll::Ready(Some(Err(e))))
}