File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
include/ylt/coro_rpc/impl Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,10 @@ class coro_rpc_server_base {
106106 std::make_unique<coro_io::tcp_server_acceptor>(address));
107107 }
108108
109- coro_rpc_server_base (const server_config &config)
109+ coro_rpc_server_base (
110+ const server_config &config,
111+ std::vector<std::unique_ptr<coro_io::server_acceptor_base>> acceptors =
112+ {})
110113 : pool_(config.thread_num),
111114 conn_timeout_duration_(config.conn_timeout_duration),
112115 flag_{stat::init},
@@ -130,8 +133,8 @@ class coro_rpc_server_base {
130133 init_ibv (config.ibv_config .value (), std::move (config.ibv_dev_lists ));
131134 }
132135#endif
133- if (!config. acceptors .empty ()) {
134- acceptors_ = std::move (config. acceptors );
136+ if (!acceptors.empty ()) {
137+ acceptors_ = std::move (acceptors);
135138 }
136139 else {
137140 acceptors_.push_back (std::make_unique<coro_io::tcp_server_acceptor>(
Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ struct config_t {
3939 std::chrono::steady_clock::duration conn_timeout_duration =
4040 std::chrono::seconds{0 };
4141 std::string address = " 0.0.0.0" ;
42- mutable std::vector<std::unique_ptr<coro_io::server_acceptor_base>> acceptors;
4342#ifdef YLT_ENABLE_SSL
4443 std::optional<ssl_configure> ssl_config = std::nullopt ;
4544#ifdef YLT_ENABLE_NTLS
Original file line number Diff line number Diff line change @@ -50,8 +50,7 @@ TEST_CASE("test server acceptor") {
5050 std::make_unique<coro_io::tcp_server_acceptor>(" 0.0.0.0" , 8824 ));
5151 acceptors.emplace_back (
5252 std::make_unique<coro_io::tcp_server_acceptor>(" localhost" , 8825 ));
53- coro_rpc_server server (
54- coro_rpc::config_t {.acceptors = std::move (acceptors)});
53+ coro_rpc_server server (coro_rpc::config_t {}, std::move (acceptors));
5554 server.register_handler <hello>();
5655
5756 auto res = server.async_start ();
You can’t perform that action at this time.
0 commit comments