Author: aconway Date: Wed Sep 9 20:17:20 2009 New Revision: 813100 URL: http://svn.apache.org/viewvc?rev=813100&view=rev Log: 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. Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp?rev=813100&r1=813099&r2=813100&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp Wed Sep 9 20:17:20 2009 @@ -156,8 +156,17 @@ 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 @@ if (ss) ss->out(const_cast<AMQFrame&>(f.frame)); } } - giveReadCredit(f.readCredit); } // A local connection is closed by the network layer. --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org