namespace ssl = boost::asio::ssl;
#endif
+// use explicit executor types instead of the type-erased boost::asio::executor
+using executor_type = boost::asio::io_context::executor_type;
+
+using tcp_socket = boost::asio::basic_stream_socket<tcp, executor_type>;
+using tcp_stream = boost::beast::basic_stream<tcp, executor_type>;
+
using parse_buffer = boost::beast::flat_static_buffer<65536>;
// use mmap/mprotect to allocate 512k coroutine stacks
ldout(cct, 4) << "write_data failed: " << ec.message() << dendl;
if (ec==boost::asio::error::broken_pipe) {
boost::system::error_code ec_ignored;
- timeout.socket().shutdown(tcp::socket::shutdown_both, ec_ignored);
+ timeout.socket().shutdown(tcp_socket::shutdown_both, ec_ignored);
}
throw rgw::io::Exception(ec.value(), std::system_category());
}
}
struct Connection : boost::intrusive::list_base_hook<> {
- tcp::socket& socket;
- Connection(tcp::socket& socket) : socket(socket) {}
+ tcp_socket& socket;
+ Connection(tcp_socket& socket) : socket(socket) {}
};
class ConnectionList {
struct Listener {
tcp::endpoint endpoint;
tcp::acceptor acceptor;
- tcp::socket socket;
+ tcp_socket socket;
bool use_ssl = false;
bool use_nodelay = false;
accept(l, ec);
});
- boost::beast::tcp_stream stream(std::move(socket));
+ tcp_stream stream(std::move(socket));
// spawn a coroutine to handle the connection
#ifdef WITH_RADOSGW_BEAST_OPENSSL
if (l.use_ssl) {
Connection conn{s.socket()};
auto c = connections.add(conn);
// wrap the tcp_stream in an ssl stream
- boost::beast::ssl_stream<boost::beast::tcp_stream&> stream{s, *ssl_context};
+ boost::beast::ssl_stream<tcp_stream&> stream{s, *ssl_context};
auto buffer = std::make_unique<parse_buffer>();
// do ssl handshake
boost::system::error_code ec;
// ssl shutdown (ignoring errors)
stream.async_shutdown(yield[ec]);
}
- s.socket().shutdown(tcp::socket::shutdown_both, ec);
+ s.socket().shutdown(tcp_socket::shutdown_both, ec);
}, make_stack_allocator());
} else {
#else
boost::system::error_code ec;
handle_connection(context, env, s, *buffer, false, pause_mutex,
scheduler.get(), ec, yield, request_timeout);
- s.socket().shutdown(tcp::socket::shutdown_both, ec);
+ s.socket().shutdown(tcp_socket::shutdown_both, ec);
}, make_stack_allocator());
}
}