summaryrefslogtreecommitdiff
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
commitb3fa56fdcc70b3e7f8467d629731fb1c8f90b02f (patch)
tree956f913478c63649f36246bc317f274653904280
parent7082bfea37915f8a8f192a198211968ec5672e89 (diff)
downloadqpid-python-b3fa56fdcc70b3e7f8467d629731fb1c8f90b02f.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/qpid@721243 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--cpp/src/qpid/broker/TopicExchange.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/cpp/src/qpid/broker/TopicExchange.cpp b/cpp/src/qpid/broker/TopicExchange.cpp
index 853c131571..d4f9721162 100644
--- a/cpp/src/qpid/broker/TopicExchange.cpp
+++ b/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)
{