diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/lib/broker/AccumulatedAck.cpp | 7 | ||||
-rw-r--r-- | cpp/tests/AccumulatedAckTest.cpp | 16 |
2 files changed, 13 insertions, 10 deletions
diff --git a/cpp/lib/broker/AccumulatedAck.cpp b/cpp/lib/broker/AccumulatedAck.cpp index 2f2a7464c1..5f66adb2b9 100644 --- a/cpp/lib/broker/AccumulatedAck.cpp +++ b/cpp/lib/broker/AccumulatedAck.cpp @@ -18,14 +18,17 @@ * under the License. * */ -#include <AccumulatedAck.h> +#include "AccumulatedAck.h" + +#include <assert.h> using std::less_equal; using std::bind2nd; using namespace qpid::broker; void AccumulatedAck::update(u_int64_t firstTag, u_int64_t lastTag){ - if (firstTag-1 == range) { + assert(firstTag<=lastTag); + if (firstTag <= range+1) { range = lastTag; } else { for (u_int64_t tag = firstTag; tag<=lastTag; tag++) diff --git a/cpp/tests/AccumulatedAckTest.cpp b/cpp/tests/AccumulatedAckTest.cpp index bfd9358422..da984d3e69 100644 --- a/cpp/tests/AccumulatedAckTest.cpp +++ b/cpp/tests/AccumulatedAckTest.cpp @@ -58,14 +58,14 @@ class AccumulatedAckTest : public CppUnit::TestCase { AccumulatedAck ack; ack.clear(); - ack.update(1, false); - ack.update(3, false); - ack.update(10, false); - ack.update(8, false); - ack.update(6, false); - ack.update(3, true); - ack.update(2, true); - ack.update(5, true); + ack.update(1, 1); + ack.update(3, 3); + ack.update(10, 10); + ack.update(8, 8); + ack.update(6, 6); + ack.update(3, 3); + ack.update(2, 2); + ack.update(0, 5); ack.consolidate(); CPPUNIT_ASSERT_EQUAL((u_int64_t) 5, ack.range); CPPUNIT_ASSERT_EQUAL((size_t) 3, ack.individual.size()); |