diff options
author | Alan Conway <aconway@apache.org> | 2009-09-09 20:17:20 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-09-09 20:17:20 +0000 |
commit | d31eb8d8f12a7a0d8e088cd61b619ca9af470678 (patch) | |
tree | f8ae98f8e566e274398cb3ea28fc072951af9db6 /qpid/cpp | |
parent | 9259c46ecb8c5f3e98441080a26914bdea59bffe (diff) | |
download | qpid-python-d31eb8d8f12a7a0d8e088cd61b619ca9af470678.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@813100 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r-- | qpid/cpp/src/qpid/cluster/Connection.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/cluster/Connection.cpp b/qpid/cpp/src/qpid/cluster/Connection.cpp index 4cc977d14a..6873827b81 100644 --- a/qpid/cpp/src/qpid/cluster/Connection.cpp +++ b/qpid/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. |