Hi,
I continued to read the source code. And I am puzzled by the mechanism of ejabberd to process the socket. One client started at least 3 process: receiver frontend_socket c2s. How many process does ejabberd start when a client connected and talk to others?How they cooperate with each other? Sorry, my question maybe not so specific, if it is too hard to answer, please tell me the following question about ejabberd_frontend_socket.erl:
init([Module, SockMod, Socket, Opts, Receiver]) ->
%% TODO: monitor the receiver
Node = ejabberd_node_groups:get_closest_node(backend),
{ok, Pid} =
rpc:call(Node, Module, start, [{?MODULE, self()}, Opts]),
ejabberd_receiver:become_controller(Receiver, Pid),
{ok, #state{sockmod = SockMod,
socket = Socket,
receiver = Receiver}}.
What is the effect of this code? Especially ejabberd_node_groups:get_closest_node(backend).
Thank you:)
Regards