From 01bcd52924244ec8d2a24c10fcef8959289d09ff Mon Sep 17 00:00:00 2001 From: Lee *!* Clagett Date: Tue, 17 Dec 2024 16:40:15 -0500 Subject: Fix build with boost ASIO 0.87. Support boost 1.66+ --- tests/unit_tests/net.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/unit_tests/net.cpp') diff --git a/tests/unit_tests/net.cpp b/tests/unit_tests/net.cpp index dc79f80a1..16ec7dd21 100644 --- a/tests/unit_tests/net.cpp +++ b/tests/unit_tests/net.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -972,8 +972,8 @@ namespace struct io_thread { - boost::asio::io_service io_service; - boost::asio::io_service::work work; + boost::asio::io_context io_service; + boost::asio::executor_work_guard work; stream_type::socket server; stream_type::acceptor acceptor; boost::thread io; @@ -981,7 +981,7 @@ namespace io_thread() : io_service(), - work(io_service), + work(io_service.get_executor()), server(io_service), acceptor(io_service), io([this] () { try { this->io_service.run(); } catch (const std::exception& e) { MERROR(e.what()); }}), @@ -1021,7 +1021,7 @@ namespace TEST(socks_client, unsupported_command) { - boost::asio::io_service io_service{}; + boost::asio::io_context io_service{}; stream_type::socket client{io_service}; auto test_client = net::socks::make_connect_client( @@ -1039,7 +1039,7 @@ TEST(socks_client, unsupported_command) TEST(socks_client, no_command) { - boost::asio::io_service io_service{}; + boost::asio::io_context io_service{}; stream_type::socket client{io_service}; auto test_client = net::socks::make_connect_client( @@ -1193,7 +1193,7 @@ TEST(socks_connector, host) { io_thread io{}; boost::asio::steady_timer timeout{io.io_service}; - timeout.expires_from_now(std::chrono::seconds{5}); + timeout.expires_after(std::chrono::seconds{5}); boost::unique_future sock = net::socks::connector{io.acceptor.local_endpoint()}("example.com", "8080", timeout); @@ -1220,7 +1220,7 @@ TEST(socks_connector, ipv4) { io_thread io{}; boost::asio::steady_timer timeout{io.io_service}; - timeout.expires_from_now(std::chrono::seconds{5}); + timeout.expires_after(std::chrono::seconds{5}); boost::unique_future sock = net::socks::connector{io.acceptor.local_endpoint()}("250.88.125.99", "8080", timeout); @@ -1246,7 +1246,7 @@ TEST(socks_connector, error) { io_thread io{}; boost::asio::steady_timer timeout{io.io_service}; - timeout.expires_from_now(std::chrono::seconds{5}); + timeout.expires_after(std::chrono::seconds{5}); boost::unique_future sock = net::socks::connector{io.acceptor.local_endpoint()}("250.88.125.99", "8080", timeout); @@ -1272,7 +1272,7 @@ TEST(socks_connector, timeout) { io_thread io{}; boost::asio::steady_timer timeout{io.io_service}; - timeout.expires_from_now(std::chrono::milliseconds{10}); + timeout.expires_after(std::chrono::milliseconds{10}); boost::unique_future sock = net::socks::connector{io.acceptor.local_endpoint()}("250.88.125.99", "8080", timeout); -- cgit v1.2.3