From 0a77b9f43e1775cfd9c6fc8fcaf943b0b703b919 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Sun, 21 May 2017 13:30:46 +0300 Subject: [PATCH] Get rid of a workaround against old Erlang bug --- src/ejabberd_receiver.erl | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ejabberd_receiver.erl b/src/ejabberd_receiver.erl index 24eb92fad..44c29680c 100644 --- a/src/ejabberd_receiver.erl +++ b/src/ejabberd_receiver.erl @@ -248,17 +248,15 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. activate_socket(#state{socket = Socket, sock_mod = SockMod}) -> - PeerName = case SockMod of - gen_tcp -> - inet:setopts(Socket, [{active, once}]), - inet:peername(Socket); - _ -> - SockMod:setopts(Socket, [{active, once}]), - SockMod:peername(Socket) - end, - case PeerName of + Res = case SockMod of + gen_tcp -> + inet:setopts(Socket, [{active, once}]); + _ -> + SockMod:setopts(Socket, [{active, once}]) + end, + case Res of {error, _Reason} -> self() ! {tcp_closed, Socket}; - {ok, _} -> ok + ok -> ok end. %% Data processing for connectors directly generating xmlelement in