25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

ejabberd_listener: Let module take over socket

For some use cases, it may be necessary to allow a module to take over
socket ownership during initialization.
This commit is contained in:
Holger Weiss 2022-08-10 18:28:35 +02:00
parent c2cd592eff
commit e858738736

View File

@ -318,6 +318,9 @@ start_connection(Module, Arity, Socket, State, Sup) ->
supervisor:start_child(Sup, [{gen_tcp, Socket}, State])
end,
case Res of
{ok, Pid, preowned_socket} ->
Module:accept(Pid),
{ok, Pid};
{ok, Pid} ->
case gen_tcp:controlling_process(Socket, Pid) of
ok ->