Use the new emqx_session:unsubscribe/2 API

This commit is contained in:
Feng Lee 2018-08-07 11:00:04 +08:00
parent 645c971a07
commit 8418be0a5b
1 changed files with 3 additions and 3 deletions

View File

@ -262,14 +262,14 @@ process({subscribe, RawTopicTable},
process(?UNSUBSCRIBE_PACKET(PacketId, []), State) -> process(?UNSUBSCRIBE_PACKET(PacketId, []), State) ->
send(?UNSUBACK_PACKET(PacketId), State); send(?UNSUBACK_PACKET(PacketId), State);
process(?UNSUBSCRIBE_PACKET(PacketId, _Properties, RawTopics), process(?UNSUBSCRIBE_PACKET(PacketId, Properties, RawTopics),
State = #proto_state{client_id = ClientId, State = #proto_state{client_id = ClientId,
username = Username, username = Username,
mountpoint = MountPoint, mountpoint = MountPoint,
session = Session}) -> session = Session}) ->
case emqx_hooks:run('client.unsubscribe', [ClientId, Username], parse_topics(RawTopics)) of case emqx_hooks:run('client.unsubscribe', [ClientId, Username], parse_topics(RawTopics)) of
{ok, TopicTable} -> {ok, TopicTable} ->
emqx_session:unsubscribe(Session, mount(replvar(MountPoint, State), TopicTable)); emqx_session:unsubscribe(Session, {PacketId, Properties, mount(replvar(MountPoint, State), TopicTable)});
{stop, _} -> {stop, _} ->
ok ok
end, end,
@ -280,7 +280,7 @@ process({unsubscribe, RawTopics}, State = #proto_state{client_id = ClientId,
session = Session}) -> session = Session}) ->
case emqx_hooks:run('client.unsubscribe', [ClientId, Username], parse_topics(RawTopics)) of case emqx_hooks:run('client.unsubscribe', [ClientId, Username], parse_topics(RawTopics)) of
{ok, TopicTable} -> {ok, TopicTable} ->
emqx_session:unsubscribe(Session, TopicTable); emqx_session:unsubscribe(Session, {undefined, #{}, TopicTable});
{stop, _} -> ok {stop, _} -> ok
end, end,
{ok, State}; {ok, State};