1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-30 05:21:09 +00:00

Fix connection get closed too early

This commit is contained in:
Nikolay Kim 2018-03-11 15:37:33 -07:00
parent 31fbbd3168
commit 051703eb2c
2 changed files with 9 additions and 14 deletions

View file

@ -4,6 +4,8 @@
* Fix panic on unknown content encoding * Fix panic on unknown content encoding
* Fix connection get closed too early
## 0.4.6 (2018-03-10) ## 0.4.6 (2018-03-10)
* Fix client cookie handling * Fix client cookie handling

View file

@ -110,18 +110,6 @@ impl<T, H> Http1<T, H>
} }
} }
fn poll_completed(&mut self, shutdown: bool) -> Result<bool, ()> {
// check stream state
match self.stream.poll_completed(shutdown) {
Ok(Async::Ready(_)) => Ok(true),
Ok(Async::NotReady) => Ok(false),
Err(err) => {
debug!("Error sending data: {}", err);
Err(())
}
}
}
// TODO: refactor // TODO: refactor
pub fn poll_io(&mut self) -> Poll<bool, ()> { pub fn poll_io(&mut self) -> Poll<bool, ()> {
// read incoming data // read incoming data
@ -272,8 +260,13 @@ impl<T, H> Http1<T, H>
} }
// check stream state // check stream state
if !self.poll_completed(true)? { match self.stream.poll_completed(self.tasks.is_empty()) {
return Ok(Async::NotReady) Ok(Async::NotReady) => return Ok(Async::NotReady),
Err(err) => {
debug!("Error sending data: {}", err);
return Err(())
}
_ => (),
} }
// deal with keep-alive // deal with keep-alive