From b2437e45412451cbb9b03a692f3e9c8749bcab27 Mon Sep 17 00:00:00 2001 From: strongwind <1129383669@qq.com> Date: Fri, 20 Sep 2024 17:11:25 +0800 Subject: [PATCH] [BUG]Added support for data balancing when SSL is enabled. snapshot manager add ssl config (#5920) * snapshot manager add ssl config * snapshot manager add ssl config * fix cpplint code style * fix code style * fix code style --------- Co-authored-by: l00416797 Co-authored-by: Wey Gu --- src/kvstore/raftex/SnapshotManager.cpp | 4 +++- src/kvstore/raftex/SnapshotManager.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/kvstore/raftex/SnapshotManager.cpp b/src/kvstore/raftex/SnapshotManager.cpp index ad2ebfbff44..519b09268d5 100644 --- a/src/kvstore/raftex/SnapshotManager.cpp +++ b/src/kvstore/raftex/SnapshotManager.cpp @@ -24,6 +24,8 @@ SnapshotManager::SnapshotManager() { ioThreadPool_.reset(new folly::IOThreadPoolExecutor( FLAGS_snapshot_io_threads, std::make_shared("snapshot-ioexecutor"))); + connManager_.reset( + new thrift::ThriftClientManager(FLAGS_enable_ssl)); } folly::Future>> SnapshotManager::sendSnapshot( @@ -131,7 +133,7 @@ folly::Future SnapshotManager::send( req.done_ref() = finished; auto* evb = ioThreadPool_->getEventBase(); return folly::via(evb, [this, addr, evb, req = std::move(req)]() mutable { - auto client = connManager_.client(addr, evb, false, FLAGS_snapshot_send_timeout_ms); + auto client = connManager_->client(addr, evb, false, FLAGS_snapshot_send_timeout_ms); return client->future_sendSnapshot(req); }); } diff --git a/src/kvstore/raftex/SnapshotManager.h b/src/kvstore/raftex/SnapshotManager.h index ff15e1de07e..86f41a3dbee 100644 --- a/src/kvstore/raftex/SnapshotManager.h +++ b/src/kvstore/raftex/SnapshotManager.h @@ -12,6 +12,7 @@ #include "common/base/Base.h" #include "common/base/StatusOr.h" +#include "common/ssl/SSLConfig.h" #include "common/thrift/ThriftClientManager.h" #include "interface/gen-cpp2/RaftexServiceAsyncClient.h" #include "interface/gen-cpp2/raftex_types.h" @@ -93,7 +94,7 @@ class SnapshotManager { private: std::unique_ptr executor_; std::unique_ptr ioThreadPool_; - thrift::ThriftClientManager connManager_; + std::unique_ptr> connManager_; }; } // namespace raftex