summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-08-31 09:36:36 +0000
committerGordon Sim <gsim@apache.org>2007-08-31 09:36:36 +0000
commit5bee610f82db7a87b063aebb404f0f29717a7f01 (patch)
tree4d9f6a2d2b97969158c735c6642792db80f7f028 /cpp/src
parent9767a3b93b4d2f016cfa622b5866acfac1d0ec1f (diff)
downloadqpid-python-5bee610f82db7a87b063aebb404f0f29717a7f01.tar.gz
Fixed bug where stale iterator is used.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@571410 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/AccumulatedAck.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/cpp/src/qpid/broker/AccumulatedAck.cpp b/cpp/src/qpid/broker/AccumulatedAck.cpp
index b5d52ac3be..5603f39410 100644
--- a/cpp/src/qpid/broker/AccumulatedAck.cpp
+++ b/cpp/src/qpid/broker/AccumulatedAck.cpp
@@ -35,10 +35,11 @@ void AccumulatedAck::update(DeliveryId first, DeliveryId last){
Range r(first, last);
bool handled = false;
+ bool markMerged = false;
list<Range>::iterator merged = ranges.end();
if (r.mergeable(mark)) {
mark = r.end;
- merged = ranges.begin();
+ markMerged = true;
handled = true;
} else {
for (list<Range>::iterator i = ranges.begin(); i != ranges.end() && !handled; i++) {
@@ -57,9 +58,9 @@ void AccumulatedAck::update(DeliveryId first, DeliveryId last){
while (!ranges.empty() && ranges.front().end <= mark) {
ranges.pop_front();
}
- //new range is incorporated, but may be possible to consolidate
- if (merged == ranges.begin()) {
- //consolidate mark
+ if (markMerged) {
+ //new range is incorporated, but may be possible to consolidate
+ merged = ranges.begin();
while (merged != ranges.end() && merged->mergeable(mark)) {
mark = merged->end;
merged = ranges.erase(merged);