Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/async_web_server_cpp/http_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class HttpConnection : public boost::enable_shared_from_this<HttpConnection>,
void handle_write(const boost::system::error_code& e,
std::vector<ResourcePtr> resources);

boost::asio::io_context::strand strand_;
boost::asio::strand<boost::asio::io_context::executor_type> strand_;
boost::asio::ip::tcp::socket socket_;
HttpServerRequestHandler request_handler_;
boost::array<char, 8192> buffer_;
Expand Down
5 changes: 3 additions & 2 deletions src/http_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace async_web_server_cpp

HttpConnection::HttpConnection(boost::asio::io_context& io_service,
HttpServerRequestHandler handler)
: strand_(io_service), socket_(io_service), request_handler_(handler),
: strand_(io_service.get_executor()), socket_(io_service), request_handler_(handler),
write_in_progress_(false)
{
}
Expand Down Expand Up @@ -77,7 +77,8 @@ void HttpConnection::async_read(ReadHandler callback)
}
socket_.async_read_some(
boost::asio::buffer(buffer_),
strand_.wrap(
boost::asio::bind_executor(
strand_,
boost::bind(&HttpConnection::handle_read_raw, shared_from_this(),
callback, boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)));
Expand Down
2 changes: 1 addition & 1 deletion src/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ HttpServer::HttpServer(const std::string& address, const std::string& port,
{

boost::asio::ip::tcp::resolver resolver(io_service_);
boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port).begin();
boost::asio::ip::tcp::endpoint endpoint = resolver.resolve(address, port).begin()->endpoint();
acceptor_.open(endpoint.protocol());
acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
acceptor_.bind(endpoint);
Expand Down