mirror of
https://github.com/actix/actix-web.git
synced 2024-12-23 00:26:34 +00:00
reduce branches in h1 dispatcher poll_keepalive (#2089)
This commit is contained in:
parent
037ac80a32
commit
a9f26286f9
2 changed files with 9 additions and 19 deletions
|
@ -649,11 +649,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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -683,7 +678,6 @@ 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::new(StatusCode::REQUEST_TIMEOUT)
|
Response::new(StatusCode::REQUEST_TIMEOUT)
|
||||||
|
@ -691,11 +685,7 @@ where
|
||||||
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) =
|
||||||
|
|
|
@ -60,8 +60,8 @@ pub use self::http_message::HttpMessage;
|
||||||
pub use self::message::{Message, RequestHead, RequestHeadType, ResponseHead};
|
pub use self::message::{Message, RequestHead, RequestHeadType, ResponseHead};
|
||||||
pub use self::payload::{Payload, PayloadStream};
|
pub use self::payload::{Payload, PayloadStream};
|
||||||
pub use self::request::Request;
|
pub use self::request::Request;
|
||||||
pub use self::response::{Response};
|
pub use self::response::Response;
|
||||||
pub use self::response_builder::{ResponseBuilder};
|
pub use self::response_builder::ResponseBuilder;
|
||||||
pub use self::service::HttpService;
|
pub use self::service::HttpService;
|
||||||
|
|
||||||
pub mod http {
|
pub mod http {
|
||||||
|
|
Loading…
Reference in a new issue