summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/SemanticState.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-09-15 12:36:56 +0000
committerGordon Sim <gsim@apache.org>2011-09-15 12:36:56 +0000
commit92a9ce855f8425be089f55f889552c23e18e19e2 (patch)
tree85819c81ddf1217cf9b6ce8f98dad090e2d8133b /cpp/src/qpid/broker/SemanticState.cpp
parent14bd966fa802370e09fadaba89f32b5713fe2ebc (diff)
downloadqpid-python-92a9ce855f8425be089f55f889552c23e18e19e2.tar.gz
QPID-3487: Ensure delivery records for cancelled subscriptions are correctly cleaned up
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1171078 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/SemanticState.cpp')
-rw-r--r--cpp/src/qpid/broker/SemanticState.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp
index 37d981d6c4..c2215a99a2 100644
--- a/cpp/src/qpid/broker/SemanticState.cpp
+++ b/cpp/src/qpid/broker/SemanticState.cpp
@@ -125,6 +125,10 @@ bool SemanticState::cancel(const string& tag)
//should cancel all unacked messages for this consumer so that
//they are not redelivered on recovery
for_each(unacked.begin(), unacked.end(), boost::bind(&DeliveryRecord::cancel, _1, tag));
+ //can also remove any records that are now redundant
+ DeliveryRecords::iterator removed =
+ remove_if(unacked.begin(), unacked.end(), bind(&DeliveryRecord::isRedundant, _1));
+ unacked.erase(removed, unacked.end());
return true;
} else {
return false;