mirror of https://github.com/fafhrd91/actix-web
update override. use write_ready state for detecting disconnect
This commit is contained in:
parent
4b9401efbb
commit
1048d7df70
|
@ -135,8 +135,8 @@ actix-multipart = { path = "actix-multipart" }
|
|||
actix-files = { path = "actix-files" }
|
||||
awc = { path = "awc" }
|
||||
|
||||
actix-rt = { git = "https://github.com/actix/actix-net.git", branch = "feat/net_poll_ready" }
|
||||
tokio = { git = "https://github.com/fakeshadow/tokio", branch = "feature/net_poll_ready" }
|
||||
actix-rt = { git = "https://github.com/actix/actix-net.git" }
|
||||
actix-tls = { git = "https://github.com/actix/actix-net.git" }
|
||||
|
||||
[[bench]]
|
||||
name = "server"
|
||||
|
|
|
@ -695,14 +695,15 @@ where
|
|||
if timer.as_mut().poll(cx).is_ready() {
|
||||
// payload is pending and it's time to check the ready state of io.
|
||||
if this.flags.contains(Flags::PAYLOAD_PENDING) {
|
||||
match Pin::new(this.io.as_mut().unwrap()).poll_read_ready(cx)? {
|
||||
match Pin::new(this.io.as_mut().unwrap()).poll_write_ready(cx)? {
|
||||
// if io is ready and already closed resolve with dispatcher error.
|
||||
Poll::Ready(ready) if ready.is_read_closed() => {
|
||||
trace!("Response payload pending check determine remote connection is dropped");
|
||||
return Err(DispatchError::DisconnectTimeout);
|
||||
Poll::Ready(ready) if ready.is_write_closed() => {
|
||||
trace!("Response payload pending check determine remote connection is closed");
|
||||
this.flags
|
||||
.insert(Flags::SHUTDOWN | Flags::WRITE_DISCONNECT);
|
||||
}
|
||||
// otherwise reset the interval and check again after 1 second.
|
||||
_ => {
|
||||
// reset the interval and check again after 1 second.
|
||||
timer
|
||||
.as_mut()
|
||||
.reset(Instant::now() + Duration::from_secs(1));
|
||||
|
|
Loading…
Reference in New Issue