From 68b323ded2433a916f3c452be8ddecb0be38ab4b Mon Sep 17 00:00:00 2001 From: James Date: Wed, 17 Apr 2019 10:48:50 +0800 Subject: [PATCH] [ISSUE #134]Fixed ResponseFuture leak when invokeHeartBeat is failed. (#135) --- src/transport/TcpRemotingClient.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/transport/TcpRemotingClient.cpp b/src/transport/TcpRemotingClient.cpp index e72af1dcd..815137969 100644 --- a/src/transport/TcpRemotingClient.cpp +++ b/src/transport/TcpRemotingClient.cpp @@ -142,12 +142,14 @@ bool TcpRemotingClient::invokeHeartBeat(const string& addr, RemotingCommand& req unique_ptr pRsp(responseFuture->waitResponse(3000)); if (pRsp == NULL) { LOG_ERROR("wait response timeout of heartbeat, so closeTransport of addr:%s", addr.c_str()); + findAndDeleteResponseFuture(opaque); CloseTransport(addr, pTcp); return false; } else if (pRsp->getCode() == SUCCESS_VALUE) { return true; } else { LOG_WARN("get error response:%d of heartbeat to addr:%s", pRsp->getCode(), addr.c_str()); + findAndDeleteResponseFuture(opaque); return false; } } else {