From 31cc446818196c1b896ec0ac1c01c44f828f031b Mon Sep 17 00:00:00 2001 From: turtled Date: Fri, 9 Aug 2019 16:54:49 +0800 Subject: [PATCH] Mountpoint support %c and %u --- src/emqx_protocol.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/emqx_protocol.erl b/src/emqx_protocol.erl index 35a1ce578..d9a2e8496 100644 --- a/src/emqx_protocol.erl +++ b/src/emqx_protocol.erl @@ -203,7 +203,7 @@ handle_in(?PUBACK_PACKET(PacketId, _ReasonCode), PState = #protocol{session = Se {ok, PState} end; -handle_in(?PUBREC_PACKET(PacketId, ReasonCode), PState = #protocol{session = Session}) -> +handle_in(?PUBREC_PACKET(PacketId, _ReasonCode), PState = #protocol{session = Session}) -> case emqx_session:pubrec(PacketId, Session) of {ok, NSession} -> handle_out({pubrel, PacketId}, PState#protocol{session = NSession}); @@ -211,7 +211,7 @@ handle_in(?PUBREC_PACKET(PacketId, ReasonCode), PState = #protocol{session = Ses handle_out({pubrel, PacketId, ReasonCode1}, PState) end; -handle_in(?PUBREL_PACKET(PacketId, ReasonCode), PState = #protocol{session = Session}) -> +handle_in(?PUBREL_PACKET(PacketId, _ReasonCode), PState = #protocol{session = Session}) -> case emqx_session:pubrel(PacketId, Session) of {ok, NSession} -> handle_out({pubcomp, PacketId}, PState#protocol{session = NSession}); @@ -871,11 +871,11 @@ parse(unsubscribe, TopicFilters) -> %% Mount/Unmount %%-------------------------------------------------------------------- -mount(#{mountpoint := MountPoint}, TopicOrMsg) -> - emqx_mountpoint:mount(MountPoint, TopicOrMsg). +mount(Client = #{mountpoint := MountPoint}, TopicOrMsg) -> + emqx_mountpoint:mount(emqx_mountpoint:replvar(MountPoint, Client), TopicOrMsg). -unmount(#{mountpoint := MountPoint}, TopicOrMsg) -> - emqx_mountpoint:unmount(MountPoint, TopicOrMsg). +unmount(Client = #{mountpoint := MountPoint}, TopicOrMsg) -> + emqx_mountpoint:unmount(emqx_mountpoint:replvar(MountPoint, Client), TopicOrMsg). %%-------------------------------------------------------------------- %% Pipeline