diff options
author | Gordon Sim <gsim@apache.org> | 2008-03-11 15:34:20 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-03-11 15:34:20 +0000 |
commit | b32c30ec005b9e6af28785f2c924c3cb01f3c452 (patch) | |
tree | 69f4a04a1a345758596996d96645173812423568 /cpp | |
parent | 6dbea2e3b51011a28a23505145aa3a3aab6a21fa (diff) | |
download | qpid-python-b32c30ec005b9e6af28785f2c924c3cb01f3c452.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/qpid@635976 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/broker/HeadersExchange.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/cpp/src/qpid/broker/HeadersExchange.cpp b/cpp/src/qpid/broker/HeadersExchange.cpp index 634fcd7b88..34fbbef305 100644 --- a/cpp/src/qpid/broker/HeadersExchange.cpp +++ b/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); |