From b171cc419ae5d2bc747ec2465ad1c76445f8bd37 Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Fri, 11 Sep 2009 13:33:42 +0000 Subject: Joint checkin with cctrieloff. Refactor of exchange routing so that multi-queue policy differences may be resolved and allow for correct multi-queue flow-to-disk behavior. Different queues may have differing policies and persistence properties - these were previously being neglected. New c++ test added. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@813825 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/HeadersExchange.cpp | 34 ++++++++++----------------------- 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'cpp/src/qpid/broker/HeadersExchange.cpp') diff --git a/cpp/src/qpid/broker/HeadersExchange.cpp b/cpp/src/qpid/broker/HeadersExchange.cpp index c628c44909..e4825344a0 100644 --- a/cpp/src/qpid/broker/HeadersExchange.cpp +++ b/cpp/src/qpid/broker/HeadersExchange.cpp @@ -7,9 +7,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -118,31 +118,17 @@ void HeadersExchange::route(Deliverable& msg, const string& /*routingKey*/, cons PreRoute pr(msg, this); - uint32_t count(0); - Bindings::ConstPtr p = bindings.snapshot(); - if (p.get()){ + Bindings::Ptr b(new std::vector >); + if (p.get()) + { for (std::vector::const_iterator i = p->begin(); i != p->end(); ++i) { if (match((*i)->args, *args)) { - msg.deliverTo((*i)->queue); - count++; - if ((*i)->mgmtBinding != 0) - (*i)->mgmtBinding->inc_msgMatched(); + b->push_back(*i); } } } - - if (mgmtExchange != 0) { - mgmtExchange->inc_msgReceives(); - mgmtExchange->inc_byteReceives(msg.contentSize()); - if (count == 0) { - mgmtExchange->inc_msgDrops(); - mgmtExchange->inc_byteDrops(msg.contentSize()); - } else { - mgmtExchange->inc_msgRoutes(count); - mgmtExchange->inc_byteRoutes(count * msg.contentSize()); - } - } + doRoute(msg, b); } @@ -163,7 +149,7 @@ HeadersExchange::~HeadersExchange() {} const std::string HeadersExchange::typeName("headers"); -namespace +namespace { bool match_values(const FieldValue& bind, const FieldValue& msg) { @@ -181,7 +167,7 @@ bool HeadersExchange::match(const FieldTable& bind, const FieldTable& msg) { i != bind.end(); ++i) { - if (i->first != x_match) + if (i->first != x_match) { Map::const_iterator j = msg.find(i->first); if (j == msg.end()) return false; @@ -194,7 +180,7 @@ bool HeadersExchange::match(const FieldTable& bind, const FieldTable& msg) { i != bind.end(); ++i) { - if (i->first != x_match) + if (i->first != x_match) { Map::const_iterator j = msg.find(i->first); if (j != msg.end()) { -- cgit v1.2.1