From 0b84fbe843ec6b15bbf9bcf2e159a48328f4c2f4 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Thu, 3 Jul 2014 08:15:04 +0000 Subject: [QPID-5866]: [C++ client] AMQP 1.0 closing session without closing receiver first marks further messages as redelivered git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1607562 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index e8b0c6c18e..d29b2eae6f 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -139,6 +139,14 @@ void ConnectionContext::endSession(boost::shared_ptr ssn) { qpid::sys::ScopedLock l(lock); if (pn_session_state(ssn->session) & PN_REMOTE_ACTIVE) { + //explicitly release messages that have yet to be fetched + for (boost::shared_ptr lnk = ssn->nextReceiver(); lnk != boost::shared_ptr(); lnk = ssn->nextReceiver()) { + for (pn_delivery_t* d = pn_link_current(lnk->receiver); d; d = pn_link_current(lnk->receiver)) { + pn_link_advance(lnk->receiver); + pn_delivery_update(d, PN_RELEASED); + pn_delivery_settle(d); + } + } //wait for outstanding sends to settle while (!ssn->settled()) { QPID_LOG(debug, "Waiting for sends to settle before closing"); -- cgit v1.2.1