qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject qpid-cpp git commit: QPID-7376: don't expire messages if prefetch is 0
Date Wed, 03 Aug 2016 16:59:13 GMT
Repository: qpid-cpp
Updated Branches:
  refs/heads/master 1c510d06f -> 5272790a5


QPID-7376: don't expire messages if prefetch is 0


Project: http://git-wip-us.apache.org/repos/asf/qpid-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-cpp/commit/5272790a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-cpp/tree/5272790a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-cpp/diff/5272790a

Branch: refs/heads/master
Commit: 5272790a5ddd65a44ad711f37e1965df358edebf
Parents: 1c510d0
Author: Gordon Sim <gsim@redhat.com>
Authored: Wed Aug 3 17:58:53 2016 +0100
Committer: Gordon Sim <gsim@redhat.com>
Committed: Wed Aug 3 17:58:53 2016 +0100

----------------------------------------------------------------------
 src/qpid/client/amqp0_10/SessionImpl.cpp |  2 +-
 src/tests/MessagingSessionTests.cpp      | 30 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/5272790a/src/qpid/client/amqp0_10/SessionImpl.cpp
----------------------------------------------------------------------
diff --git a/src/qpid/client/amqp0_10/SessionImpl.cpp b/src/qpid/client/amqp0_10/SessionImpl.cpp
index df3d650..b3bb9d0 100644
--- a/src/qpid/client/amqp0_10/SessionImpl.cpp
+++ b/src/qpid/client/amqp0_10/SessionImpl.cpp
@@ -332,7 +332,7 @@ struct IncomingMessageHandler : IncomingMessages::Handler
 
     bool expire(IncomingMessages::MessageTransfer& transfer)
     {
-        if (receiver && receiver->getName() == transfer.getDestination()) {
+        if (receiver && receiver->getName() == transfer.getDestination()/* &&
receiver->getCapacity() > 0*/) {
             receiver->received();
             return true;
         } else {

http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/5272790a/src/tests/MessagingSessionTests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/MessagingSessionTests.cpp b/src/tests/MessagingSessionTests.cpp
index 3b7ba34..c8e7529 100644
--- a/src/tests/MessagingSessionTests.cpp
+++ b/src/tests/MessagingSessionTests.cpp
@@ -1562,6 +1562,36 @@ QPID_AUTO_TEST_CASE(testClientExpiration)
     BOOST_CHECK_EQUAL(b_count, 50);
 }
 
+QPID_AUTO_TEST_CASE(testClientExpirationNoPrefetch)
+{
+    QueueFixture fix;
+    Receiver receiver = fix.session.createReceiver(fix.queue);
+    receiver.setCapacity(0);
+    Sender sender = fix.session.createSender(fix.queue);
+    for (uint i = 0; i < 50000; ++i) {
+        Message msg((boost::format("a_%1%") % (i+1)).str());
+	msg.setSubject("a");
+	msg.setTtl(Duration(15));
+        sender.send(msg);
+    }
+    for (uint i = 0; i < 50; ++i) {
+        Message msg((boost::format("b_%1%") % (i+1)).str());
+	msg.setSubject("b");
+        sender.send(msg);
+    }
+    Message received;
+    bool done = false;
+    uint b_count = 0;
+    while (!done && receiver.fetch(received, Duration::FOREVER)) {
+        if (received.getSubject() == "b") {
+            b_count++;
+        }
+        done = received.getContent() == "b_50";
+        fix.session.acknowledge();
+    }
+    BOOST_CHECK_EQUAL(b_count, 50);
+}
+
 QPID_AUTO_TEST_CASE(testExpiredPrefetchOnClose)
 {
     QueueFixture fix;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message