mirror of
https://github.com/actix/actix-web.git
synced 2024-11-18 15:41:17 +00:00
remove unused Dispatcher::new_timeout (#1985)
This commit is contained in:
parent
4fc7d76759
commit
ce9b2770e2
1 changed files with 8 additions and 35 deletions
|
@ -160,62 +160,35 @@ where
|
||||||
{
|
{
|
||||||
/// Create HTTP/1 dispatcher.
|
/// Create HTTP/1 dispatcher.
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
stream: T,
|
|
||||||
config: ServiceConfig,
|
|
||||||
services: Rc<HttpFlow<S, X, U>>,
|
|
||||||
on_connect_data: OnConnectData,
|
|
||||||
peer_addr: Option<net::SocketAddr>,
|
|
||||||
) -> Self {
|
|
||||||
Dispatcher::with_timeout(
|
|
||||||
stream,
|
|
||||||
Codec::new(config.clone()),
|
|
||||||
config,
|
|
||||||
BytesMut::with_capacity(HW_BUFFER_SIZE),
|
|
||||||
None,
|
|
||||||
services,
|
|
||||||
on_connect_data,
|
|
||||||
peer_addr,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create HTTP/1 dispatcher with slow request timeout.
|
|
||||||
pub(crate) fn with_timeout(
|
|
||||||
io: T,
|
io: T,
|
||||||
codec: Codec,
|
|
||||||
config: ServiceConfig,
|
config: ServiceConfig,
|
||||||
read_buf: BytesMut,
|
flow: Rc<HttpFlow<S, X, U>>,
|
||||||
timeout: Option<Sleep>,
|
|
||||||
services: Rc<HttpFlow<S, X, U>>,
|
|
||||||
on_connect_data: OnConnectData,
|
on_connect_data: OnConnectData,
|
||||||
peer_addr: Option<net::SocketAddr>,
|
peer_addr: Option<net::SocketAddr>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let keepalive = config.keep_alive_enabled();
|
let flags = if config.keep_alive_enabled() {
|
||||||
let flags = if keepalive {
|
|
||||||
Flags::KEEPALIVE
|
Flags::KEEPALIVE
|
||||||
} else {
|
} else {
|
||||||
Flags::empty()
|
Flags::empty()
|
||||||
};
|
};
|
||||||
|
|
||||||
// keep-alive timer
|
// keep-alive timer
|
||||||
let (ka_expire, ka_timer) = if let Some(delay) = timeout {
|
let (ka_expire, ka_timer) = match config.keep_alive_timer() {
|
||||||
(delay.deadline(), Some(delay))
|
Some(delay) => (delay.deadline(), Some(delay)),
|
||||||
} else if let Some(delay) = config.keep_alive_timer() {
|
None => (config.now(), None),
|
||||||
(delay.deadline(), Some(delay))
|
|
||||||
} else {
|
|
||||||
(config.now(), None)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Dispatcher {
|
Dispatcher {
|
||||||
inner: DispatcherState::Normal(InnerDispatcher {
|
inner: DispatcherState::Normal(InnerDispatcher {
|
||||||
|
read_buf: BytesMut::with_capacity(HW_BUFFER_SIZE),
|
||||||
write_buf: BytesMut::with_capacity(HW_BUFFER_SIZE),
|
write_buf: BytesMut::with_capacity(HW_BUFFER_SIZE),
|
||||||
payload: None,
|
payload: None,
|
||||||
state: State::None,
|
state: State::None,
|
||||||
error: None,
|
error: None,
|
||||||
messages: VecDeque::new(),
|
messages: VecDeque::new(),
|
||||||
io: Some(io),
|
io: Some(io),
|
||||||
codec,
|
codec: Codec::new(config),
|
||||||
read_buf,
|
flow,
|
||||||
flow: services,
|
|
||||||
on_connect_data,
|
on_connect_data,
|
||||||
flags,
|
flags,
|
||||||
peer_addr,
|
peer_addr,
|
||||||
|
|
Loading…
Reference in a new issue