Skip to content

Commit fd40aec

Browse files
committed
set TCP_NODELAY for upstream sockets
if possible we should also set TCP_QUICKACK in case the other end isn't using TCP_NODELAY
1 parent 36eb7bd commit fd40aec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,15 @@ async fn main() -> Result<(), Box<dyn Error>> {
180180
.build()?),
181181
};
182182

183+
let mut http_connector = hyper::client::connect::HttpConnector::new();
184+
// FIXME: make configurable
185+
http_connector.set_keepalive(Some(Duration::from_millis(15000)));
186+
http_connector.set_nodelay(true);
187+
183188
let http_client = hyper::Client::builder()
184189
.http1_title_case_headers(true)
185190
.set_host(false)
186-
.build_http::<hyper::Body>();
191+
.build(http_connector);
187192

188193
// start QUIC endpoint
189194

@@ -431,7 +436,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
431436
}
432437
});
433438
Server::bind(&listener_addr)
434-
.http1_title_case_headers(true)
439+
.tcp_nodelay(true) // FIXME: make configurable
440+
.http1_title_case_headers(true)
435441
.serve(make_svc)
436442
.with_graceful_shutdown(stop_token.cancelled())
437443
.await?;

0 commit comments

Comments
 (0)