This commit is contained in:
anlicheng 2026-02-24 16:44:48 +08:00
parent 3b83b7dfee
commit 890f203609

View File

@ -217,6 +217,7 @@ handle_event(info, {frame, <<?PACKET_POLICY_REQUEST, Body/binary>>}, registered,
handle_event(info, {frame, <<?PACKET_PING>>}, registered, State = #state{stream = Stream, ping_counter = PingCounter}) ->
quic_send(Stream, <<?PACKET_PONG>>),
logger:debug("[sdlan_quic_channel] get ping"),
{keep_state, State#state{ping_counter = PingCounter + 1}};
handle_event(info, {timeout, _, ping_ticker}, _, State = #state{client_id = ClientId, ping_counter = PingCounter}) ->
@ -224,7 +225,7 @@ handle_event(info, {timeout, _, ping_ticker}, _, State = #state{client_id = Clie
erlang:start_timer(?PING_TICKER, self(), ping_ticker),
case PingCounter > 0 of
true ->
{noreply, State#state{ping_counter = 0}};
{keep_state, State#state{ping_counter = 0}};
false ->
logger:debug("[sdlan_channel] client_id: ~p, ping losted", [ClientId]),
{stop, normal, State#state{ping_counter = 0}}