Boost.ASIO: upgrade io_service=>io_context, finally

This commit is contained in:
2026-05-30 11:59:42 -04:00
parent f100764bd8
commit 4266af545a
26 changed files with 91 additions and 90 deletions
+9 -9
View File
@@ -213,7 +213,7 @@ void UdpCommandDemuxer::setupCommandSocket()
// Create boost wrapper for async operations
cmdEndpointFdDesc = std::make_shared<boost::asio::posix::stream_descriptor>(
componentThread->getIoService(), socketGuard.getFd());
componentThread->getIoContext(), socketGuard.getFd());
// Transfer ownership, prevent auto-close
socketGuard.commit();
@@ -269,7 +269,7 @@ void UdpCommandDemuxer::setupPcloudDataSocket()
// Create boost wrapper for async operations
pcloudDataFdDesc = std::make_shared<boost::asio::posix::stream_descriptor>(
componentThread->getIoService(), socketGuard.getFd());
componentThread->getIoContext(), socketGuard.getFd());
// Transfer ownership, prevent auto-close
socketGuard.commit();
@@ -419,16 +419,16 @@ void UdpCommandDemuxer::processIncomingData()
struct UdpCommandDemuxer::PendingCommandWaitDesc
{
CommandWaitKey key;
boost::asio::io_service &resumeIoService;
boost::asio::io_context &resumeIoContext;
std::atomic<bool> settled{false};
UdpCommandResponseResult result{};
std::coroutine_handle<> callerSchedHandle;
PendingCommandWaitDesc(
CommandWaitKey keyIn,
boost::asio::io_service &resumeIoServiceIn)
boost::asio::io_context &resumeIoContextIn)
: key(std::move(keyIn)),
resumeIoService(resumeIoServiceIn)
resumeIoContext(resumeIoContextIn)
{}
};
@@ -458,7 +458,7 @@ void UdpCommandDemuxer::settlePendingCommandWait(
return;
}
boost::asio::post(wait->resumeIoService, handle);
boost::asio::post(wait->resumeIoContext, handle);
}
std::shared_ptr<UdpCommandDemuxer::PendingCommandWaitDesc>
@@ -518,7 +518,7 @@ UdpCommandDemuxer::waitForCommandResponseCReq(
{
const CommandWaitKey key{deviceIp, cmdSet, cmdId};
auto wait = std::make_shared<PendingCommandWaitDesc>(
key, componentThread->getIoService());
key, componentThread->getIoContext());
{
sscl::SpinLock::Guard guard(pendingWaits.lock);
@@ -577,10 +577,10 @@ UdpCommandDemuxer::waitForCommandResponseCReq(
* request. If the device does not respond within the timeout period,
* we will consider the command to have failed.
*/
boost::asio::io_service &ioService = componentThread->getIoService();
boost::asio::io_context &ioContext = componentThread->getIoContext();
std::optional<std::shared_ptr<boost::asio::deadline_timer>> raceTimer;
auto timerAwaiter = adapters::boostAsio::getDeadlineTimerAReqAwaiter(
ioService,
ioContext,
boost::posix_time::milliseconds(timeoutMs),
raceTimer);
auto responseInvoker = waitForCommandResponseCReq(cmdSet, cmdId, deviceIp);