summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorCarl C. Trieloff <cctrieloff@apache.org>2007-08-27 21:02:11 +0000
committerCarl C. Trieloff <cctrieloff@apache.org>2007-08-27 21:02:11 +0000
commit580b72becb3dc09b17fa5a887169a5e1a45348ff (patch)
tree6a4c83a5ea7f5b04d23aa0e859ecb4e3c325bdc7 /cpp
parentd52cb3fdccb2c18fa91c8331b4a09e4ea032ff1c (diff)
downloadqpid-python-580b72becb3dc09b17fa5a887169a5e1a45348ff.tar.gz
- perf clean up.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@570243 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/broker/BrokerAdapter.cpp15
-rw-r--r--cpp/src/qpid/broker/BrokerChannel.cpp4
2 files changed, 9 insertions, 10 deletions
diff --git a/cpp/src/qpid/broker/BrokerAdapter.cpp b/cpp/src/qpid/broker/BrokerAdapter.cpp
index 024516fb7b..b733f77390 100644
--- a/cpp/src/qpid/broker/BrokerAdapter.cpp
+++ b/cpp/src/qpid/broker/BrokerAdapter.cpp
@@ -80,7 +80,6 @@ void BrokerAdapter::ChannelHandlerImpl::closeOk(){}
void BrokerAdapter::ExchangeHandlerImpl::declare(uint16_t /*ticket*/, const string& exchange, const string& type,
const string& alternateExchange,
bool passive, bool durable, bool /*autoDelete*/, const FieldTable& args){
-
Exchange::shared_ptr alternate;
if (!alternateExchange.empty()) {
alternate = broker.getExchanges().get(alternateExchange);
@@ -198,6 +197,7 @@ QueueQueryResult BrokerAdapter::QueueHandlerImpl::query(const string& name)
void BrokerAdapter::QueueHandlerImpl::declare(uint16_t /*ticket*/, const string& name, const string& alternateExchange,
bool passive, bool durable, bool exclusive,
bool autoDelete, const qpid::framing::FieldTable& arguments){
+
Exchange::shared_ptr alternate;
if (!alternateExchange.empty()) {
alternate = broker.getExchanges().get(alternateExchange);
@@ -345,14 +345,11 @@ void BrokerAdapter::BasicHandlerImpl::publish(uint16_t /*ticket*/,
bool rejectUnroutable, bool immediate)
{
- Exchange::shared_ptr exchange = exchangeName.empty() ? broker.getExchanges().getDefault() : broker.getExchanges().get(exchangeName);
- if(exchange){
- BasicMessage* msg = new BasicMessage(&connection, exchangeName, routingKey, rejectUnroutable, immediate);
- channel.handlePublish(msg);
- }else{
- throw ChannelException(
- 404, "Exchange not found '" + exchangeName + "'");
- }
+ // exeption moved to ChannelAdaptor -- TODO this code should be removed once basic is removed
+
+ BasicMessage* msg = new BasicMessage(&connection, exchangeName, routingKey, rejectUnroutable, immediate);
+ channel.handlePublish(msg);
+
}
void BrokerAdapter::BasicHandlerImpl::get(uint16_t /*ticket*/, const string& queueName, bool noAck){
diff --git a/cpp/src/qpid/broker/BrokerChannel.cpp b/cpp/src/qpid/broker/BrokerChannel.cpp
index 11d8db73f8..9712b3903f 100644
--- a/cpp/src/qpid/broker/BrokerChannel.cpp
+++ b/cpp/src/qpid/broker/BrokerChannel.cpp
@@ -346,7 +346,9 @@ void Channel::route(Message::shared_ptr msg, Deliverable& strategy) {
cacheExchange = connection.broker.getExchanges().get(routeToExchangeName);
}
- assert(cacheExchange.get());
+ if (!cacheExchange.get() )
+ throw ChannelException(404, "Exchange not found '" + routeToExchangeName + "'");
+
cacheExchange->route(strategy, msg->getRoutingKey(), &(msg->getApplicationHeaders()));
if (!strategy.delivered) {