summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-11-03 16:53:51 +0000
committerGordon Sim <gsim@apache.org>2011-11-03 16:53:51 +0000
commit9f873728a3ddcc13e47d33fccd179d5b0db393a2 (patch)
tree8e78a91444b34cd49daa61c8b530948b24d39d74
parent11fe8c6e9d5e06de5a573e34bfddb691354df1d8 (diff)
downloadqpid-python-9f873728a3ddcc13e47d33fccd179d5b0db393a2.tar.gz
QPID-3553: prevent multiple connection-tune-ok controls from leaving dangling pointers in timer
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1197218 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--cpp/src/qpid/broker/Connection.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/cpp/src/qpid/broker/Connection.cpp b/cpp/src/qpid/broker/Connection.cpp
index 0b3059d26c..8451f35cb0 100644
--- a/cpp/src/qpid/broker/Connection.cpp
+++ b/cpp/src/qpid/broker/Connection.cpp
@@ -443,10 +443,14 @@ void Connection::setHeartbeatInterval(uint16_t heartbeat)
{
setHeartbeat(heartbeat);
if (heartbeat > 0 && !isShadow()) {
- heartbeatTimer = new ConnectionHeartbeatTask(heartbeat, timer, *this);
- timer.add(heartbeatTimer);
- timeoutTimer = new ConnectionTimeoutTask(heartbeat, timer, *this);
- timer.add(timeoutTimer);
+ if (!heartbeatTimer) {
+ heartbeatTimer = new ConnectionHeartbeatTask(heartbeat, timer, *this);
+ timer.add(heartbeatTimer);
+ }
+ if (!timeoutTimer) {
+ timeoutTimer = new ConnectionTimeoutTask(heartbeat, timer, *this);
+ timer.add(timeoutTimer);
+ }
}
}