25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Add 'supervisor' listening option

If set to 'true' (this is the default), new processes spawned by
ejabberd_listener will be attached to the corresponding supervisor.
No such processes will be attached to a supervisor otherwise.
Setting this to 'false' will improve performance of high loaded
systems where new C2S/S2S processes are spawned very rapidly.
This commit is contained in:
Evgeniy Khramtsov 2017-01-11 10:56:04 +03:00
parent dd5389df23
commit 5cfe57ece5
3 changed files with 22 additions and 6 deletions

View File

@ -63,8 +63,13 @@
%%% ejabberd_socket API
%%%===================================================================
start(SockData, Opts) ->
xmpp_stream_in:start(?MODULE, [SockData, Opts],
ejabberd_config:fsm_limit_opts(Opts)).
case proplists:get_value(supervisor, Opts, true) of
true ->
supervisor:start_child(ejabberd_c2s_sup, [SockData, Opts]);
_ ->
xmpp_stream_in:start(?MODULE, [SockData, Opts],
ejabberd_config:fsm_limit_opts(Opts))
end.
start_link(SockData, Opts) ->
xmpp_stream_in:start_link(?MODULE, [SockData, Opts],

View File

@ -55,8 +55,13 @@
%%% API
%%%===================================================================
start(SockData, Opts) ->
xmpp_stream_in:start(?MODULE, [SockData, Opts],
ejabberd_config:fsm_limit_opts(Opts)).
case proplists:get_value(supervisor, Opts, true) of
true ->
supervisor:start_child(ejabberd_s2s_in_sup, [SockData, Opts]);
_ ->
xmpp_stream_in:start(?MODULE, [SockData, Opts],
ejabberd_config:fsm_limit_opts(Opts))
end.
start_link(SockData, Opts) ->
xmpp_stream_in:start_link(?MODULE, [SockData, Opts],

View File

@ -53,8 +53,14 @@
%%% API
%%%===================================================================
start(From, To, Opts) ->
xmpp_stream_out:start(?MODULE, [ejabberd_socket, From, To, Opts],
ejabberd_config:fsm_limit_opts([])).
case proplists:get_value(supervisor, Opts, true) of
true ->
supervisor:start_child(ejabberd_s2s_out_sup,
[ejabberd_socket, From, To, Opts]);
_ ->
xmpp_stream_out:start(?MODULE, [ejabberd_socket, From, To, Opts],
ejabberd_config:fsm_limit_opts([]))
end.
start_link(From, To, Opts) ->
xmpp_stream_out:start_link(?MODULE, [ejabberd_socket, From, To, Opts],