From 32a91b1044c2fa592cd7e33ea8c54c908b8e04b9 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 5 Dec 2014 13:39:28 +0000 Subject: QPID-6252: AMQP 1.0 browsing client generates large number of errors on broker (better fix) This is a simpler and better fix based on the discussion at: http://qpid.2158936.n2.nabble.com/Re-svn-commit-r1642720-in-qpid-trunk-qpid-cpp-src-qpid-messaging-amqp-AddressHelper-h-ConnectionConth-td7617083.html The changes are all client-side: - A browsing address is unreliable by default. An explicit reliability setting is respected. - The client session does not record pre-settled deliveries in it's unacked list. So by default: - Browsing links are unreliable. Broker sends pre-settled, messages are not recorded in unacked list. - The user is not required to acknowledge browsed messages for proper clean-up. - Calling acknowledge() for a browsed message is a no-op, not an error. If the user explicitly requests a reliable browsing link, then we behave exactly as before. I can't see any value in doing this with qpidd but maybe with some other broker there might be a use for being able to control the accept of browsed messages. This does affect non-browsing, unreliable links but it is an improvement. Settling a pre-settled messages is a no-op, so there is no point in recording pre-settled messages in the unacked list since we do nothing when they are acknoweldged. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1643276 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp | 3 ++- qpid/cpp/src/qpid/messaging/amqp/SessionContext.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp b/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp index 763deb33c6..c6ad8cdb6c 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp @@ -571,7 +571,8 @@ bool AddressHelper::enabled(const std::string& policy, CheckMode mode) const bool AddressHelper::isUnreliable() const { - return reliability == AT_MOST_ONCE || reliability == UNRELIABLE; + return reliability == AT_MOST_ONCE || reliability == UNRELIABLE || + (reliability.empty() && browse); // A browser defaults to unreliable. } const qpid::types::Variant::Map& AddressHelper::getNodeProperties() const diff --git a/qpid/cpp/src/qpid/messaging/amqp/SessionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/SessionContext.cpp index 4e5d71f788..824b958af3 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/SessionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/SessionContext.cpp @@ -113,7 +113,8 @@ uint32_t SessionContext::getUnsettledAcks() qpid::framing::SequenceNumber SessionContext::record(pn_delivery_t* delivery) { qpid::framing::SequenceNumber id = next++; - unacked[id] = delivery; + if (!pn_delivery_settled(delivery)) + unacked[id] = delivery; QPID_LOG(debug, "Recorded delivery " << id << " -> " << delivery); return id; } -- cgit v1.2.1