summaryrefslogtreecommitdiff
path: root/cpp/src/qpid
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-06-27 15:29:17 +0000
committerGordon Sim <gsim@apache.org>2007-06-27 15:29:17 +0000
commitd7c68d138a1151db2b0d133c94f8b1843850e867 (patch)
tree1171bf86137f08f2ece9e0516407a3735ecc3fca /cpp/src/qpid
parentd3f472ec2033df0cc35f020819477e4f59077046 (diff)
downloadqpid-python-d7c68d138a1151db2b0d133c94f8b1843850e867.tar.gz
Fixes and tests:
* ExchangeRegistry::get() caused a pair to be inserted with a 'null' pointer if the xchange didn't exist * HeadersExchange::isBound() didn't check queue param git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@551197 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
-rw-r--r--cpp/src/qpid/broker/BrokerAdapter.cpp1
-rw-r--r--cpp/src/qpid/broker/ExchangeRegistry.cpp6
-rw-r--r--cpp/src/qpid/broker/HeadersExchange.cpp2
3 files changed, 4 insertions, 5 deletions
diff --git a/cpp/src/qpid/broker/BrokerAdapter.cpp b/cpp/src/qpid/broker/BrokerAdapter.cpp
index 93a3a319ac..c31f4d197d 100644
--- a/cpp/src/qpid/broker/BrokerAdapter.cpp
+++ b/cpp/src/qpid/broker/BrokerAdapter.cpp
@@ -153,7 +153,6 @@ void BrokerAdapter::ExchangeHandlerImpl::declare(const MethodContext& context, u
void BrokerAdapter::ExchangeHandlerImpl::delete_(const MethodContext& context, uint16_t /*ticket*/,
const string& name, bool /*ifUnused*/, bool nowait){
-
//TODO: implement unused
Exchange::shared_ptr exchange(broker.getExchanges().get(name));
if (exchange->isDurable()) broker.getStore().destroy(*exchange);
diff --git a/cpp/src/qpid/broker/ExchangeRegistry.cpp b/cpp/src/qpid/broker/ExchangeRegistry.cpp
index 3bf211b960..9555fa43a4 100644
--- a/cpp/src/qpid/broker/ExchangeRegistry.cpp
+++ b/cpp/src/qpid/broker/ExchangeRegistry.cpp
@@ -71,10 +71,10 @@ void ExchangeRegistry::destroy(const string& name){
Exchange::shared_ptr ExchangeRegistry::get(const string& name){
Mutex::ScopedLock locker(lock);
- Exchange::shared_ptr exchange =exchanges[name];
- if (!exchange)
+ ExchangeMap::iterator i = exchanges.find(name);
+ if (i == exchanges.end())
throw ChannelException(404, "Exchange not found:" + name);
- return exchange;
+ return i->second;
}
namespace
diff --git a/cpp/src/qpid/broker/HeadersExchange.cpp b/cpp/src/qpid/broker/HeadersExchange.cpp
index a9405e1f6d..36f7330433 100644
--- a/cpp/src/qpid/broker/HeadersExchange.cpp
+++ b/cpp/src/qpid/broker/HeadersExchange.cpp
@@ -84,7 +84,7 @@ void HeadersExchange::route(Deliverable& msg, const string& /*routingKey*/, cons
bool HeadersExchange::isBound(Queue::shared_ptr queue, const string* const, const FieldTable* const args)
{
for (Bindings::iterator i = bindings.begin(); i != bindings.end(); ++i) {
- if ( (!args || equal(i->first, *args)) && i->second == queue) {
+ if ( (!args || equal(i->first, *args)) && (!queue || i->second == queue)) {
return true;
}
}