Merge pull request #13467 from ieQu1/dev/optimize-connection-process_msg
fix(connection): Make process_msg function tail-recursive
This commit is contained in:
commit
706cab3c86
|
@ -468,8 +468,7 @@ cancel_stats_timer(State) ->
|
||||||
process_msg([], State) ->
|
process_msg([], State) ->
|
||||||
{ok, State};
|
{ok, State};
|
||||||
process_msg([Msg | More], State) ->
|
process_msg([Msg | More], State) ->
|
||||||
try
|
try handle_msg(Msg, State) of
|
||||||
case handle_msg(Msg, State) of
|
|
||||||
ok ->
|
ok ->
|
||||||
process_msg(More, State);
|
process_msg(More, State);
|
||||||
{ok, NState} ->
|
{ok, NState} ->
|
||||||
|
@ -480,7 +479,6 @@ process_msg([Msg | More], State) ->
|
||||||
{stop, Reason, NState};
|
{stop, Reason, NState};
|
||||||
{stop, Reason} ->
|
{stop, Reason} ->
|
||||||
{stop, Reason, State}
|
{stop, Reason, State}
|
||||||
end
|
|
||||||
catch
|
catch
|
||||||
exit:normal ->
|
exit:normal ->
|
||||||
{stop, normal, State};
|
{stop, normal, State};
|
||||||
|
|
Loading…
Reference in New Issue