Duplicated PUBACK Packet

This commit is contained in:
turtled 2017-04-18 17:32:00 +08:00
parent 9d3676884c
commit 7ca6cbadcf
1 changed files with 8 additions and 3 deletions

View File

@ -726,9 +726,14 @@ await(Msg = #mqtt_message{pktid = PacketId},
acked(puback, PacketId, State = #state{client_id = ClientId,
username = Username,
inflight = Inflight}) ->
{publish, Msg, _Ts} = Inflight:lookup(PacketId),
emqttd_hooks:run('message.acked', [ClientId, Username], Msg),
State#state{inflight = Inflight:delete(PacketId)};
case Inflight:lookup(PacketId) of
{publish, Msg, _Ts} ->
emqttd_hooks:run('message.acked', [ClientId, Username], Msg),
State#state{inflight = Inflight:delete(PacketId)};
_ ->
?LOG(warning, "Duplicated PUBACK Packet: ~p", [PacketId], State),
State
end;
acked(pubrec, PacketId, State = #state{client_id = ClientId,
username = Username,