mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
* src/p1_fsm.erl: Use of catch can break tail recursion.
SVN Revision: 823
This commit is contained in:
parent
be494565a9
commit
637ce31f5e
@ -360,29 +360,29 @@ init_it(Starter, Parent, Name, Mod, Args, Options) ->
|
|||||||
%% First we test if we have reach a defined limit ...
|
%% First we test if we have reach a defined limit ...
|
||||||
loop(Parent, Name, StateName, StateData, Mod, Time, Debug, Limits) ->
|
loop(Parent, Name, StateName, StateData, Mod, Time, Debug, Limits) ->
|
||||||
try
|
try
|
||||||
message_queue_len(Limits),
|
message_queue_len(Limits)
|
||||||
%% TODO: We can add more limit checking here...
|
%% TODO: We can add more limit checking here...
|
||||||
process_message(Parent, Name, StateName, StateData,
|
|
||||||
Mod, Time, Debug, Limits)
|
|
||||||
catch
|
catch
|
||||||
{process_limit, Limit} ->
|
{process_limit, Limit} ->
|
||||||
Reason = {process_limit, Limit},
|
Reason = {process_limit, Limit},
|
||||||
Msg = {'EXIT', Parent, {error, {process_limit, Limit}}},
|
Msg = {'EXIT', Parent, {error, {process_limit, Limit}}},
|
||||||
terminate(Reason, Name, Msg, Mod, StateName, StateData, Debug)
|
terminate(Reason, Name, Msg, Mod, StateName, StateData, Debug)
|
||||||
end.
|
end,
|
||||||
|
process_message(Parent, Name, StateName, StateData,
|
||||||
|
Mod, Time, Debug, Limits).
|
||||||
%% ... then we can process a new message:
|
%% ... then we can process a new message:
|
||||||
process_message(Parent, Name, StateName, StateData, Mod, Time, Debug, Limits) ->
|
process_message(Parent, Name, StateName, StateData, Mod, Time, Debug, Limits) ->
|
||||||
Msg = receive
|
Msg = receive
|
||||||
{'EXIT', Parent, priority_shutdown} ->
|
{'EXIT', Parent, priority_shutdown} ->
|
||||||
{'EXIT', Parent, priority_shutdown}
|
{'EXIT', Parent, priority_shutdown}
|
||||||
after 0 ->
|
after 0 ->
|
||||||
receive
|
receive
|
||||||
Input ->
|
Input ->
|
||||||
Input
|
Input
|
||||||
after Time ->
|
after Time ->
|
||||||
{'$gen_event', timeout}
|
{'$gen_event', timeout}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
case Msg of
|
case Msg of
|
||||||
{system, From, Req} ->
|
{system, From, Req} ->
|
||||||
sys:handle_system_msg(Req, From, Parent, ?MODULE, Debug,
|
sys:handle_system_msg(Req, From, Parent, ?MODULE, Debug,
|
||||||
|
Loading…
Reference in New Issue
Block a user