From ddc87f339f441fe5b62455606cf6ed6fb8dbc461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 26 Sep 2019 13:40:26 +0200 Subject: Remove UnprocessedStreams from the gun_down message --- src/gun.erl | 6 +++--- src/gun_http.erl | 6 ++---- src/gun_http2.erl | 4 +--- src/gun_ws.erl | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gun.erl b/src/gun.erl index ddd38c8..c596764 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -758,7 +758,7 @@ flush_pid(ServerPid) -> receive {gun_up, ServerPid, _} -> flush_pid(ServerPid); - {gun_down, ServerPid, _, _, _, _} -> + {gun_down, ServerPid, _, _, _} -> flush_pid(ServerPid); {gun_inform, ServerPid, _, _, _} -> flush_pid(ServerPid); @@ -1423,8 +1423,8 @@ disconnect(State0=#state{owner=Owner, status=Status, opts=Opts, %% We closed the socket, discard any remaining socket events. disconnect_flush(State), %% @todo Stop keepalive timeout, flush message. - {KilledStreams, UnprocessedStreams} = Protocol:down(ProtoState), - Owner ! {gun_down, self(), Protocol:name(), Reason, KilledStreams, UnprocessedStreams}, + KilledStreams = Protocol:down(ProtoState), + Owner ! {gun_down, self(), Protocol:name(), Reason, KilledStreams}, Retry = maps:get(retry, Opts, 5), case Retry of 0 when Reason =:= normal -> diff --git a/src/gun_http.erl b/src/gun_http.erl index 80c83bb..a220d75 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -701,14 +701,12 @@ stream_info(#http_state{streams=Streams}, StreamRef) -> {ok, undefined} end. -%% HTTP does not provide any way to figure out what streams are unprocessed. down(#http_state{streams=Streams}) -> - KilledStreams = [case Ref of + [case Ref of {connect, Ref2, _} -> Ref2; #websocket{ref=Ref2} -> Ref2; _ -> Ref - end || #stream{ref=Ref} <- Streams], - {KilledStreams, []}. + end || #stream{ref=Ref} <- Streams]. error_stream_closed(State, StreamRef, ReplyTo) -> ReplyTo ! {gun_error, self(), StreamRef, {badstate, diff --git a/src/gun_http2.erl b/src/gun_http2.erl index bbc76ab..6a443e3 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -724,10 +724,8 @@ stream_info(State, StreamRef) -> {ok, undefined} end. -%% @todo Add unprocessed streams when GOAWAY handling is done. down(#http2_state{streams=Streams}) -> - KilledStreams = [Ref || #stream{ref=Ref} <- Streams], - {KilledStreams, []}. + [Ref || #stream{ref=Ref} <- Streams]. connection_error(#http2_state{socket=Socket, transport=Transport, http2_machine=HTTP2Machine, streams=Streams}, diff --git a/src/gun_ws.erl b/src/gun_ws.erl index 15c4a81..a2271a9 100644 --- a/src/gun_ws.erl +++ b/src/gun_ws.erl @@ -291,4 +291,4 @@ ws_send([Frame|Tail], State, ReplyTo, EvHandler, EvHandlerState0) -> %% Websocket has no concept of streams. down(_) -> - {[], []}. + []. -- cgit v1.2.3