qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1515891 - in /qpid/branches/0.24/qpid: ./ cpp/src/ cpp/src/qpid/broker/ cpp/src/qpid/broker/PriorityQueue.cpp cpp/src/tests/ cpp/src/tests/MessagingSessionTests.cpp
Date Tue, 20 Aug 2013 17:24:41 GMT
Author: gsim
Date: Tue Aug 20 17:24:40 2013
New Revision: 1515891

URL: http://svn.apache.org/r1515891
Log:
QPID-5085: ensure messages released 'behind' a cursor on a priority queue don't get missed
(merged from r1515793)

Modified:
    qpid/branches/0.24/qpid/   (props changed)
    qpid/branches/0.24/qpid/cpp/src/   (props changed)
    qpid/branches/0.24/qpid/cpp/src/qpid/broker/   (props changed)
    qpid/branches/0.24/qpid/cpp/src/qpid/broker/PriorityQueue.cpp
    qpid/branches/0.24/qpid/cpp/src/tests/   (props changed)
    qpid/branches/0.24/qpid/cpp/src/tests/MessagingSessionTests.cpp

Propchange: qpid/branches/0.24/qpid/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid:r1515793

Propchange: qpid/branches/0.24/qpid/cpp/src/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src:r1515793

Propchange: qpid/branches/0.24/qpid/cpp/src/qpid/broker/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src/qpid/broker:r1515793

Modified: qpid/branches/0.24/qpid/cpp/src/qpid/broker/PriorityQueue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.24/qpid/cpp/src/qpid/broker/PriorityQueue.cpp?rev=1515891&r1=1515890&r2=1515891&view=diff
==============================================================================
--- qpid/branches/0.24/qpid/cpp/src/qpid/broker/PriorityQueue.cpp (original)
+++ qpid/branches/0.24/qpid/cpp/src/qpid/broker/PriorityQueue.cpp Tue Aug 20 17:24:40 2013
@@ -135,7 +135,12 @@ void PriorityQueue::publish(const Messag
 Message* PriorityQueue::release(const QueueCursor& cursor)
 {
     MessagePointer* ptr = fifo.release(cursor);
-    return ptr ? &(ptr->holder->message) : 0;
+    if (ptr) {
+        messages[ptr->holder->priority].resetCursors();
+        return &(ptr->holder->message);
+    } else {
+        return 0;
+    }
 }
 
 void PriorityQueue::foreach(Functor f)

Propchange: qpid/branches/0.24/qpid/cpp/src/tests/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src/tests:r1515793

Modified: qpid/branches/0.24/qpid/cpp/src/tests/MessagingSessionTests.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.24/qpid/cpp/src/tests/MessagingSessionTests.cpp?rev=1515891&r1=1515890&r2=1515891&view=diff
==============================================================================
--- qpid/branches/0.24/qpid/cpp/src/tests/MessagingSessionTests.cpp (original)
+++ qpid/branches/0.24/qpid/cpp/src/tests/MessagingSessionTests.cpp Tue Aug 20 17:24:40 2013
@@ -1332,6 +1332,26 @@ QPID_AUTO_TEST_CASE(testReroutingRingQue
     }
 }
 
+QPID_AUTO_TEST_CASE(testReleaseOnPriorityQueue)
+{
+    MessagingFixture fix;
+    std::string queue("queue; {create:always, node:{x-declare:{auto-delete:True, arguments:{qpid.priorities:10}}}}");
+    std::string text("my message");
+    Sender sender = fix.session.createSender(queue);
+    sender.send(Message(text));
+    Receiver receiver = fix.session.createReceiver(queue);
+    Message msg;
+    for (uint i = 0; i < 10; ++i) {
+        if (receiver.fetch(msg, Duration::SECOND)) {
+            BOOST_CHECK_EQUAL(msg.getContent(), text);
+            fix.session.release(msg);
+        } else {
+            BOOST_FAIL("Released message not redelivered as expected.");
+        }
+    }
+    fix.session.acknowledge();
+}
+
 QPID_AUTO_TEST_SUITE_END()
 
 }} // namespace qpid::tests



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


Mime
View raw message