wip: fix keep alive timeouts

This commit is contained in:
Jun Kurihara 2023-12-11 18:40:31 +09:00
commit b8f3034014
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
3 changed files with 9 additions and 1 deletions

View file

@ -41,6 +41,7 @@ tokio = { version = "1.34.0", default-features = false, features = [
"macros", "macros",
"fs", "fs",
] } ] }
pin-project-lite = "0.2.13"
async-trait = "0.1.74" async-trait = "0.1.74"
# Error handling # Error handling

View file

@ -1,10 +1,12 @@
mod body_incoming_like; mod body_incoming_like;
mod body_type; mod body_type;
mod executor; mod executor;
mod tokio_timer;
mod watch; mod watch;
pub(crate) mod rt { pub(crate) mod rt {
pub(crate) use super::executor::LocalExecutor; pub(crate) use super::executor::LocalExecutor;
pub(crate) use super::tokio_timer::{TokioSleep, TokioTimer};
} }
pub(crate) mod body { pub(crate) mod body {
pub(crate) use super::body_incoming_like::IncomingLike; pub(crate) use super::body_incoming_like::IncomingLike;

View file

@ -6,7 +6,10 @@ mod proxy_quic_quinn;
mod proxy_quic_s2n; mod proxy_quic_s2n;
mod socket; mod socket;
use crate::{globals::Globals, hyper_ext::rt::LocalExecutor}; use crate::{
globals::Globals,
hyper_ext::rt::{LocalExecutor, TokioTimer},
};
use hyper_util::server::{self, conn::auto::Builder as ConnectionBuilder}; use hyper_util::server::{self, conn::auto::Builder as ConnectionBuilder};
use std::sync::Arc; use std::sync::Arc;
@ -20,10 +23,12 @@ pub(crate) fn connection_builder(globals: &Arc<Globals>) -> Arc<ConnectionBuilde
.http1() .http1()
.keep_alive(globals.proxy_config.keepalive) .keep_alive(globals.proxy_config.keepalive)
.header_read_timeout(globals.proxy_config.proxy_idle_timeout) .header_read_timeout(globals.proxy_config.proxy_idle_timeout)
.timer(TokioTimer)
.pipeline_flush(true); .pipeline_flush(true);
http_server http_server
.http2() .http2()
.keep_alive_interval(Some(globals.proxy_config.proxy_idle_timeout)) .keep_alive_interval(Some(globals.proxy_config.proxy_idle_timeout))
.timer(TokioTimer)
.max_concurrent_streams(globals.proxy_config.max_concurrent_streams); .max_concurrent_streams(globals.proxy_config.max_concurrent_streams);
Arc::new(http_server) Arc::new(http_server)
} }