You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2021/09/16 01:25:14 UTC

[iotdb] branch iotdb1678 created (now 204531f)

This is an automated email from the ASF dual-hosted git repository.

haonan pushed a change to branch iotdb1678
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 204531f  [IOTDB-1678] Fix client-cpp session bug: can cause connection leak. (#3962)

This branch includes the following new commits:

     new 204531f  [IOTDB-1678] Fix client-cpp session bug: can cause connection leak. (#3962)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[iotdb] 01/01: [IOTDB-1678] Fix client-cpp session bug: can cause connection leak. (#3962)

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch iotdb1678
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 204531f209b89fcb7b88611e309fbd5bfbd1633d
Author: Jamber <ja...@sina.com>
AuthorDate: Wed Sep 15 17:03:02 2021 +0800

    [IOTDB-1678] Fix client-cpp session bug: can cause connection leak. (#3962)
---
 client-cpp/src/main/Session.cpp | 4 ++--
 client-cpp/src/main/Session.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/client-cpp/src/main/Session.cpp b/client-cpp/src/main/Session.cpp
index 2c56492..7f805f9 100644
--- a/client-cpp/src/main/Session.cpp
+++ b/client-cpp/src/main/Session.cpp
@@ -491,7 +491,7 @@ void Session::open(bool enableRPCCompression, int connectionTimeoutInMs) {
         return;
     }
     shared_ptr <TSocket> socket(new TSocket(host, rpcPort));
-    shared_ptr <TTransport> transport(new TFramedTransport(socket));
+    transport = std::make_shared<TFramedTransport> (socket);
     socket->setConnTimeout(connectionTimeoutInMs);
     if (!transport->isOpen()) {
         try {
@@ -557,7 +557,7 @@ void Session::close() {
                 string("Error occurs when closing session at server. Maybe server is down. ") + e.what());
     }
     isClosed = true;
-    if (transport != NULL) {
+    if (transport != nullptr) {
         transport->close();
     }
 }
diff --git a/client-cpp/src/main/Session.h b/client-cpp/src/main/Session.h
index 54dd353..4ea4134 100644
--- a/client-cpp/src/main/Session.h
+++ b/client-cpp/src/main/Session.h
@@ -587,7 +587,7 @@ private:
     std::string password;
     TSProtocolVersion::type protocolVersion = TSProtocolVersion::IOTDB_SERVICE_PROTOCOL_V3;
     std::shared_ptr <TSIServiceIf> client;
-    std::shared_ptr <apache::thrift::transport::TSocket> transport;
+    std::shared_ptr <TTransport> transport;
     bool isClosed = true;
     int64_t sessionId;
     int64_t statementId;