summaryrefslogtreecommitdiff
path: root/qpid/cpp/lib/broker/BrokerQueue.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2006-12-07 12:44:08 +0000
committerGordon Sim <gsim@apache.org>2006-12-07 12:44:08 +0000
commitdbf448f6beaf75d9026d3eefd018608189a05496 (patch)
treee1792098af3163837c1a8cb0f74f298245c3d63e /qpid/cpp/lib/broker/BrokerQueue.cpp
parent6959d7caa27f5da1e0488bbdd67ba3821ff30bfc (diff)
downloadqpid-python-dbf448f6beaf75d9026d3eefd018608189a05496.tar.gz
Added unit test and slightly refactored code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@483437 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/lib/broker/BrokerQueue.cpp')
-rw-r--r--qpid/cpp/lib/broker/BrokerQueue.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qpid/cpp/lib/broker/BrokerQueue.cpp b/qpid/cpp/lib/broker/BrokerQueue.cpp
index a8c5343ca3..bfea1918a4 100644
--- a/qpid/cpp/lib/broker/BrokerQueue.cpp
+++ b/qpid/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{