summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/Connection.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-02-11 14:34:07 +0000
committerAlan Conway <aconway@apache.org>2009-02-11 14:34:07 +0000
commitad1285e1deed4a4ce3cabd52500f618cecebe436 (patch)
tree5ee530afe3cc6064ddecef1bf5afad67058764b8 /cpp/src/qpid/cluster/Connection.cpp
parent2c497e4ee2425dec0a977baa02ddae528a75fa5e (diff)
downloadqpid-python-ad1285e1deed4a4ce3cabd52500f618cecebe436.tar.gz
Fix memory leak in cluster code.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@743346 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Connection.cpp')
-rw-r--r--cpp/src/qpid/cluster/Connection.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp
index 3f331978ca..d97a1b6c68 100644
--- a/cpp/src/qpid/cluster/Connection.cpp
+++ b/cpp/src/qpid/cluster/Connection.cpp
@@ -77,11 +77,15 @@ void Connection::init() {
QPID_LOG(debug, cluster << " new connection: " << *this);
if (isLocalClient()) {
cluster.addLocalConnection(this);
- if (cluster.getReadMax())
- output.giveReadCredit(cluster.getReadMax());
+ giveReadCredit(cluster.getReadMax());
}
}
+void Connection::giveReadCredit(int credit) {
+ if (cluster.getReadMax() && credit)
+ output.giveReadCredit(credit);
+}
+
Connection::~Connection() {
QPID_LOG(debug, cluster << " deleted connection: " << *this);
}
@@ -141,8 +145,7 @@ void Connection::deliveredFrame(const EventFrame& f) {
{
connection.received(const_cast<AMQFrame&>(f.frame)); // Pass to broker connection.
}
- if (cluster.getReadMax() && f.readCredit)
- output.giveReadCredit(f.readCredit);
+ giveReadCredit(f.readCredit);
}
// A local connection is closed by the network layer.