summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-09-09 20:17:20 +0000
committerAlan Conway <aconway@apache.org>2009-09-09 20:17:20 +0000
commitd11c45bdf8e1c72c63c1f5d05fd5c083482e9827 (patch)
tree557effd41cfb1662b91388b2d22b487d758b6fd9 /cpp
parentfbddf29b719cd610b01b2459c4827d636cda6c73 (diff)
downloadqpid-python-d11c45bdf8e1c72c63c1f5d05fd5c083482e9827.tar.gz
Fix QPID-2086, hang of federated_cluster_test_with_node_failure.
cluster::Connection did not give read credit if there was an exception processing a frame. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@813100 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/cluster/Connection.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp
index 4cc977d14a..6873827b81 100644
--- a/cpp/src/qpid/cluster/Connection.cpp
+++ b/cpp/src/qpid/cluster/Connection.cpp
@@ -156,8 +156,17 @@ bool Connection::checkUnsupported(const AMQBody& body) {
return !message.empty();
}
+struct GiveReadCreditOnExit {
+ Connection& connection;
+ int credit;
+ GiveReadCreditOnExit(Connection& connection_, int credit_) :
+ connection(connection_), credit(credit_) {}
+ ~GiveReadCreditOnExit() { connection.giveReadCredit(credit); }
+};
+
// Called in delivery thread, in cluster order.
void Connection::deliveredFrame(const EventFrame& f) {
+ GiveReadCreditOnExit gc(*this, f.readCredit);
assert(!catchUp);
currentChannel = f.frame.getChannel();
if (f.frame.getBody() // frame can be emtpy with just readCredit
@@ -171,7 +180,6 @@ void Connection::deliveredFrame(const EventFrame& f) {
if (ss) ss->out(const_cast<AMQFrame&>(f.frame));
}
}
- giveReadCredit(f.readCredit);
}
// A local connection is closed by the network layer.