fix(connection): Make process_msg function tail-recursive

This commit is contained in:
ieQu1 2024-07-14 06:00:00 +02:00
parent ffa69df6f8
commit 46c2c75b7b
No known key found for this signature in database
GPG Key ID: 488654DF3FED6FDE
1 changed files with 11 additions and 13 deletions

View File

@ -468,19 +468,17 @@ 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} -> process_msg(More, NState);
process_msg(More, NState); {ok, Msgs, NState} ->
{ok, Msgs, NState} -> process_msg(append_msg(More, Msgs), NState);
process_msg(append_msg(More, Msgs), NState); {stop, Reason, NState} ->
{stop, Reason, NState} -> {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};