Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1C97610A4F for ; Tue, 20 Aug 2013 17:25:09 +0000 (UTC) Received: (qmail 5452 invoked by uid 500); 20 Aug 2013 17:25:09 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 4896 invoked by uid 500); 20 Aug 2013 17:25:07 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 4869 invoked by uid 99); 20 Aug 2013 17:25:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Aug 2013 17:25:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Aug 2013 17:25:01 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6B2DB238888A; Tue, 20 Aug 2013 17:24:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@qpid.apache.org From: gsim@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130820172441.6B2DB238888A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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