diff options
author | Gordon Sim <gsim@apache.org> | 2011-11-03 16:53:51 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2011-11-03 16:53:51 +0000 |
commit | e2e2e9af14a5e3581530397590e3f4df65315dd8 (patch) | |
tree | f047db59d6a31148c8f091da137d29f60065d2a5 | |
parent | c0ba8ea3bf4463e481712271481f29848018765a (diff) | |
download | qpid-python-e2e2e9af14a5e3581530397590e3f4df65315dd8.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@1197218 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/Connection.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/broker/Connection.cpp b/qpid/cpp/src/qpid/broker/Connection.cpp index 0b3059d26c..8451f35cb0 100644 --- a/qpid/cpp/src/qpid/broker/Connection.cpp +++ b/qpid/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); + } } } |