summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/SemanticState.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-10-05 17:28:48 +0000
committerGordon Sim <gsim@apache.org>2007-10-05 17:28:48 +0000
commit56f678f423f49dff9a79f3f6a0660f00e7da5cc3 (patch)
tree9ce1540e75c51db731ba39266e927f4766107173 /cpp/src/qpid/broker/SemanticState.cpp
parent7defea948eda5d75e2cb665b2c46ab9aecbb73e0 (diff)
downloadqpid-python-56f678f423f49dff9a79f3f6a0660f00e7da5cc3.tar.gz
Don't recover messages for cancelled subscriptions.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@582353 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/SemanticState.cpp')
-rw-r--r--cpp/src/qpid/broker/SemanticState.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp
index e435ed0522..cf16541949 100644
--- a/cpp/src/qpid/broker/SemanticState.cpp
+++ b/cpp/src/qpid/broker/SemanticState.cpp
@@ -95,8 +95,14 @@ void SemanticState::cancel(const string& tag){
// consumers is a ptr_map so erase will delete the consumer
// which will call cancel.
ConsumerImplMap::iterator i = consumers.find(tag);
- if (i != consumers.end())
+ if (i != consumers.end()) {
consumers.erase(i);
+ //should cancel all unacked messages for this consumer so that
+ //they are not redelivered on recovery
+ Mutex::ScopedLock locker(deliveryLock);
+ for_each(unacked.begin(), unacked.end(), boost::bind(mem_fun_ref(&DeliveryRecord::cancel), _1, tag));
+
+ }
}