From 4830a7e5e2ab761d30ae4776cdb9502a156087e7 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Thu, 11 Jul 2019 09:54:32 +0300 Subject: [PATCH] Gracefully handle clients that close their connection after logout Registrar portal behaves closes the connection on its own after sending logout command, we should not throw errors with those cases. --- apps/epp_proxy/src/epp_tls_worker.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/epp_proxy/src/epp_tls_worker.erl b/apps/epp_proxy/src/epp_tls_worker.erl index b302918..d5263bb 100644 --- a/apps/epp_proxy/src/epp_tls_worker.erl +++ b/apps/epp_proxy/src/epp_tls_worker.erl @@ -101,8 +101,10 @@ handle_cast(process_command, %% On logout, close the socket. %% Else, go back to the beginning of the loop. if Command =:= "logout" -> - ok = ssl:shutdown(Socket, read_write), - {stop, normal, State}; + case ssl:shutdown(Socket, read_write) of + ok -> {stop, normal, State}; + {error, closed} -> {stop, normal, State} + end; true -> gen_server:cast(self(), process_command), {noreply,