45 asio::io_context& get_io_context()
47 return GET_IO_CONTEXT(socket_);
62 tcp::endpoint remote_endpoint()
64 return socket_.remote_endpoint();
69 return socket_.is_open();
78 void shutdown_readwrite()
81 socket_.shutdown(asio::socket_base::shutdown_type::shutdown_both, ec);
87 socket_.shutdown(asio::socket_base::shutdown_type::shutdown_send, ec);
93 socket_.shutdown(asio::socket_base::shutdown_type::shutdown_receive, ec);
108 using context = asio::ssl::context;
109 using ssl_socket_t = asio::ssl::stream<tcp::socket>;
110 SSLAdaptor(asio::io_context& io_context, context* ctx):
111 ssl_socket_(
new ssl_socket_t(io_context, *ctx))
114 asio::ssl::stream<tcp::socket>& socket()
119 tcp::socket::lowest_layer_type&
122 return ssl_socket_->lowest_layer();
125 tcp::endpoint remote_endpoint()
127 return raw_socket().remote_endpoint();
132 return ssl_socket_ ? raw_socket().is_open() :
false;
140 raw_socket().close(ec);
144 void shutdown_readwrite()
149 raw_socket().shutdown(asio::socket_base::shutdown_type::shutdown_both, ec);
153 void shutdown_write()
158 raw_socket().shutdown(asio::socket_base::shutdown_type::shutdown_send, ec);
167 raw_socket().shutdown(asio::socket_base::shutdown_type::shutdown_receive, ec);
171 asio::io_context& get_io_context()
173 return GET_IO_CONTEXT(raw_socket());
179 ssl_socket_->async_handshake(asio::ssl::stream_base::server,
180 [f](
const error_code& ec) {
185 std::unique_ptr<asio::ssl::stream<tcp::socket>> ssl_socket_;
tcp::socket & raw_socket()
Get the TCP socket handling data trasfers, regardless of what layer is handling transfers on top of t...
Definition socket_adaptors.h:51