Fix gen_statem:reply/2 bug in emqx_client module

Prior to this change, the arguments passed to gen_statem:reply is bad
args, first arg should be a tuple, but it is a pid. So it would
trigger crash.

This change fix this bug.
This commit is contained in:
Gilbert Wong 2019-04-07 22:31:42 +08:00 committed by Shawn
parent 7e6255d4ee
commit 8cfd080a97
1 changed files with 1 additions and 2 deletions

View File

@ -1049,7 +1049,7 @@ timeout_calls(Timeout, Calls) ->
timeout_calls(Now, Timeout, Calls) ->
lists:foldl(fun(C = #call{from = From, ts = Ts}, Acc) ->
case (timer:now_diff(Now, Ts) div 1000) >= Timeout of
true -> gen_statem:reply(From, {error, ack_timeout}),
true -> From ! {error, ack_timeout},
Acc;
false -> [C | Acc]
end
@ -1231,4 +1231,3 @@ bump_last_packet_id(State = #state{last_packet_id = Id}) ->
-spec next_packet_id(packet_id()) -> packet_id().
next_packet_id(?MAX_PACKET_ID) -> 1;
next_packet_id(Id) -> Id + 1.