diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc index 9ffb034d8..baa85692d 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc @@ -35,7 +35,7 @@ #include -Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_service} +Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context} { for (const auto& address : addresses) { diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h index 291629400..2839b9368 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h @@ -43,7 +43,7 @@ public: bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt); private: - boost::asio::io_service io_service; + boost::asio::io_context io_context; boost::asio::ip::udp::socket socket; boost::system::error_code error; std::vector endpoints; diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index 6fd3129b8..c15d47a76 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -757,7 +757,7 @@ private: : public std::enable_shared_from_this { public: - Tcp_Internal_Client(boost::asio::io_service& io_context, + Tcp_Internal_Client(boost::asio::io_context& io_context, boost::asio::ip::tcp::resolver::iterator endpoint_iterator) : io_context_(io_context), socket_(io_context) { @@ -835,7 +835,7 @@ private: }); } - boost::asio::io_service& io_context_; + boost::asio::io_context& io_context_; boost::asio::ip::tcp::socket socket_; Rtcm_Message read_msg_; std::deque write_msgs_; @@ -845,7 +845,7 @@ private: class Queue_Reader { public: - Queue_Reader(boost::asio::io_service& io_context, std::shared_ptr >& queue, int32_t port) : queue_(queue) + Queue_Reader(boost::asio::io_context& io_context, std::shared_ptr >& queue, int32_t port) : queue_(queue) { boost::asio::ip::tcp::resolver resolver(io_context); std::string host("localhost"); @@ -883,7 +883,7 @@ private: class Tcp_Server { public: - Tcp_Server(boost::asio::io_service& io_context, const boost::asio::ip::tcp::endpoint& endpoint) + Tcp_Server(boost::asio::io_context& io_context, const boost::asio::ip::tcp::endpoint& endpoint) : acceptor_(io_context), socket_(io_context) { acceptor_.open(endpoint.protocol()); @@ -950,7 +950,7 @@ private: bool start_session = true; }; - boost::asio::io_service io_context; + boost::asio::io_context io_context; std::shared_ptr > rtcm_message_queue; std::thread t; std::thread tq; diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index 1d0368a6b..54381158f 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -65,7 +65,7 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address, : gr::sync_block("rtl_tcp_signal_source_c", gr::io_signature::make(0, 0, 0), gr::io_signature::make(1, 1, sizeof(gr_complex))), - socket_(io_service_), + socket_(io_context_), data_(RTL_TCP_PAYLOAD_SIZE), flip_iq_(flip_iq), buffer_(RTL_TCP_BUFFER_SIZE), @@ -147,14 +147,14 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address, boost::asio::async_read(socket_, boost::asio::buffer(data_), boost::bind(&rtl_tcp_signal_source_c::handle_read, this, _1, _2)); - boost::thread(boost::bind(&boost::asio::io_service::run, &io_service_)); + boost::thread(boost::bind(&boost::asio::io_context::run, &io_context_)); } rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c() // NOLINT(modernize-use-equals-default) { mutex_.unlock(); - io_service_.stop(); + io_context_.stop(); not_empty_.notify_one(); not_full_.notify_one(); } @@ -289,7 +289,7 @@ void rtl_tcp_signal_source_c::handle_read(const boost::system::error_code &ec, std::cout << "Error during read: " << ec << std::endl; LOG(WARNING) << "Error during read: " << ec; boost::mutex::scoped_lock lock(mutex_); - io_service_.stop(); + io_context_.stop(); not_empty_.notify_one(); } else @@ -334,7 +334,7 @@ int rtl_tcp_signal_source_c::work(int noutput_items, { auto *out = reinterpret_cast(output_items[0]); int i = 0; - if (io_service_.stopped()) + if (io_context_.stopped()) { return -1; } diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h index 2edbf9db0..8d693157b 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h @@ -91,7 +91,7 @@ private: Rtl_Tcp_Dongle_Info info_; // IO members - boost::asio::io_service io_service_; + boost::asio::io_context io_context_; boost::asio::ip::tcp::socket socket_; std::vector data_; bool flip_iq_; @@ -117,7 +117,7 @@ private: inline bool not_empty() const { - return unread_ > 0 || io_service_.stopped(); + return unread_ > 0 || io_context_.stopped(); } }; diff --git a/src/algorithms/tracking/libs/tcp_communication.cc b/src/algorithms/tracking/libs/tcp_communication.cc index 40cf6bb55..d7012f95d 100644 --- a/src/algorithms/tracking/libs/tcp_communication.cc +++ b/src/algorithms/tracking/libs/tcp_communication.cc @@ -35,7 +35,7 @@ #include -Tcp_Communication::Tcp_Communication() : tcp_socket_(io_service_) {} // NOLINT +Tcp_Communication::Tcp_Communication() : tcp_socket_(io_context_) {} // NOLINT Tcp_Communication::~Tcp_Communication() = default; @@ -47,7 +47,7 @@ int Tcp_Communication::listen_tcp_connection(size_t d_port_, size_t d_port_ch0_) { // Specify IP type and port boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), d_port_); - boost::asio::ip::tcp::acceptor acceptor(io_service_, endpoint); + boost::asio::ip::tcp::acceptor acceptor(io_context_, endpoint); if (d_port_ == d_port_ch0_) { diff --git a/src/algorithms/tracking/libs/tcp_communication.h b/src/algorithms/tracking/libs/tcp_communication.h index d293fa97a..b17eff47f 100644 --- a/src/algorithms/tracking/libs/tcp_communication.h +++ b/src/algorithms/tracking/libs/tcp_communication.h @@ -55,7 +55,7 @@ public: void close_tcp_connection(size_t d_port_); private: - boost::asio::io_service io_service_; + boost::asio::io_context io_context_; boost::asio::ip::tcp::socket tcp_socket_; }; diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc index ae1100d63..5793358ac 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.cc +++ b/src/core/monitor/gnss_synchro_udp_sink.cc @@ -35,7 +35,7 @@ #include #include -Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector addresses, const uint16_t& port, bool enable_protobuf) : socket{io_service} +Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector addresses, const uint16_t& port, bool enable_protobuf) : socket{io_context} { use_protobuf = enable_protobuf; if (enable_protobuf) diff --git a/src/core/monitor/gnss_synchro_udp_sink.h b/src/core/monitor/gnss_synchro_udp_sink.h index f3d5f2830..846d22129 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.h +++ b/src/core/monitor/gnss_synchro_udp_sink.h @@ -52,7 +52,7 @@ public: bool write_gnss_synchro(const std::vector& stocks); private: - boost::asio::io_service io_service; + boost::asio::io_context io_context; boost::asio::ip::udp::socket socket; boost::system::error_code error; std::vector endpoints; diff --git a/src/core/receiver/tcp_cmd_interface.cc b/src/core/receiver/tcp_cmd_interface.cc index 29e62d6e0..f781c3066 100644 --- a/src/core/receiver/tcp_cmd_interface.cc +++ b/src/core/receiver/tcp_cmd_interface.cc @@ -305,10 +305,10 @@ void TcpCmdInterface::run_cmd_server(int tcp_port) boost::system::error_code not_throw; // Socket and acceptor - boost::asio::io_service service; + boost::asio::io_context context; try { - boost::asio::ip::tcp::acceptor acceptor(service, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)); + boost::asio::ip::tcp::acceptor acceptor(context, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)); while (keep_running_) { @@ -316,7 +316,7 @@ void TcpCmdInterface::run_cmd_server(int tcp_port) { std::cout << "TcpCmdInterface: Telecommand TCP interface listening on port " << tcp_port << std::endl; - boost::asio::ip::tcp::socket socket(service); + boost::asio::ip::tcp::socket socket(context); acceptor.accept(socket, not_throw); if (not_throw) {