summaryrefslogtreecommitdiffhomepage
path: root/https.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'https.cpp')
-rw-r--r--https.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/https.cpp b/https.cpp
index 3a68b00..ce3a6fd 100644
--- a/https.cpp
+++ b/https.cpp
@@ -51,6 +51,7 @@ namespace {
// Handles an HTTP server connection
class session : public std::enable_shared_from_this<session>
{
+ boost::asio::io_context& ioc_;
beast::ssl_stream<beast::tcp_stream> stream_;
beast::flat_buffer buffer_;
Server& m_server;
@@ -78,11 +79,13 @@ public:
// Take ownership of the socket
explicit
session(
+ boost::asio::io_context& ioc,
tcp::socket&& socket,
ssl::context& ctx,
- Server& server)
- : stream_(std::move(socket), ctx)
- , m_server(server)
+ Server& server):
+ ioc_(ioc),
+ stream_(std::move(socket), ctx),
+ m_server(server)
{
}
@@ -169,7 +172,7 @@ public:
if (websocket::is_upgrade(req_))
{
beast::get_lowest_layer(stream_).expires_never();
- std::make_shared<websocket_session>(std::move(stream_))->do_accept(parser_->release());
+ std::make_shared<websocket_session>(ioc_, std::move(stream_))->do_accept_in(parser_->release());
return;
}
@@ -313,6 +316,7 @@ private:
{
// Create the session and run it
std::make_shared<session>(
+ ioc_,
std::move(socket),
ctx_,
m_server)->run();