Move emqx_client should_ping function to internal block
This commit is contained in:
parent
a056a4cbde
commit
656429fcc1
|
@ -988,15 +988,6 @@ inflight_full(EventType, EventContent, Data) ->
|
||||||
%% delegate all other events to connected state.
|
%% delegate all other events to connected state.
|
||||||
connected(EventType, EventContent, Data).
|
connected(EventType, EventContent, Data).
|
||||||
|
|
||||||
should_ping(Sock) ->
|
|
||||||
case emqx_client_sock:getstat(Sock, [send_oct]) of
|
|
||||||
{ok, [{send_oct, Val}]} ->
|
|
||||||
OldVal = get(send_oct), put(send_oct, Val),
|
|
||||||
OldVal == undefined orelse OldVal == Val;
|
|
||||||
Error = {error, _Reason} ->
|
|
||||||
Error
|
|
||||||
end.
|
|
||||||
|
|
||||||
handle_event({call, From}, stop, _StateName, _State) ->
|
handle_event({call, From}, stop, _StateName, _State) ->
|
||||||
{stop_and_reply, normal, [{reply, From, ok}]};
|
{stop_and_reply, normal, [{reply, From, ok}]};
|
||||||
handle_event(info, {TcpOrSsL, _Sock, Data}, _StateName, State)
|
handle_event(info, {TcpOrSsL, _Sock, Data}, _StateName, State)
|
||||||
|
@ -1051,6 +1042,15 @@ code_change(_Vsn, State, Data, _Extra) ->
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
should_ping(Sock) ->
|
||||||
|
case emqx_client_sock:getstat(Sock, [send_oct]) of
|
||||||
|
{ok, [{send_oct, Val}]} ->
|
||||||
|
OldVal = get(send_oct), put(send_oct, Val),
|
||||||
|
OldVal == undefined orelse OldVal == Val;
|
||||||
|
Error = {error, _Reason} ->
|
||||||
|
Error
|
||||||
|
end.
|
||||||
|
|
||||||
delete_inflight(?PUBACK_PACKET(PacketId, ReasonCode, Properties),
|
delete_inflight(?PUBACK_PACKET(PacketId, ReasonCode, Properties),
|
||||||
State = #state{inflight = Inflight}) ->
|
State = #state{inflight = Inflight}) ->
|
||||||
case emqx_inflight:lookup(PacketId, Inflight) of
|
case emqx_inflight:lookup(PacketId, Inflight) of
|
||||||
|
|
Loading…
Reference in New Issue