From 782fbbc04d5bddc0ed4c5ef3187c11251dfb2487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Sun, 21 Jan 2024 15:08:18 +0100 Subject: [PATCH] fix(http2): reduce memory usage --- src/tunnel/transport/http2.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tunnel/transport/http2.rs b/src/tunnel/transport/http2.rs index 2b61749..74ae543 100644 --- a/src/tunnel/transport/http2.rs +++ b/src/tunnel/transport/http2.rs @@ -82,7 +82,7 @@ impl TunnelWrite for Http2TunnelWrite { if self.buf.capacity() < MAX_PACKET_LENGTH { //info!("read {} Kb {} Kb", self.buf.capacity() / 1024, old_capa / 1024); - self.buf.reserve(MAX_PACKET_LENGTH * 4) + self.buf.reserve(MAX_PACKET_LENGTH) } ret @@ -141,6 +141,7 @@ pub async fn connect( let transport = pooled_cnx.deref_mut().take().unwrap(); let (mut request_sender, cnx) = hyper::client::conn::http2::Builder::new(TokioExecutor::new()) .timer(TokioTimer::new()) + .adaptive_window(true) .keep_alive_interval(client_cfg.websocket_ping_frequency) .keep_alive_while_idle(false) .handshake(TokioIo::new(transport))