@@ -355,17 +355,18 @@ void close(T * e, websocketpp::connection_hdl hdl) {
355355 e->get_con_from_hdl (hdl)->close (websocketpp::close::status::normal," " );
356356}
357357
358- class test_deadline_timer
358+ class test_system_timer
359359{
360360public:
361- test_deadline_timer (int seconds)
362- : m_timer(m_io_context, boost::posix_time::seconds(seconds) )
361+ test_system_timer (int seconds)
362+ : m_timer(m_io_context)
363363 {
364- m_timer.async_wait (bind (&test_deadline_timer::expired, this , ::_1));
364+ m_timer.expires_after (std::chrono::seconds (seconds));
365+ m_timer.async_wait (bind (&test_system_timer::expired, this , ::_1));
365366 std::size_t (websocketpp::lib::asio::io_context::*run)() = &websocketpp::lib::asio::io_context::run;
366367 m_timer_thread = websocketpp::lib::thread (websocketpp::lib::bind (run, &m_io_context));
367368 }
368- ~test_deadline_timer ()
369+ ~test_system_timer ()
369370 {
370371 m_timer.cancel ();
371372 m_timer_thread.join ();
@@ -381,7 +382,7 @@ class test_deadline_timer
381382 }
382383
383384 websocketpp::lib::asio::io_context m_io_context;
384- websocketpp::lib::asio::deadline_timer m_timer;
385+ websocketpp::lib::asio::system_timer m_timer;
385386 websocketpp::lib::thread m_timer_thread;
386387};
387388
@@ -427,7 +428,7 @@ BOOST_AUTO_TEST_CASE( pong_timeout ) {
427428 websocketpp::lib::thread sthread (websocketpp::lib::bind (&run_server,&s,9005 ,false ));
428429 sleep (1 ); // give the server thread some time to start
429430
430- test_deadline_timer deadline (10 );
431+ test_system_timer deadline (10 );
431432
432433 run_client (c, " http://localhost:9005" ,false );
433434
@@ -448,7 +449,7 @@ BOOST_AUTO_TEST_CASE( client_open_handshake_timeout ) {
448449
449450 sleep (1 ); // give the server thread some time to start
450451
451- test_deadline_timer deadline (10 );
452+ test_system_timer deadline (10 );
452453
453454 run_client (c, " http://localhost:9005" );
454455}
@@ -464,7 +465,7 @@ BOOST_AUTO_TEST_CASE( server_open_handshake_timeout ) {
464465
465466 websocketpp::lib::thread sthread (websocketpp::lib::bind (&run_server,&s,9005 ,false ));
466467
467- test_deadline_timer deadline (10 );
468+ test_system_timer deadline (10 );
468469
469470 sleep (1 ); // give the server thread some time to start
470471
@@ -489,7 +490,7 @@ BOOST_AUTO_TEST_CASE( client_self_initiated_close_handshake_timeout ) {
489490
490491 websocketpp::lib::thread sthread (websocketpp::lib::bind (&run_server,&s,9005 ,false ));
491492
492- test_deadline_timer deadline (10 );
493+ test_system_timer deadline (10 );
493494
494495 sleep (1 ); // give the server thread some time to start
495496
@@ -522,7 +523,7 @@ BOOST_AUTO_TEST_CASE( server_self_initiated_close_handshake_timeout ) {
522523 c.set_open_handler (bind (&delay,::_1,1 ));
523524
524525 websocketpp::lib::thread sthread (websocketpp::lib::bind (&run_server,&s,9005 ,false ));
525- test_deadline_timer deadline (10 );
526+ test_system_timer deadline (10 );
526527
527528 sleep (1 ); // give the server thread some time to start
528529
@@ -534,7 +535,7 @@ BOOST_AUTO_TEST_CASE( server_self_initiated_close_handshake_timeout ) {
534535BOOST_AUTO_TEST_CASE ( client_runs_out_of_work ) {
535536 client c;
536537
537- test_deadline_timer deadline (3 );
538+ test_system_timer deadline (3 );
538539
539540 websocketpp::lib::error_code ec;
540541 c.init_asio (ec);
@@ -600,7 +601,7 @@ BOOST_AUTO_TEST_CASE( stop_listening ) {
600601 c.set_open_handler (bind (&close<client>,&c,::_1));
601602
602603 websocketpp::lib::thread sthread (websocketpp::lib::bind (&run_server,&s,9005 ,false ));
603- test_deadline_timer deadline (5 );
604+ test_system_timer deadline (5 );
604605
605606 sleep (1 ); // give the server thread some time to start
606607
0 commit comments