From 92a9ce855f8425be089f55f889552c23e18e19e2 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 15 Sep 2011 12:36:56 +0000 Subject: 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 --- cpp/src/qpid/broker/SemanticState.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cpp/src/qpid/broker/SemanticState.cpp') 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; -- cgit v1.2.1