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);
59 auto self = shared_from_this();
63 boost::asio::dispatch(m_stream.get_executor(), [self](){
65 boost::beast::get_lowest_layer(self->m_stream).expires_after(std::chrono::seconds(30));
69 self->m_stream.async_handshake(
70 boost::asio::ssl::stream_base::server,
71 self->m_buffer.data(),
72 boost::beast::bind_front_handler(
73 &connection_tls::on_handshake,
81 on_handshake(boost::beast::error_code ec,
const std::size_t bytes_used)
85 return report_err(ec,
"on_handshake()");
89 m_buffer.consume(bytes_used);
98 boost::beast::get_lowest_layer(m_stream).expires_after(std::chrono::seconds(30));
101 m_stream.async_shutdown(
102 boost::beast::bind_front_handler(
103 &connection_tls::on_shutdown,
110 on_shutdown([[maybe_unused]] boost::beast::error_code ec)
116 std::shared_ptr<boost::asio::ssl::context> m_ctx;
117 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:103