mirror of https://github.com/fafhrd91/actix-web
reduce branches in h1 dispatcher poll_keepalive
This commit is contained in:
parent
78fcd0237a
commit
d500dfc4b2
|
@ -648,11 +648,6 @@ where
|
||||||
// go into Some<Pin<&mut Sleep>> branch
|
// go into Some<Pin<&mut Sleep>> branch
|
||||||
this.ka_timer.set(Some(sleep_until(deadline)));
|
this.ka_timer.set(Some(sleep_until(deadline)));
|
||||||
return self.poll_keepalive(cx);
|
return self.poll_keepalive(cx);
|
||||||
} else {
|
|
||||||
this.flags.insert(Flags::READ_DISCONNECT);
|
|
||||||
if let Some(mut payload) = this.payload.take() {
|
|
||||||
payload.set_error(PayloadError::Incomplete(None));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,18 +677,13 @@ where
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// timeout on first request (slow request) return 408
|
// timeout on first request (slow request) return 408
|
||||||
if !this.flags.contains(Flags::STARTED) {
|
trace!("Slow request timeout");
|
||||||
trace!("Slow request timeout");
|
let _ = self.as_mut().send_response(
|
||||||
let _ = self.as_mut().send_response(
|
Response::RequestTimeout().finish().drop_body(),
|
||||||
Response::RequestTimeout().finish().drop_body(),
|
ResponseBody::Other(Body::Empty),
|
||||||
ResponseBody::Other(Body::Empty),
|
);
|
||||||
);
|
this = self.project();
|
||||||
this = self.project();
|
|
||||||
} else {
|
|
||||||
trace!("Keep-alive connection timeout");
|
|
||||||
}
|
|
||||||
this.flags.insert(Flags::STARTED | Flags::SHUTDOWN);
|
this.flags.insert(Flags::STARTED | Flags::SHUTDOWN);
|
||||||
this.state.set(State::None);
|
|
||||||
}
|
}
|
||||||
// still have unfinished task. try to reset and register keep-alive.
|
// still have unfinished task. try to reset and register keep-alive.
|
||||||
} else if let Some(deadline) =
|
} else if let Some(deadline) =
|
||||||
|
|
Loading…
Reference in New Issue