diff options
| author | Gordon Sim <gsim@apache.org> | 2007-05-17 11:03:55 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-05-17 11:03:55 +0000 |
| commit | 9a6c0d41b19744c8e4dc4711d13a5a0afa2f7ed2 (patch) | |
| tree | 539a8102197fa119c7efb77056841932e2eb5c1a /cpp/src/qpid/broker/DirectExchange.cpp | |
| parent | decfd77364e211bc8f8784e15f54e06a79e16675 (diff) | |
| download | qpid-python-9a6c0d41b19744c8e4dc4711d13a5a0afa2f7ed2.tar.gz | |
Changes to support durable exchanges.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@538872 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/DirectExchange.cpp')
| -rw-r--r-- | cpp/src/qpid/broker/DirectExchange.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/cpp/src/qpid/broker/DirectExchange.cpp b/cpp/src/qpid/broker/DirectExchange.cpp index 7d15410374..ec77efa0f3 100644 --- a/cpp/src/qpid/broker/DirectExchange.cpp +++ b/cpp/src/qpid/broker/DirectExchange.cpp @@ -25,29 +25,34 @@ using namespace qpid::broker; using namespace qpid::framing; using namespace qpid::sys; -DirectExchange::DirectExchange(const string& _name) : Exchange(_name) { +DirectExchange::DirectExchange(const string& _name) : Exchange(_name) {} +DirectExchange::DirectExchange(const std::string& _name, bool _durable, const FieldTable& _args) : Exchange(_name, _durable, _args) {} -} - -void DirectExchange::bind(Queue::shared_ptr queue, const string& routingKey, const FieldTable*){ +bool DirectExchange::bind(Queue::shared_ptr queue, const string& routingKey, const FieldTable*){ Mutex::ScopedLock l(lock); std::vector<Queue::shared_ptr>& queues(bindings[routingKey]); std::vector<Queue::shared_ptr>::iterator i = find(queues.begin(), queues.end(), queue); - if(i == queues.end()){ + if (i == queues.end()) { bindings[routingKey].push_back(queue); + return true; + } else{ + return false; } } -void DirectExchange::unbind(Queue::shared_ptr queue, const string& routingKey, const FieldTable* /*args*/){ +bool DirectExchange::unbind(Queue::shared_ptr queue, const string& routingKey, const FieldTable* /*args*/){ Mutex::ScopedLock l(lock); std::vector<Queue::shared_ptr>& queues(bindings[routingKey]); std::vector<Queue::shared_ptr>::iterator i = find(queues.begin(), queues.end(), queue); - if(i < queues.end()){ + if (i < queues.end()) { queues.erase(i); if(queues.empty()){ bindings.erase(routingKey); } + return true; + } else { + return false; } } |
