diff --git a/src/rtsp.cpp b/src/rtsp.cpp index 0180fbee..da20d134 100644 --- a/src/rtsp.cpp +++ b/src/rtsp.cpp @@ -90,8 +90,8 @@ namespace rtsp_stream { class socket_t: public std::enable_shared_from_this { public: - socket_t(boost::asio::io_service &ios, std::function &&handle_data_fn): - handle_data_fn { std::move(handle_data_fn) }, sock { ios } {} + socket_t(boost::asio::io_context &io_context, std::function &&handle_data_fn): + handle_data_fn { std::move(handle_data_fn) }, sock { io_context } {} /** * @brief Queues an asynchronous read to begin the next message. @@ -440,7 +440,7 @@ namespace rtsp_stream { return -1; } - next_socket = std::make_shared(ios, [this](tcp::socket &sock, launch_session_t &session, msg_t &&msg) { + next_socket = std::make_shared(io_context, [this](tcp::socket &sock, launch_session_t &session, msg_t &&msg) { handle_msg(sock, session, std::move(msg)); }); @@ -454,7 +454,7 @@ namespace rtsp_stream { template void iterate(std::chrono::duration timeout) { - ios.run_one_for(timeout); + io_context.run_one_for(timeout); } void @@ -499,7 +499,7 @@ namespace rtsp_stream { } // Queue another asynchronous accept for the next incoming connection - next_socket = std::make_shared(ios, [this](tcp::socket &sock, launch_session_t &session, msg_t &&msg) { + next_socket = std::make_shared(io_context, [this](tcp::socket &sock, launch_session_t &session, msg_t &&msg) { handle_msg(sock, session, std::move(msg)); }); acceptor.async_accept(next_socket->sock, [this](const auto &ec) { @@ -591,8 +591,8 @@ namespace rtsp_stream { } } - if (all && !ios.stopped()) { - ios.stop(); + if (all && !io_context.stopped()) { + io_context.stop(); } } @@ -627,8 +627,8 @@ namespace rtsp_stream { std::chrono::steady_clock::time_point raised_timeout; int _slot_count; - boost::asio::io_service ios; - tcp::acceptor acceptor { ios }; + boost::asio::io_context io_context; + tcp::acceptor acceptor { io_context }; std::shared_ptr next_socket; }; diff --git a/src/stream.cpp b/src/stream.cpp index df5b3d96..0b304e23 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -340,10 +340,10 @@ namespace stream { std::thread audio_thread; std::thread control_thread; - asio::io_service io; + asio::io_context io_context; - udp::socket video_sock { io }; - udp::socket audio_sock { io }; + udp::socket video_sock { io_context }; + udp::socket audio_sock { io_context }; control_server_t control_server; }; @@ -1159,7 +1159,7 @@ namespace stream { auto &message_queue_queue = ctx.message_queue_queue; auto broadcast_shutdown_event = mail::man->event(mail::broadcast_shutdown); - auto &io = ctx.io; + auto &io = ctx.io_context; udp::endpoint peer; @@ -1664,7 +1664,7 @@ namespace stream { audio_packets->stop(); ctx.message_queue_queue->stop(); - ctx.io.stop(); + ctx.io_context.stop(); ctx.video_sock.close(); ctx.audio_sock.close();