summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-02-17 14:17:30 +0000
committerAlan Conway <aconway@apache.org>2012-02-17 14:17:30 +0000
commit6677842dee21d086dc030f5839fbad98bad01de2 (patch)
tree04ff5400cb568be529ea193f61777b81ec35c85f
parent08b6a333524ecf56c27ff337967d7328451af791 (diff)
downloadqpid-python-6677842dee21d086dc030f5839fbad98bad01de2.tar.gz
QPID-3603: Fix missing consumer in update.
If a consumer is cancelled while there are unacked messages the consumer will not be present in the session but it will be referenced in the DeliveryRecord. Null out the consumer in this case, it's not needed. git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3603-7@1245557 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/broker/DeliveryRecord.cpp2
-rw-r--r--qpid/cpp/src/qpid/cluster/Connection.cpp10
2 files changed, 9 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/broker/DeliveryRecord.cpp b/qpid/cpp/src/qpid/broker/DeliveryRecord.cpp
index fdb562b7c5..5d6aee9045 100644
--- a/qpid/cpp/src/qpid/broker/DeliveryRecord.cpp
+++ b/qpid/cpp/src/qpid/broker/DeliveryRecord.cpp
@@ -116,7 +116,7 @@ void DeliveryRecord::complete() {
bool DeliveryRecord::accept(TransactionContext* ctxt) {
if (!ended) {
- consumer->acknowledged(getMessage());
+ if (consumer) consumer->acknowledged(getMessage());
if (acquired) queue->dequeue(ctxt, msg);
setEnded();
QPID_LOG(debug, "Accepted " << id);
diff --git a/qpid/cpp/src/qpid/cluster/Connection.cpp b/qpid/cpp/src/qpid/cluster/Connection.cpp
index 00a343d71e..fc6ada096f 100644
--- a/qpid/cpp/src/qpid/cluster/Connection.cpp
+++ b/qpid/cpp/src/qpid/cluster/Connection.cpp
@@ -561,8 +561,14 @@ void Connection::deliveryRecord(const string& qname,
//
}
- broker::DeliveryRecord dr(m, queue, tag, semanticState().find(tag),
- acquired, accepted, windowing, credit);
+ // If a subscription is cancelled while there are unacked messages for it
+ // there won't be a consumer. Just null it out in this case, it isn't needed.
+ boost::shared_ptr<broker::Consumer> consumer;
+ try { consumer = semanticState().find(tag); }
+ catch(...) {}
+
+ broker::DeliveryRecord dr(
+ m, queue, tag, consumer, acquired, accepted, windowing, credit);
dr.setId(id);
if (cancelled) dr.cancel(dr.getTag());
if (completed) dr.complete();