From 4ebb8c8ec910146f7b89e725514d9266a9c60d94 Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Wed, 7 Mar 2018 14:27:19 +0100 Subject: [PATCH] Make termination reason normal for tcp_closed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid lots of error reports, this is a normal case after all… --- src/enoise_connection.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/enoise_connection.erl b/src/enoise_connection.erl index 9e6607d..5dbbc4e 100644 --- a/src/enoise_connection.erl +++ b/src/enoise_connection.erl @@ -63,13 +63,13 @@ handle_info({tcp, TS, Data}, S = #state{ tcp_sock = TS }) -> {noreply, S2}; handle_info({tcp_closed, TS}, S = #state{ tcp_sock = TS, active = A, owner = O }) -> [ O ! {tcp_closed, TS} || A ], - {stop, tcp_closed, S}; + {stop, normal, S#state{ tcp_sock = undefined }}; handle_info(Msg, S) -> io:format("Unexpected info: ~p\n", [Msg]), {noreply, S}. -terminate(Reason, #state{ tcp_sock = TcpSock }) -> - [ gen_tcp:close(TcpSock) || Reason /= tcp_closed ], +terminate(_Reason, #state{ tcp_sock = TcpSock }) -> + [ gen_tcp:close(TcpSock) || TcpSock /= undefined ], ok. code_change(_OldVsn, State, _Extra) ->