From db824bfc6484f4429e830364d0a897a7f7f65f4d Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Wed, 29 Sep 2004 21:10:40 +0000 Subject: * src/ejabberd_listener.erl: Check result of controlling_process SVN Revision: 270 --- src/ejabberd_listener.erl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl index 2bb526cb..2ea422c3 100644 --- a/src/ejabberd_listener.erl +++ b/src/ejabberd_listener.erl @@ -92,7 +92,12 @@ accept(ListenSocket, Module, Opts) -> ok end, {ok, Pid} = Module:start({gen_tcp, Socket}, Opts), - gen_tcp:controlling_process(Socket, Pid), + case gen_tcp:controlling_process(Socket, Pid) of + ok -> + ok; + {error, _Reason} -> + gen_tcp:close(Socket) + end, accept(ListenSocket, Module, Opts); {error, Reason} -> ?INFO_MSG("(~w) Failed TCP accept: ~w", @@ -139,7 +144,7 @@ accept_ssl(ListenSocket, Module, Opts) -> ok end, {ok, Pid} = Module:start({ssl, Socket}, Opts), - ssl:controlling_process(Socket, Pid), + catch ssl:controlling_process(Socket, Pid), accept_ssl(ListenSocket, Module, Opts); {error, timeout} -> accept_ssl(ListenSocket, Module, Opts); -- cgit v1.2.3