Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-01-11 10:56:04 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-01-11 10:56:04 +0300
commit5cfe57ece56d8b4436f3e862723b560711352508 (patch)
tree69b5ea05392d3008593418874246fb59a6bf4df8 /src/ejabberd_c2s.erl
parentdd5389df2359c0c1cfa5826c8b0ee25593b700b0 (diff)
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.
Diffstat (limited to 'src/ejabberd_c2s.erl')
-rw-r--r--src/ejabberd_c2s.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index 007a94dc9..582327d6c 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -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],