From fc7f8220797fcaf1b36204445616da7c6beed798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 10 Apr 2025 15:16:35 +0200 Subject: Cleanup HTTP/2 timeouts on close to avoid stray messages --- src/gun_http2.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gun_http2.erl b/src/gun_http2.erl index 0feb40e..22654ca 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -963,11 +963,13 @@ closing(#http2_state{opts=Opts}) -> Timeout = maps:get(closing_timeout, Opts, 15000), {closing, Timeout}. -close(Reason0, State=#http2_state{streams=Streams}, _, EvHandlerState) -> +close(Reason0, State=#http2_state{http2_machine=HTTP2Machine, streams=Streams}, + _, EvHandlerState) -> Reason = close_reason(Reason0), _ = maps:fold(fun(_, Stream, _) -> close_stream(State, Stream, Reason) end, [], Streams), + cow_http2_machine:terminate(HTTP2Machine), EvHandlerState. %% @todo This can get {error,closed} leading to {closed,{error,closed}}. -- cgit v1.2.3