From 9f873728a3ddcc13e47d33fccd179d5b0db393a2 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 3 Nov 2011 16:53:51 +0000 Subject: 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 --- cpp/src/qpid/broker/Connection.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'cpp') 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); + } } } -- cgit v1.2.1