From 5b1d8be70609465b40616df920c06d4b8aaee493 Mon Sep 17 00:00:00 2001 From: Vincent Bernardoff Date: Tue, 13 Jan 2026 12:13:09 +0100 Subject: [PATCH] async: add close_finished --- async/h2_async.ml | 18 +++++++++++++++++- async/h2_async_intf.ml | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/async/h2_async.ml b/async/h2_async.ml index e372930c..bbde4cad 100644 --- a/async/h2_async.ml +++ b/async/h2_async.ml @@ -132,9 +132,17 @@ module Client = struct let request t = Client_connection.request t.connection let ping t = Client_connection.ping t.connection - let shutdown t = Client_runtime.shutdown t.runtime + + let shutdown t = + (* Do we need to shutdown the connection here? *) + Client_connection.shutdown t.connection; + Client_runtime.shutdown t.runtime + let is_closed t = Client_runtime.is_closed t.runtime + (* Under no circumstances can this return an exception! *) + let close_finished t = Client_runtime.close_finished t.runtime + module SSL = struct module Client_runtime = Gluten_async.Client.SSL @@ -176,6 +184,10 @@ module Client = struct let ping t = Client_connection.ping t.connection let shutdown t = Client_runtime.shutdown t.runtime let is_closed t = Client_runtime.is_closed t.runtime + + let close_finished t = + Client_runtime.close_finished t.runtime >>| fun () -> + H2.Client_connection.shutdown t.connection end module TLS = struct @@ -223,5 +235,9 @@ module Client = struct let ping t = Client_connection.ping t.connection let shutdown t = Client_runtime.shutdown t.runtime let is_closed t = Client_runtime.is_closed t.runtime + + let close_finished t = + Client_runtime.close_finished t.runtime >>| fun () -> + H2.Client_connection.shutdown t.connection end end diff --git a/async/h2_async_intf.ml b/async/h2_async_intf.ml index df949fec..7e8f8044 100644 --- a/async/h2_async_intf.ml +++ b/async/h2_async_intf.ml @@ -80,4 +80,5 @@ module type Client = sig val shutdown : _ t -> unit Deferred.t val is_closed : _ t -> bool + val close_finished : _ t -> unit Deferred.t end