From f570febfa15b63933f14d2bc6605338bccd14974 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 15 Nov 2021 04:41:40 +1100 Subject: Actually commit the source changes for ASIO 1.20.0 update. Also changed the fix to ASIO itself to match the upstream change in commit cd68912b7eb07f24e501e8cbff832b61ec292eea. --- src/lib/util/server_ws_impl.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib/util/server_ws_impl.hpp') diff --git a/src/lib/util/server_ws_impl.hpp b/src/lib/util/server_ws_impl.hpp index dab73b63a67..c1ba9f1a392 100644 --- a/src/lib/util/server_ws_impl.hpp +++ b/src/lib/util/server_ws_impl.hpp @@ -74,10 +74,10 @@ namespace webpp { public: virtual ~Connection() {} - explicit Connection(const std::shared_ptr &socket) : super(0), socket(socket), strand(socket->get_io_service()), closed(false) { } + Connection(asio::io_context &context, const std::shared_ptr &socket) : super(0), socket(socket), strand(context), closed(false) { } private: - explicit Connection(socket_type *socket): super(0), socket(socket), strand(socket->get_io_service()), closed(false) { } + Connection(asio::io_context &context, socket_type *socket): super(0), socket(socket), strand(context), closed(false) { } class SendData { public: @@ -361,7 +361,7 @@ namespace webpp { std::shared_ptr get_timeout_timer(const std::shared_ptr &connection, size_t seconds) { if (seconds == 0) return nullptr; - auto timer = std::make_shared(connection->socket->get_io_service()); + auto timer = std::make_shared(connection->socket->get_executor()); timer->expires_at(std::chrono::system_clock::now() + std::chrono::seconds(static_cast(seconds))); timer->async_wait([connection](const std::error_code& ec){ if(!ec) { @@ -652,7 +652,7 @@ namespace webpp { void timer_idle_init(const std::shared_ptr &connection) { if(config.timeout_idle>0) { - connection->timer_idle= std::make_unique(connection->socket->get_io_service()); + connection->timer_idle= std::make_unique(connection->socket->get_executor()); connection->timer_idle->expires_from_now(std::chrono::seconds(static_cast(config.timeout_idle))); timer_idle_expired_function(connection); } @@ -693,7 +693,7 @@ namespace webpp { void accept() override { //Create new socket for this connection (stored in Connection::socket) //Shared_ptr is used to pass temporary objects to the asynchronous functions - std::shared_ptr connection(new Connection(new WS(*io_context))); + std::shared_ptr connection(new Connection(*io_context, new WS(*io_context))); acceptor->async_accept(*connection->socket, [this, connection](const std::error_code& ec) { //Immediately start accepting a new connection (if io_context hasn't been stopped) -- cgit v1.2.3-70-g09d2