diff --git a/src/emqx_client.erl b/src/emqx_client.erl index 1ad8b1d79..08a3cff2a 100644 --- a/src/emqx_client.erl +++ b/src/emqx_client.erl @@ -988,15 +988,6 @@ inflight_full(EventType, EventContent, Data) -> %% delegate all other events to connected state. 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) -> {stop_and_reply, normal, [{reply, From, ok}]}; handle_event(info, {TcpOrSsL, _Sock, Data}, _StateName, State) @@ -1051,6 +1042,15 @@ code_change(_Vsn, State, Data, _Extra) -> %% 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), State = #state{inflight = Inflight}) -> case emqx_inflight:lookup(PacketId, Inflight) of