From 5ed1217b0ad220e20e211bdfa291ad997b5dbfec Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 8 Jan 2015 14:40:05 +0800 Subject: [PATCH] fix wildcard topics match --- CHANGELOG.md | 7 +++++++ TODO | 6 ++++++ apps/emqtt/src/emqtt_pubsub.erl | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2607c88e..212b04606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ eMQTT ChangeLog ================== +0.2.1 (2015-01-08) +------------------- + +pull request 26: Use binaries for topic paths and fix wildcard topics + +emqtt_pubsub.erl: fix wildcard topic match bug caused by binary topic in 0.2.0 + 0.2.0 (2014-12-07) ------------------- diff --git a/TODO b/TODO index 8c5142381..836737038 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,9 @@ + +0.2.2 +===== + +merge pull request#26 + 0.2.0 ===== diff --git a/apps/emqtt/src/emqtt_pubsub.erl b/apps/emqtt/src/emqtt_pubsub.erl index 22d47a90e..f4cf7c451 100644 --- a/apps/emqtt/src/emqtt_pubsub.erl +++ b/apps/emqtt/src/emqtt_pubsub.erl @@ -249,10 +249,10 @@ trie_match(NodeId, [W|Words], ResAcc) -> [#topic_trie{node_id=ChildId}] -> trie_match(ChildId, Words, Acc); [] -> Acc end - end, 'trie_match_#'(NodeId, ResAcc), [W, "+"]). + end, 'trie_match_#'(NodeId, ResAcc), [W, <<"+">>]). 'trie_match_#'(NodeId, ResAcc) -> - case mnesia:read(topic_trie, #topic_trie_edge{node_id=NodeId, word="#"}) of + case mnesia:read(topic_trie, #topic_trie_edge{node_id=NodeId, word = <<"#">>}) of [#topic_trie{node_id=ChildId}] -> mnesia:read(topic_trie_node, ChildId) ++ ResAcc; [] ->