diff options
Diffstat (limited to 'doc/html/boost_asio/example/cpp03/http/server3/connection.cpp')
-rw-r--r-- | doc/html/boost_asio/example/cpp03/http/server3/connection.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/doc/html/boost_asio/example/cpp03/http/server3/connection.cpp b/doc/html/boost_asio/example/cpp03/http/server3/connection.cpp index 378ded16b2..9ebe4686c2 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/connection.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/connection.cpp @@ -2,7 +2,7 @@ // connection.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -18,8 +18,8 @@ namespace server3 { connection::connection(boost::asio::io_context& io_context, request_handler& handler) - : strand_(io_context), - socket_(io_context), + : strand_(boost::asio::make_strand(io_context)), + socket_(strand_), request_handler_(handler) { } @@ -32,10 +32,9 @@ boost::asio::ip::tcp::socket& connection::socket() void connection::start() { socket_.async_read_some(boost::asio::buffer(buffer_), - boost::asio::bind_executor(strand_, - boost::bind(&connection::handle_read, shared_from_this(), - boost::asio::placeholders::error, - boost::asio::placeholders::bytes_transferred))); + boost::bind(&connection::handle_read, shared_from_this(), + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred)); } void connection::handle_read(const boost::system::error_code& e, @@ -51,25 +50,22 @@ void connection::handle_read(const boost::system::error_code& e, { request_handler_.handle_request(request_, reply_); boost::asio::async_write(socket_, reply_.to_buffers(), - boost::asio::bind_executor(strand_, - boost::bind(&connection::handle_write, shared_from_this(), - boost::asio::placeholders::error))); + boost::bind(&connection::handle_write, shared_from_this(), + boost::asio::placeholders::error)); } else if (!result) { reply_ = reply::stock_reply(reply::bad_request); boost::asio::async_write(socket_, reply_.to_buffers(), - boost::asio::bind_executor(strand_, - boost::bind(&connection::handle_write, shared_from_this(), - boost::asio::placeholders::error))); + boost::bind(&connection::handle_write, shared_from_this(), + boost::asio::placeholders::error)); } else { socket_.async_read_some(boost::asio::buffer(buffer_), - boost::asio::bind_executor(strand_, - boost::bind(&connection::handle_read, shared_from_this(), - boost::asio::placeholders::error, - boost::asio::placeholders::bytes_transferred))); + boost::bind(&connection::handle_read, shared_from_this(), + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred)); } } |