diff --git a/async/h2_async.ml b/async/h2_async.ml index e372930..bbde4ca 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 df949fe..7e8f804 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