File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 22
22
namespace coro_io {
23
23
struct socket_wrapper_t {
24
24
// construct by listen tcp
25
- socket_wrapper_t (){};
25
+ socket_wrapper_t () {};
26
26
socket_wrapper_t (coro_io::ExecutorWrapper<> *executor)
27
27
: socket_(std::make_unique<asio::ip::tcp::socket>(
28
28
executor->get_asio_executor ())),
@@ -76,12 +76,6 @@ struct socket_wrapper_t {
76
76
}
77
77
#endif
78
78
79
- void reset () {
80
- if (socket_) {
81
- *socket_ = asio::ip::tcp::socket (executor_->get_asio_executor ());
82
- }
83
- }
84
-
85
79
private:
86
80
std::unique_ptr<asio::ip::tcp::socket> socket_;
87
81
coro_io::ExecutorWrapper<> *executor_;
@@ -171,8 +165,8 @@ struct socket_wrapper_t {
171
165
ssl_stream_ = std::make_unique<asio::ssl::stream<asio::ip::tcp::socket &>>(
172
166
*socket_, ssl_ctx);
173
167
}
174
- std::unique_ptr<asio::ssl::stream<asio::ip::tcp::socket &>>
175
- & ssl_stream () noexcept {
168
+ std::unique_ptr<asio::ssl::stream<asio::ip::tcp::socket &>> &
169
+ ssl_stream () noexcept {
176
170
return ssl_stream_;
177
171
}
178
172
using tcp_socket_with_ssl_t = asio::ssl::stream<asio::ip::tcp::socket &>;
Original file line number Diff line number Diff line change @@ -530,7 +530,11 @@ class coro_rpc_client {
530
530
531
531
async_simple::coro::Lazy<void > reset () {
532
532
co_await close_socket (control_);
533
- control_->socket_wrapper_ .reset ();
533
+ std::visit (
534
+ [this ](auto &socket_config) {
535
+ return init_socket_wrapper (socket_config);
536
+ },
537
+ config_.socket_config );
534
538
control_->is_timeout_ = false ;
535
539
control_->has_closed_ = false ;
536
540
co_return ;
You can’t perform that action at this time.
0 commit comments