From d96ab48c6b9b36c283f6e396fe810c6d5d75f841 Mon Sep 17 00:00:00 2001 From: Evgeny Khramtsov Date: Tue, 2 Apr 2019 09:58:12 +0300 Subject: [PATCH] Fix previous commit Fixes #2847 --- src/ejabberd_listener.erl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl index 7413ee048..73baf3142 100644 --- a/src/ejabberd_listener.erl +++ b/src/ejabberd_listener.erl @@ -280,12 +280,14 @@ udp_recv(Socket, Module, Opts) -> {ok, pid()} | {error, any()} | ignore. start_connection(Module, Arity, Socket, Opts, Sup) -> Res = case Sup of + undefined when Arity == 3 -> + Module:start(gen_tcp, Socket, Opts); undefined -> - case Arity of - 3 -> Module:start(gen_tcp, Socket, Opts); - 2 -> Module:start({gen_tcp, Socket}, Opts) - end; - _ -> supervisor:start_child(Sup, [{gen_tcp, Socket}, Opts]) + Module:start({gen_tcp, Socket}, Opts); + _ when Arity == 3 -> + supervisor:start_child(Sup, [gen_tcp, Socket, Opts]); + _ -> + supervisor:start_child(Sup, [{gen_tcp, Socket}, Opts]) end, case Res of {ok, Pid} -> -- 2.40.0