From 9429902d017929afca014af8cc7f4bbc07b63abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 5 Aug 2019 17:59:07 +0200 Subject: Don't link gun_tls_proxy process to the ssl process It is ignored by ssl for the purpose we want, and causes problems in the other direction. Also use a normal shutdown when TLS handshake errors occur. --- src/gun_tls_proxy.erl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gun_tls_proxy.erl b/src/gun_tls_proxy.erl index d0558b2..3978822 100644 --- a/src/gun_tls_proxy.erl +++ b/src/gun_tls_proxy.erl @@ -252,7 +252,7 @@ not_connected(cast, Msg={connect_proc, Error}, State=#state{owner_pid=OwnerPid, OwnerPid ! {?MODULE, self(), Error, Extra}, %% We unlink from the owner process to avoid taking it down with us. unlink(OwnerPid), - {stop, Error, State}; + {stop, {shutdown, Error}, State}; not_connected(Type, Event, State) -> handle_common(Type, Event, State). @@ -312,8 +312,6 @@ handle_common(cast, Msg={set_owner, OwnerPid}, State) -> {keep_state, State#state{owner_pid=OwnerPid}}; handle_common(cast, Msg={cb_controlling_process, ProxyPid}, State) -> ?DEBUG_LOG("msg ~0p state ~0p", [Msg, State]), - %% We link so that the ssl process terminates when we do. - link(ProxyPid), {keep_state, State#state{proxy_pid=ProxyPid}}; handle_common(cast, Msg={setopts, Opts}, State) -> ?DEBUG_LOG("msg ~0p state ~0p", [Msg, State]), -- cgit v1.2.3