From 2dd60838510f834b005c266cab7c657a68239ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 14 Dec 2017 11:20:39 +0100 Subject: 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. --- src/gun.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3