Prefer `asio::io_context` over `asio::io_service`
Change-Id: I08f136b49e0f03e30d26803be030497ec22eb01f
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index 9b7b796..2c6a32e 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California.
+ * Copyright (c) 2014-2023, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -31,11 +31,6 @@
class TcpClient
{
public:
- TcpClient()
- : socket(ioService)
- {
- }
-
virtual
~TcpClient() = default;
@@ -44,7 +39,7 @@
{
using namespace boost::asio;
- ip::tcp::resolver resolver(ioService);
+ ip::tcp::resolver resolver(ioCtx);
ip::tcp::resolver::query query(host, port);
ip::tcp::resolver::iterator endpoint = resolver.resolve(query);
@@ -69,8 +64,8 @@
}
public:
- boost::asio::io_service ioService;
- boost::asio::ip::tcp::socket socket;
+ boost::asio::io_context ioCtx;
+ boost::asio::ip::tcp::socket socket{ioCtx};
};
template<class Dataset>
@@ -80,8 +75,8 @@
{
public:
TcpBulkInsertFixture()
- : scheduler(ioService)
- , bulkInserter(ioService, *handle)
+ : scheduler(ioCtx)
+ , bulkInserter(ioCtx, *handle)
{
guardEvent = scheduler.schedule(2_s, std::bind(&TcpBulkInsertFixture::fail, this, "Test timed out"));
}
@@ -125,7 +120,7 @@
void
fail(const std::string& info)
{
- ioService.stop();
+ ioCtx.stop();
BOOST_FAIL(info);
}
@@ -137,7 +132,7 @@
socket.close();
bulkInserter.stop();
- // may be ioService.stop() as well
+ // may be ioCtx.stop() as well
}
public:
@@ -155,7 +150,7 @@
this->start("localhost", "17376");
// actually run the test
- this->ioService.run();
+ this->ioCtx.run();
// Read (all items should exist)
for (auto i = this->interests.begin(); i != this->interests.end(); ++i) {