Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Framework/src/RepositoryBenchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RepositoryBenchmark : public fair::mq::Device

// variables for the timer
boost::asio::deadline_timer* mTimer; /// the asynchronous timer to send monitoring data
boost::asio::io_service io;
boost::asio::io_context io;
std::thread* th;
};

Expand Down
14 changes: 7 additions & 7 deletions Framework/src/ServiceDiscovery.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/io_context.hpp>
#include <iostream>
#include <InfoLogger/InfoLoggerMacros.hxx>
#include <boost/system/error_code.hpp>
Expand Down Expand Up @@ -136,7 +136,7 @@ void ServiceDiscovery::runHealthServer()
threadInfoLogger.setContext(context);

// Find a free port and create the endpoint and the acceptor
boost::asio::io_service io_service;
boost::asio::io_context io_context;
tcp::acceptor* acceptor = nullptr;
size_t port = 0;
std::random_device rd; // obtain a random number from hardware
Expand All @@ -153,7 +153,7 @@ void ServiceDiscovery::runHealthServer()
cycle++;

tcp::endpoint endpoint(tcp::v4(), port);
acceptor = new tcp::acceptor(io_service, endpoint);
acceptor = new tcp::acceptor(io_context, endpoint);
} catch (boost::system::system_error& e) {
ILOG(Debug, Trace) << "ServiceDiscovery::runHealthServer - cound not bind to " << port << ENDM;
continue; // try the next one
Expand All @@ -177,16 +177,16 @@ void ServiceDiscovery::runHealthServer()

// run the thread
try {
boost::asio::deadline_timer timer(io_service);
boost::asio::deadline_timer timer(io_context);
while (mThreadRunning) {
io_service.reset();
io_context.restart();
timer.expires_from_now(boost::posix_time::seconds(1));
acceptor->async_accept([this](boost::system::error_code ec, tcp::socket socket) {
});
timer.async_wait([&](boost::system::error_code ec) {
io_service.stop();
io_context.stop();
});
io_service.run();
io_context.run();
}
} catch (std::exception& e) {
mThreadRunning = false;
Expand Down