aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/manual/gun_down.asciidoc16
-rw-r--r--src/gun.erl6
-rw-r--r--src/gun_http.erl6
-rw-r--r--src/gun_http2.erl4
-rw-r--r--src/gun_ws.erl2
-rw-r--r--test/gun_SUITE.erl2
-rw-r--r--test/ws_autobahn_SUITE.erl2
7 files changed, 13 insertions, 25 deletions
diff --git a/doc/src/manual/gun_down.asciidoc b/doc/src/manual/gun_down.asciidoc
index 6c72898..6785cb5 100644
--- a/doc/src/manual/gun_down.asciidoc
+++ b/doc/src/manual/gun_down.asciidoc
@@ -8,13 +8,12 @@ gun_down - The connection is down
[source,erlang]
----
-{gun_down, ConnPid, Protocol, Reason, KilledStreams, UnprocessedStreams}
+{gun_down, ConnPid, Protocol, Reason, KilledStreams}
ConnPid :: pid()
Protocol :: http | http2 | socks | ws
Reason :: any()
KilledStreams :: [reference()]
-UnprocessedStreams :: [reference()]
----
The connection is down.
@@ -53,16 +52,10 @@ They are active streams that did not complete before the closing
of the connection. Whether they can be retried safely depends
on the protocol used and the idempotence property of the requests.
-UnprocessedStreams::
-
-List of streams that have not been processed by the server.
-+
-They are streams that the server did not start processing yet.
-They may be retried safely depending on whether related streams
-were killed.
-
== Changelog
+* *2.0*: The last element of the message's tuple, `UnprocessedStreams`
+ has been removed.
* *1.0*: Message introduced.
== Examples
@@ -70,8 +63,7 @@ were killed.
.Receive a gun_down message in a gen_server
[source,erlang]
----
-handle_info({gun_down, ConnPid, _Protocol,
- _Reason, _Killed, _Unprocessed},
+handle_info({gun_down, ConnPid, _Protocol, _Reason, _Killed},
State=#state{conn_pid=ConnPid}) ->
%% Do something.
{noreply, State}.
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(_) ->
- {[], []}.
+ [].
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index 715bec5..cd6b419 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -171,7 +171,7 @@ killed_streams_http(_) ->
{response, nofin, 200, _} = gun:await(ConnPid, StreamRef),
{ok, <<"hello world!">>} = gun:await_body(ConnPid, StreamRef),
receive
- {gun_down, ConnPid, http, normal, KilledStreams, _} ->
+ {gun_down, ConnPid, http, normal, KilledStreams} ->
[] = KilledStreams,
gun:close(ConnPid)
after 1000 ->
diff --git a/test/ws_autobahn_SUITE.erl b/test/ws_autobahn_SUITE.erl
index c9a0912..0caf108 100644
--- a/test/ws_autobahn_SUITE.erl
+++ b/test/ws_autobahn_SUITE.erl
@@ -123,7 +123,7 @@ loop(Pid, MRef, StreamRef) ->
{gun_ws, Pid, StreamRef, Frame} ->
gun:ws_send(Pid, Frame),
loop(Pid, MRef, StreamRef);
- {gun_down, Pid, ws, _, _, _} ->
+ {gun_down, Pid, ws, _, _} ->
close(Pid, MRef);
{'DOWN', MRef, process, Pid, normal} ->
close(Pid, MRef);