summaryrefslogtreecommitdiffhomepage
path: root/https.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-09 21:17:26 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-09 21:17:26 +0100
commit1191f07767583a9b19280a4f29cb1b0bd6799785 (patch)
tree55563e05902173f9b809fcc81fce5a979253522a /https.cpp
parentdc2e2b3e293a8374a2627982b521cc6865129c49 (diff)
Websocket proxy
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();