From 6b2b6556089f317b7d9b18503000484c95ef53f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= Date: Mon, 10 Oct 2022 21:27:48 +0200 Subject: [PATCH] Delete stream regardless of error in data_frame1 --- src/gun_http2.erl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gun_http2.erl b/src/gun_http2.erl index 266bf27a..688b445c 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -360,9 +360,9 @@ maybe_ack_or_notify(State=#http2_state{reply_to=ReplyTo, socket=Socket, data_frame(State0, StreamID, IsFin, Data, CookieStore0, EvHandler, EvHandlerState0) -> case get_stream_by_id(State0, StreamID) of Stream=#stream{tunnel=undefined} -> - {StateOrError, EvHandlerState} = data_frame1(State0, + {Commands, EvHandlerState} = data_frame1(State0, StreamID, IsFin, Data, EvHandler, EvHandlerState0, Stream), - {StateOrError, CookieStore0, EvHandlerState}; + {Commands, CookieStore0, EvHandlerState}; Stream=#stream{tunnel=#tunnel{protocol=Proto, protocol_state=ProtoState0}} -> % %% @todo What about IsFin? {Commands, CookieStore, EvHandlerState1} = Proto:handle(Data, @@ -445,13 +445,13 @@ data_frame1(State0, StreamID, IsFin, Data, EvHandler, EvHandlerState0, {update_window(State1), EvHandlerState1} end end, - case StateOrError of - {state, State} -> - {{state, maybe_delete_stream(State, StreamID, remote, IsFin)}, - EvHandlerState}; + {State, Errors} = case StateOrError of + {state, State2} -> + {State2, []}; Error={error, _} -> - {Error, EvHandlerState} - end. + {State1, [Error]} + end, + {[{state, maybe_delete_stream(State, StreamID, remote, IsFin)} | Errors], EvHandlerState}. headers_frame(State0=#http2_state{opts=Opts}, StreamID, IsFin, Headers, #{status := Status}, _BodyLen,