mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
New option added: max_fsm_queue. Removed hardcoded FSMLIMITS. (thanks to Evgeniy Khramtsov)
Merged from trunk@2645 SVN Revision: 2647
This commit is contained in:
parent
a2bb22a0e7
commit
036095f37d
@ -387,6 +387,8 @@ process_term(Term, State) ->
|
||||
{loglevel, Loglevel} ->
|
||||
ejabberd_loglevel:set(Loglevel),
|
||||
State;
|
||||
{max_fsm_queue, N} ->
|
||||
add_option(max_fsm_queue, N, State);
|
||||
{_Opt, _Val} ->
|
||||
lists:foldl(fun(Host, S) -> process_host_term(Term, Host, S) end,
|
||||
State, State#state.hosts)
|
||||
|
@ -85,15 +85,12 @@
|
||||
%% Module start with or without supervisor:
|
||||
-ifdef(NO_TRANSIENT_SUPERVISORS).
|
||||
-define(SUPERVISOR_START, p1_fsm:start(ejabberd_s2s_out, [From, Host, Type],
|
||||
?FSMLIMITS ++ ?FSMOPTS)).
|
||||
fsm_limit_opts() ++ ?FSMOPTS)).
|
||||
-else.
|
||||
-define(SUPERVISOR_START, supervisor:start_child(ejabberd_s2s_out_sup,
|
||||
[From, Host, Type])).
|
||||
-endif.
|
||||
|
||||
%% Only change this value if you now what your are doing:
|
||||
-define(FSMLIMITS,[]).
|
||||
%% -define(FSMLIMITS, [{max_queue, 2000}]).
|
||||
-define(FSMTIMEOUT, 30000).
|
||||
|
||||
%% We do not block on send anymore.
|
||||
@ -121,7 +118,7 @@ start(From, Host, Type) ->
|
||||
|
||||
start_link(From, Host, Type) ->
|
||||
p1_fsm:start_link(ejabberd_s2s_out, [From, Host, Type],
|
||||
?FSMLIMITS ++ ?FSMOPTS).
|
||||
fsm_limit_opts() ++ ?FSMOPTS).
|
||||
|
||||
start_connection(Pid) ->
|
||||
p1_fsm:send_event(Pid, init).
|
||||
@ -1147,3 +1144,11 @@ terminate_if_waiting_delay(From, To) ->
|
||||
Pid ! terminate_if_waiting_before_retry
|
||||
end,
|
||||
Pids).
|
||||
|
||||
fsm_limit_opts() ->
|
||||
case ejabberd_config:get_local_option(max_fsm_queue) of
|
||||
N when is_integer(N) ->
|
||||
[{max_queue, N}];
|
||||
_ ->
|
||||
[]
|
||||
end.
|
||||
|
@ -70,11 +70,6 @@
|
||||
-define(DEFAULT_NS, ?NS_COMPONENT_ACCEPT).
|
||||
-define(PREFIXED_NS, [{?NS_XMPP, ?NS_XMPP_pfx}]).
|
||||
|
||||
%% Only change this value if you now what your are doing:
|
||||
-define(FSMLIMITS,[]).
|
||||
%% -define(FSMLIMITS, [{max_queue, 2000}]).
|
||||
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% API
|
||||
%%%----------------------------------------------------------------------
|
||||
@ -82,8 +77,8 @@ start(SockData, Opts) ->
|
||||
supervisor:start_child(ejabberd_service_sup, [SockData, Opts]).
|
||||
|
||||
start_link(SockData, Opts) ->
|
||||
?GEN_FSM:start_link(
|
||||
ejabberd_service, [SockData, Opts], ?FSMLIMITS ++ ?FSMOPTS).
|
||||
?GEN_FSM:start_link(ejabberd_service, [SockData, Opts],
|
||||
fsm_limit_opts(Opts) ++ ?FSMOPTS).
|
||||
|
||||
socket_type() ->
|
||||
xml_stream.
|
||||
@ -390,3 +385,16 @@ send_element(StateData, El) ->
|
||||
|
||||
new_id() ->
|
||||
randoms:get_string().
|
||||
|
||||
fsm_limit_opts(Opts) ->
|
||||
case lists:keysearch(max_fsm_queue, 1, Opts) of
|
||||
{value, {_, N}} when is_integer(N) ->
|
||||
[{max_queue, N}];
|
||||
_ ->
|
||||
case ejabberd_config:get_local_option(max_fsm_queue) of
|
||||
N when is_integer(N) ->
|
||||
[{max_queue, N}];
|
||||
_ ->
|
||||
[]
|
||||
end
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user