From 636a434ca6cfd087e6ebca83ae50bbd776ed4e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Tue, 26 Oct 2021 21:59:40 +0200 Subject: [PATCH] aquatic_http: glommio: unless keep_alive set, close after send --- aquatic_http/src/lib/glommio/network.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aquatic_http/src/lib/glommio/network.rs b/aquatic_http/src/lib/glommio/network.rs index 589a907..bbea89f 100644 --- a/aquatic_http/src/lib/glommio/network.rs +++ b/aquatic_http/src/lib/glommio/network.rs @@ -30,6 +30,7 @@ struct ConnectionReference { } struct Connection { + config: Rc, // request_senders: Rc>, response_receiver: LocalReceiver, tls: ServerConnection, @@ -74,6 +75,7 @@ pub async fn run_socket_worker( let entry = slab.vacant_entry(); let conn = Connection { + config: config.clone(), // request_senders: request_senders.clone(), response_receiver, tls: ServerConnection::new(tls_config.clone()).unwrap(), @@ -129,7 +131,9 @@ impl Connection { self.wait_for_response = false; - // TODO: trigger close here if keepalive is false + if !self.config.network.keep_alive { + self.close_after_writing = true; + } } }