diff --git a/include/async_web_server_cpp/http_connection.hpp b/include/async_web_server_cpp/http_connection.hpp index 62ccd89..b1cbf6d 100644 --- a/include/async_web_server_cpp/http_connection.hpp +++ b/include/async_web_server_cpp/http_connection.hpp @@ -40,7 +40,7 @@ class HttpConnection : public boost::enable_shared_from_this, ReadHandler; typedef std::shared_ptr ResourcePtr; - explicit HttpConnection(boost::asio::io_service& io_service, + explicit HttpConnection(boost::asio::io_context& io_service, HttpServerRequestHandler request_handler); boost::asio::ip::tcp::socket& socket(); @@ -79,7 +79,7 @@ class HttpConnection : public boost::enable_shared_from_this, void handle_write(const boost::system::error_code& e, std::vector resources); - boost::asio::io_service::strand strand_; + boost::asio::io_context::strand strand_; boost::asio::ip::tcp::socket socket_; HttpServerRequestHandler request_handler_; boost::array buffer_; diff --git a/include/async_web_server_cpp/http_server.hpp b/include/async_web_server_cpp/http_server.hpp index f772f55..98103fb 100644 --- a/include/async_web_server_cpp/http_server.hpp +++ b/include/async_web_server_cpp/http_server.hpp @@ -40,7 +40,7 @@ class HttpServer : private boost::noncopyable void handle_accept(const boost::system::error_code& e); - boost::asio::io_service io_service_; + boost::asio::io_context io_service_; boost::asio::ip::tcp::acceptor acceptor_; std::size_t thread_pool_size_; std::vector> threads_; diff --git a/src/http_connection.cpp b/src/http_connection.cpp index bcb77d4..fb5655c 100644 --- a/src/http_connection.cpp +++ b/src/http_connection.cpp @@ -6,7 +6,7 @@ namespace async_web_server_cpp { -HttpConnection::HttpConnection(boost::asio::io_service& io_service, +HttpConnection::HttpConnection(boost::asio::io_context& io_service, HttpServerRequestHandler handler) : strand_(io_service), socket_(io_service), request_handler_(handler), write_in_progress_(false) diff --git a/src/http_server.cpp b/src/http_server.cpp index 2c1c4ea..d9f7df6 100644 --- a/src/http_server.cpp +++ b/src/http_server.cpp @@ -13,9 +13,7 @@ HttpServer::HttpServer(const std::string& address, const std::string& port, { boost::asio::ip::tcp::resolver resolver(io_service_); - boost::asio::ip::tcp::resolver::query query( - address, port, boost::asio::ip::resolver_query_base::flags()); - boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query); + boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port).begin(); acceptor_.open(endpoint.protocol()); acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); acceptor_.bind(endpoint); @@ -33,7 +31,7 @@ void HttpServer::run() for (std::size_t i = 0; i < thread_pool_size_; ++i) { boost::shared_ptr thread(new boost::thread( - boost::bind(&boost::asio::io_service::run, &io_service_))); + boost::bind(&boost::asio::io_context::run, &io_service_))); threads_.push_back(thread); } }