aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-12-14 11:20:39 +0100
committerLoïc Hoguin <[email protected]>2017-12-14 11:20:39 +0100
commit2dd60838510f834b005c266cab7c657a68239ecf (patch)
treebf72f0291c912cc602f7d9f3d0f4e67a94dbf170 /src
parent33cc99ca4947f49c40ec061837cc58c7d7fc1ace (diff)
downloadgun-2dd60838510f834b005c266cab7c657a68239ecf.tar.gz
gun-2dd60838510f834b005c266cab7c657a68239ecf.tar.bz2
gun-2dd60838510f834b005c266cab7c657a68239ecf.zip
Change the {gone, Reason} to {shutdown, Reason} plus small fixes
The reason for this change is to avoid annoying supervisor logs when SASL logging is enabled.
Diffstat (limited to 'src')
-rw-r--r--src/gun.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gun.erl b/src/gun.erl
index e6ed183..be9e15d 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -601,7 +601,7 @@ down(State=#state{owner=Owner, opts=Opts, protocol=Protocol, protocol_state=Prot
last_error=Reason}, maps:get(retry, Opts, 5)).
retry(#state{last_error=Reason}, 0) ->
- error({gone, Reason});
+ exit({shutdown, Reason});
retry(State=#state{keepalive_ref=KeepaliveRef}, Retries) when is_reference(KeepaliveRef) ->
_ = erlang:cancel_timer(KeepaliveRef),
%% Flush if we have a keepalive message
@@ -784,6 +784,7 @@ ws_loop(State=#state{parent=Parent, owner=Owner, owner_ref=OwnerRef, socket=Sock
error_logger:error_msg("Unexpected message: ~w~n", [Any])
end.
+-spec owner_gone(_) -> no_return().
owner_gone(normal) -> exit(normal);
owner_gone(shutdown) -> exit(shutdown);
owner_gone(Shutdown = {shutdown, _}) -> exit(Shutdown);