2424#include < boost/algorithm/string/split.hpp>
2525#include < boost/algorithm/string.hpp>
2626#include < boost/asio/ip/tcp.hpp>
27- #include < boost/asio/io_service .hpp>
27+ #include < boost/asio/io_context .hpp>
2828#include < iostream>
2929#include < InfoLogger/InfoLoggerMacros.hxx>
3030#include < boost/system/error_code.hpp>
@@ -136,7 +136,7 @@ void ServiceDiscovery::runHealthServer()
136136 threadInfoLogger.setContext (context);
137137
138138 // Find a free port and create the endpoint and the acceptor
139- boost::asio::io_service io_service ;
139+ boost::asio::io_context io_context ;
140140 tcp::acceptor* acceptor = nullptr ;
141141 size_t port = 0 ;
142142 std::random_device rd; // obtain a random number from hardware
@@ -153,7 +153,7 @@ void ServiceDiscovery::runHealthServer()
153153 cycle++;
154154
155155 tcp::endpoint endpoint (tcp::v4 (), port);
156- acceptor = new tcp::acceptor (io_service , endpoint);
156+ acceptor = new tcp::acceptor (io_context , endpoint);
157157 } catch (boost::system::system_error& e) {
158158 ILOG (Debug, Trace) << " ServiceDiscovery::runHealthServer - cound not bind to " << port << ENDM;
159159 continue ; // try the next one
@@ -177,16 +177,16 @@ void ServiceDiscovery::runHealthServer()
177177
178178 // run the thread
179179 try {
180- boost::asio::deadline_timer timer (io_service );
180+ boost::asio::deadline_timer timer (io_context );
181181 while (mThreadRunning ) {
182- io_service. reset ();
182+ io_context. restart ();
183183 timer.expires_from_now (boost::posix_time::seconds (1 ));
184184 acceptor->async_accept ([this ](boost::system::error_code ec, tcp::socket socket) {
185185 });
186186 timer.async_wait ([&](boost::system::error_code ec) {
187- io_service .stop ();
187+ io_context .stop ();
188188 });
189- io_service .run ();
189+ io_context .run ();
190190 }
191191 } catch (std::exception& e) {
192192 mThreadRunning = false ;
0 commit comments