fix #1562 dup flag not set when re-deliver
The dup flag is not set when redeliver the PUBLISH messages for QoS1 and QoS2
This commit is contained in:
parent
e722e0f6d1
commit
18100cacf9
|
@ -32,7 +32,7 @@
|
||||||
%%
|
%%
|
||||||
%% QoS 1 and QoS 2 messages pending transmission to the Client.
|
%% QoS 1 and QoS 2 messages pending transmission to the Client.
|
||||||
%%
|
%%
|
||||||
%% QoS 2 messages which have been received from the Client, but have not
|
%% QoS 2 messages which have been received from the Client, but have not
|
||||||
%% been completely acknowledged.
|
%% been completely acknowledged.
|
||||||
%%
|
%%
|
||||||
%% Optionally, QoS 0 messages pending transmission to the Client.
|
%% Optionally, QoS 0 messages pending transmission to the Client.
|
||||||
|
@ -720,7 +720,7 @@ enqueue_msg(Msg, State = #state{mqueue = Q}) ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
redeliver(Msg = #mqtt_message{qos = QoS}, State) ->
|
redeliver(Msg = #mqtt_message{qos = QoS}, State) ->
|
||||||
deliver(Msg#mqtt_message{dup = if QoS =:= ?QOS2 -> false; true -> true end}, State);
|
deliver(Msg#mqtt_message{dup = if QoS =:= ?QOS0 -> false; true -> true end}, State);
|
||||||
|
|
||||||
redeliver({pubrel, PacketId}, #state{client_pid = Pid}) ->
|
redeliver({pubrel, PacketId}, #state{client_pid = Pid}) ->
|
||||||
Pid ! {redeliver, {?PUBREL, PacketId}}.
|
Pid ! {redeliver, {?PUBREL, PacketId}}.
|
||||||
|
@ -759,7 +759,7 @@ acked(pubrec, PacketId, State = #state{client_id = ClientId,
|
||||||
case Inflight:lookup(PacketId) of
|
case Inflight:lookup(PacketId) of
|
||||||
{publish, Msg, _Ts} ->
|
{publish, Msg, _Ts} ->
|
||||||
emqttd_hooks:run('message.acked', [ClientId, Username], Msg),
|
emqttd_hooks:run('message.acked', [ClientId, Username], Msg),
|
||||||
State#state{inflight = Inflight:update(PacketId, {pubrel, PacketId, os:timestamp()})};
|
State#state{inflight = Inflight:update(PacketId, {pubrel, PacketId, os:timestamp()})};
|
||||||
{pubrel, PacketId, _Ts} ->
|
{pubrel, PacketId, _Ts} ->
|
||||||
?LOG(warning, "Duplicated PUBREC Packet: ~p", [PacketId], State),
|
?LOG(warning, "Duplicated PUBREC Packet: ~p", [PacketId], State),
|
||||||
State
|
State
|
||||||
|
@ -853,4 +853,3 @@ shutdown(Reason, State) ->
|
||||||
|
|
||||||
gc(State) ->
|
gc(State) ->
|
||||||
emqttd_gc:maybe_force_gc(#state.force_gc_count, State).
|
emqttd_gc:maybe_force_gc(#state.force_gc_count, State).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue