summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-09-26 14:02:31 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-09-26 14:02:31 +0200
commitd726120e60e3db332ed26c2106c65271f4d8fba4 (patch)
tree2d50856cd5628d7cf47c53615ce29993095055f0 /src
parent25cc25e9ad51f38fa8e1a78a798b2d54e270dad2 (diff)
Bug in matching algorithm fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r--src/mtrie.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mtrie.cpp b/src/mtrie.cpp
index edff336..01c4fc5 100644
--- a/src/mtrie.cpp
+++ b/src/mtrie.cpp
@@ -210,13 +210,17 @@ void zmq::mtrie_t::match (unsigned char *data_, size_t size_,
void (*func_) (pipe_t *pipe_, void *arg_), void *arg_)
{
mtrie_t *current = this;
- while (size_) {
+ while (true) {
// Signal the pipes attached to this node.
for (pipes_t::iterator it = current->pipes.begin ();
it != current->pipes.end (); ++it)
func_ (*it, arg_);
+ // If we are at the end of the message, there's nothing more to match.
+ if (!size_)
+ break;
+
// If there are no subnodes in the trie, return.
if (current->count == 0)
break;