Fix hook args bug
This commit is contained in:
parent
cd7f79ec04
commit
1629215b18
|
@ -435,7 +435,7 @@ deliver({connack, ReasonCode, SP}, PState) ->
|
||||||
send(?CONNACK_PACKET(ReasonCode, SP), PState);
|
send(?CONNACK_PACKET(ReasonCode, SP), PState);
|
||||||
|
|
||||||
deliver({publish, PacketId, Msg}, PState = #pstate{is_bridge = IsBridge, mountpoint = MountPoint}) ->
|
deliver({publish, PacketId, Msg}, PState = #pstate{is_bridge = IsBridge, mountpoint = MountPoint}) ->
|
||||||
_ = emqx_hooks:run('message.delivered', credentials(PState), Msg),
|
_ = emqx_hooks:run('message.delivered', [credentials(PState)], Msg),
|
||||||
Msg1 = emqx_mountpoint:unmount(MountPoint, clean_retain(IsBridge, Msg)),
|
Msg1 = emqx_mountpoint:unmount(MountPoint, clean_retain(IsBridge, Msg)),
|
||||||
send(emqx_packet:from_message(PacketId, Msg1), PState);
|
send(emqx_packet:from_message(PacketId, Msg1), PState);
|
||||||
|
|
||||||
|
|
|
@ -761,7 +761,7 @@ await(PacketId, Msg, State = #state{inflight = Inflight,
|
||||||
|
|
||||||
acked(puback, PacketId, State = #state{client_id = ClientId, inflight = Inflight}) ->
|
acked(puback, PacketId, State = #state{client_id = ClientId, inflight = Inflight}) ->
|
||||||
case emqx_inflight:lookup(PacketId, Inflight) of
|
case emqx_inflight:lookup(PacketId, Inflight) of
|
||||||
{value, {publish, Msg, _Ts}} ->
|
{value, {publish, {_, Msg}, _Ts}} ->
|
||||||
emqx_hooks:run('message.acked', [#{client_id =>ClientId}], Msg),
|
emqx_hooks:run('message.acked', [#{client_id =>ClientId}], Msg),
|
||||||
State#state{inflight = emqx_inflight:delete(PacketId, Inflight)};
|
State#state{inflight = emqx_inflight:delete(PacketId, Inflight)};
|
||||||
none ->
|
none ->
|
||||||
|
@ -771,7 +771,7 @@ acked(puback, PacketId, State = #state{client_id = ClientId, inflight = Infligh
|
||||||
|
|
||||||
acked(pubrec, PacketId, State = #state{client_id = ClientId, inflight = Inflight}) ->
|
acked(pubrec, PacketId, State = #state{client_id = ClientId, inflight = Inflight}) ->
|
||||||
case emqx_inflight:lookup(PacketId, Inflight) of
|
case emqx_inflight:lookup(PacketId, Inflight) of
|
||||||
{value, {publish, Msg, _Ts}} ->
|
{value, {publish, {_, Msg}, _Ts}} ->
|
||||||
emqx_hooks:run('message.acked', [ClientId], Msg),
|
emqx_hooks:run('message.acked', [ClientId], Msg),
|
||||||
State#state{inflight = emqx_inflight:update(PacketId, {pubrel, PacketId, os:timestamp()}, Inflight)};
|
State#state{inflight = emqx_inflight:update(PacketId, {pubrel, PacketId, os:timestamp()}, Inflight)};
|
||||||
{value, {pubrel, PacketId, _Ts}} ->
|
{value, {pubrel, PacketId, _Ts}} ->
|
||||||
|
|
Loading…
Reference in New Issue