diff options
author | Gordon Sim <gsim@apache.org> | 2006-12-07 12:44:08 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2006-12-07 12:44:08 +0000 |
commit | ea25bbb6602aa35f7e862e810b99282580cd3684 (patch) | |
tree | 2625393031406ba8709bbfa515468b5f523e979e /cpp/lib/broker/BrokerQueue.cpp | |
parent | 6837709d617692649a22b689f7be6741dd569646 (diff) | |
download | qpid-python-ea25bbb6602aa35f7e862e810b99282580cd3684.tar.gz |
Added unit test and slightly refactored code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@483437 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/broker/BrokerQueue.cpp')
-rw-r--r-- | cpp/lib/broker/BrokerQueue.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cpp/lib/broker/BrokerQueue.cpp b/cpp/lib/broker/BrokerQueue.cpp index a8c5343ca3..bfea1918a4 100644 --- a/cpp/lib/broker/BrokerQueue.cpp +++ b/cpp/lib/broker/BrokerQueue.cpp @@ -161,14 +161,19 @@ u_int32_t Queue::purge(){ } void Queue::pop(){ - if (policy.get()) policy->dequeued(messages.front(), store); + if (policy.get()) policy->dequeued(messages.front()->contentSize()); messages.pop(); } void Queue::push(Message::shared_ptr& msg){ queueing = true; messages.push(msg); - if (policy.get()) policy->enqueued(messages.front(), store); + if (policy.get()) { + policy->enqueued(msg->contentSize()); + if (policy->limitExceeded()) { + msg->releaseContent(store); + } + } } u_int32_t Queue::getMessageCount() const{ |