summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-11-27 17:07:33 +0000
committerGordon Sim <gsim@apache.org>2008-11-27 17:07:33 +0000
commitb0c4f1650f95d710a56bdbad489b639d01f98eb0 (patch)
tree48a8ff26513259b81bbd49a62e2f1e9efcc16bbd /qpid/cpp/src
parent1967d9094b8c2d053a9bc96e8c48ab78e27de550 (diff)
downloadqpid-python-b0c4f1650f95d710a56bdbad489b639d01f98eb0.tar.gz
QPID-1264: fix for topic exchange (patch from astitcher@redhat.com)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@721243 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/broker/TopicExchange.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/broker/TopicExchange.cpp b/qpid/cpp/src/qpid/broker/TopicExchange.cpp
index 853c131571..d4f9721162 100644
--- a/qpid/cpp/src/qpid/broker/TopicExchange.cpp
+++ b/qpid/cpp/src/qpid/broker/TopicExchange.cpp
@@ -240,21 +240,29 @@ bool TopicExchange::isBound(Queue::shared_ptr queue, TopicPattern& pattern)
}
void TopicExchange::route(Deliverable& msg, const string& routingKey, const FieldTable* /*args*/){
- RWlock::ScopedRlock l(lock);
+ Binding::vector mb;
PreRoute pr(msg, this);
uint32_t count(0);
+
+ {
+ RWlock::ScopedRlock l(lock);
Tokens tokens(routingKey);
for (BindingMap::iterator i = bindings.begin(); i != bindings.end(); ++i) {
if (i->first.match(tokens)) {
Binding::vector& qv(i->second.bindingVector);
for(Binding::vector::iterator j = qv.begin(); j != qv.end(); j++, count++){
- msg.deliverTo((*j)->queue);
- if ((*j)->mgmtBinding != 0)
- (*j)->mgmtBinding->inc_msgMatched ();
+ mb.push_back(*j);
}
}
}
+ }
+
+ for (Binding::vector::iterator j = mb.begin(); j != mb.end(); ++j) {
+ msg.deliverTo((*j)->queue);
+ if ((*j)->mgmtBinding != 0)
+ (*j)->mgmtBinding->inc_msgMatched ();
+ }
if (mgmtExchange != 0)
{