diff --git a/src/ejabberd_socket.erl b/src/ejabberd_socket.erl index 2c7dd783c..c33421ea2 100644 --- a/src/ejabberd_socket.erl +++ b/src/ejabberd_socket.erl @@ -90,7 +90,13 @@ start(Module, SockMod, Socket, Opts) -> end, ReceiverMod:become_controller(Receiver, Pid); {error, _Reason} -> - SockMod:close(Socket) + SockMod:close(Socket), + case ReceiverMod of + ejabberd_receiver -> + ReceiverMod:close(Receiver); + _ -> + ok + end end; independent -> ok;