fix ping
This commit is contained in:
parent
3b83b7dfee
commit
890f203609
@ -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}) ->
|
handle_event(info, {frame, <<?PACKET_PING>>}, registered, State = #state{stream = Stream, ping_counter = PingCounter}) ->
|
||||||
quic_send(Stream, <<?PACKET_PONG>>),
|
quic_send(Stream, <<?PACKET_PONG>>),
|
||||||
|
logger:debug("[sdlan_quic_channel] get ping"),
|
||||||
{keep_state, State#state{ping_counter = PingCounter + 1}};
|
{keep_state, State#state{ping_counter = PingCounter + 1}};
|
||||||
|
|
||||||
handle_event(info, {timeout, _, ping_ticker}, _, State = #state{client_id = ClientId, ping_counter = PingCounter}) ->
|
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),
|
erlang:start_timer(?PING_TICKER, self(), ping_ticker),
|
||||||
case PingCounter > 0 of
|
case PingCounter > 0 of
|
||||||
true ->
|
true ->
|
||||||
{noreply, State#state{ping_counter = 0}};
|
{keep_state, State#state{ping_counter = 0}};
|
||||||
false ->
|
false ->
|
||||||
logger:debug("[sdlan_channel] client_id: ~p, ping losted", [ClientId]),
|
logger:debug("[sdlan_channel] client_id: ~p, ping losted", [ClientId]),
|
||||||
{stop, normal, State#state{ping_counter = 0}}
|
{stop, normal, State#state{ping_counter = 0}}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user