3#include "connection.hpp"
4#include "../../core/tcp/stream.hpp"
6#include <boost/beast/ssl/ssl_stream.hpp>
8namespace malloy::server::http
16 public std::enable_shared_from_this<connection_tls>
22 std::shared_ptr<spdlog::logger>
logger,
23 boost::asio::ip::tcp::socket&& socket,
24 std::shared_ptr<boost::asio::ssl::context> ctx,
25 boost::beast::flat_buffer buffer,
26 std::shared_ptr<const std::filesystem::path> doc_root,
27 std::shared_ptr<handler>
router
35 m_ctx(std::move(ctx)),
36 m_stream(std::move(socket), *m_ctx)
42 boost::beast::ssl_stream<malloy::tcp::stream<>>&
49 boost::beast::ssl_stream<malloy::tcp::stream<>>
52 return std::move(m_stream);
58 auto self = shared_from_this();
62 boost::asio::dispatch(m_stream.get_executor(), [self](){
64 boost::beast::get_lowest_layer(self->m_stream).expires_after(std::chrono::seconds(30));
68 self->m_stream.async_handshake(
69 boost::asio::ssl::stream_base::server,
70 self->m_buffer.data(),
71 boost::beast::bind_front_handler(
72 &connection_tls::on_handshake,
79 void on_handshake(boost::beast::error_code ec,
const std::size_t bytes_used)
83 return report_err(ec,
"on_handshake()");
87 m_buffer.consume(bytes_used);
95 boost::beast::get_lowest_layer(m_stream).expires_after(std::chrono::seconds(30));
98 m_stream.async_shutdown(
99 boost::beast::bind_front_handler(
100 &connection_tls::on_shutdown,
106 void on_shutdown([[maybe_unused]] boost::beast::error_code ec)
112 std::shared_ptr<boost::asio::ssl::context> m_ctx;
113 boost::beast::ssl_stream<malloy::tcp::stream<>> m_stream;
Definition: connection_tls.hpp:17
Definition: connection.hpp:41
std::shared_ptr< spdlog::logger > logger() const noexcept
Definition: connection.hpp:184
Definition: router.hpp:104