Skip to content

Commit 7f9382f

Browse files
committed
fix asio deprecated functions
1 parent e8b1251 commit 7f9382f

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ else()
8585
INTERFACE
8686
asio::asio
8787
)
88-
endif()
88+
target_compile_definitions(Crow INTERFACE ASIO_NO_DEPRECATED)
89+
endif()
8990

9091
target_compile_definitions(Crow INTERFACE "")
9192

tests/ssl/ssltest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ TEST_CASE("SSL")
4545
asio::io_context ioc;
4646
{
4747
asio::ssl::stream<asio::ip::tcp::socket> c(ioc, ctx);
48-
c.lowest_layer().connect(asio::ip::tcp::endpoint(asio::ip::address::from_string(LOCALHOST_ADDRESS), 45460));
48+
c.lowest_layer().connect(asio::ip::tcp::endpoint(asio::ip::make_address(LOCALHOST_ADDRESS), 45460));
4949

5050
c.handshake(asio::ssl::stream_base::client);
5151
c.write_some(asio::buffer(sendmsg));

tests/unittest.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3986,20 +3986,20 @@ TEST_CASE("task_timer")
39863986
asio::steady_timer t(io_context);
39873987
asio_error_code ec;
39883988

3989-
t.expires_from_now(3 * timer.get_tick_length());
3989+
t.expires_after(3 * timer.get_tick_length());
39903990
t.wait(ec);
39913991
// we are at 3 ticks, nothing be changed yet
39923992
CHECK(!ec);
39933993
CHECK(a == false);
39943994
CHECK(b == false);
3995-
t.expires_from_now(3 * timer.get_tick_length());
3995+
t.expires_after(3 * timer.get_tick_length());
39963996
t.wait(ec);
39973997
// we are at 3+3 = 6 ticks, so first task_timer handler should have runned
39983998
CHECK(!ec);
39993999
CHECK(a == true);
40004000
CHECK(b == false);
40014001

4002-
t.expires_from_now(5 * timer.get_tick_length());
4002+
t.expires_after(5 * timer.get_tick_length());
40034003
t.wait(ec);
40044004
//we are at 3+3 +5 = 11 ticks, both task_timer handlers shoudl have run now
40054005
CHECK(!ec);
@@ -4114,12 +4114,12 @@ TEST_CASE("option_header_passed_in_full")
41144114

41154115
app.wait_for_server_start();
41164116

4117-
asio::io_service is;
4117+
asio::io_context is;
41184118

41194119
auto make_request = [&](const std::string& rq) {
41204120
asio::ip::tcp::socket c(is);
41214121
c.connect(asio::ip::tcp::endpoint(
4122-
asio::ip::address::from_string(LOCALHOST_ADDRESS), 45451));
4122+
asio::ip::make_address(LOCALHOST_ADDRESS), 45451));
41234123
c.send(asio::buffer(rq));
41244124
std::string fullString{};
41254125
asio::error_code error;

0 commit comments

Comments
 (0)