summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-03-11 15:34:20 +0000
committerGordon Sim <gsim@apache.org>2008-03-11 15:34:20 +0000
commited859ae39f0ac5cadf2e82f434dbfcfc4408c5a9 (patch)
tree2b3633e585a599ad26f644e7cab44611617929cc /qpid/cpp
parentd3f0a9548b7292c74234bb10045ac2db9a47f4a1 (diff)
downloadqpid-python-ed859ae39f0ac5cadf2e82f434dbfcfc4408c5a9.tar.gz
Fixed headers exchange to allow unbind using binding key and not args
Converted alternate exchange python tests git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@635976 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/broker/HeadersExchange.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/broker/HeadersExchange.cpp b/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
index 634fcd7b88..34fbbef305 100644
--- a/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
+++ b/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
@@ -72,7 +72,7 @@ std::string HeadersExchange::getMatch(const FieldTable* args)
return what->get<std::string>();
}
-bool HeadersExchange::bind(Queue::shared_ptr queue, const string& /*routingKey*/, const FieldTable* args){
+bool HeadersExchange::bind(Queue::shared_ptr queue, const string& bindingKey, const FieldTable* args){
RWlock::ScopedWlock locker(lock);
std::string what = getMatch(args);
if (what != all && what != any)
@@ -85,7 +85,7 @@ bool HeadersExchange::bind(Queue::shared_ptr queue, const string& /*routingKey*/
break;
if (i == bindings.end()) {
- Binding::shared_ptr binding (new Binding ("", queue, this));
+ Binding::shared_ptr binding (new Binding (bindingKey, queue, this));
HeaderMap headerMap(*args, binding);
bindings.push_back(headerMap);
@@ -98,12 +98,18 @@ bool HeadersExchange::bind(Queue::shared_ptr queue, const string& /*routingKey*/
}
}
-bool HeadersExchange::unbind(Queue::shared_ptr queue, const string& /*routingKey*/, const FieldTable* args){
+bool HeadersExchange::unbind(Queue::shared_ptr queue, const string& bindingKey, const FieldTable* args){
RWlock::ScopedWlock locker(lock);
Bindings::iterator i;
- for (i = bindings.begin(); i != bindings.end(); i++)
- if (i->first == *args && i->second->queue == queue)
- break;
+ for (i = bindings.begin(); i != bindings.end(); i++) {
+ if (args) {
+ if (i->first == *args && i->second->queue == queue)
+ break;
+ } else {
+ if (i->second->key == bindingKey && i->second->queue == queue)
+ break;
+ }
+ }
if (i != bindings.end()) {
bindings.erase(i);