From b5497c2df7463138efd8a3e9a5b3277067a8f131 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 30 Apr 2015 15:42:28 +0000 Subject: QPID-6521: ensure messages received presettled by peer are settled locally; thanks to Alan Conway for the working patch! git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1677016 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 1 - cpp/src/qpid/messaging/amqp/SessionContext.cpp | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'cpp') diff --git a/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index 586c8a87d6..9d9f186f5c 100644 --- a/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -307,7 +307,6 @@ bool ConnectionContext::get(boost::shared_ptr ssn, boost::shared encoded->init(impl); impl.setEncoded(encoded); impl.setInternalId(ssn->record(current)); - pn_link_advance(lnk->receiver); if (lnk->capacity) { pn_link_flow(lnk->receiver, 1); if (lnk->wakeupToIssueCredit()) { diff --git a/cpp/src/qpid/messaging/amqp/SessionContext.cpp b/cpp/src/qpid/messaging/amqp/SessionContext.cpp index 2b82ffc377..92bdea7dbc 100644 --- a/cpp/src/qpid/messaging/amqp/SessionContext.cpp +++ b/cpp/src/qpid/messaging/amqp/SessionContext.cpp @@ -134,9 +134,13 @@ qpid::framing::SequenceNumber SessionContext::record(pn_delivery_t* delivery) { error.raise(); qpid::framing::SequenceNumber id = next++; - if (!pn_delivery_settled(delivery)) + if (!pn_delivery_settled(delivery)) { unacked[id] = delivery; - QPID_LOG(debug, "Recorded delivery " << id << " -> " << delivery); + QPID_LOG(debug, "Recorded delivery " << id << " -> " << delivery); + pn_link_advance(pn_delivery_link(delivery)); + } else { + pn_delivery_settle(delivery); // Automatically advances the link. + } return id; } -- cgit v1.2.1