summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Diener <matt.diener@mongodb.com>2023-01-09 21:24:44 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-01-09 22:44:23 +0000
commit745ce7fed63de72f687f9faf057d90545b4e177d (patch)
treebadcdfe45a3ba1ecc1489b8c4997d16925ecaa51
parent8e68e557760c9c1817dee924129ad8dd9f56344f (diff)
downloadmongo-745ce7fed63de72f687f9faf057d90545b4e177d.tar.gz
SERVER-71906 rename BatonASIO to AsioNetworkingBaton
-rw-r--r--docs/baton.md8
-rw-r--r--src/mongo/transport/README.md2
-rw-r--r--src/mongo/transport/SConscript2
-rw-r--r--src/mongo/transport/asio_networking_baton.cpp (renamed from src/mongo/transport/baton_asio_linux.cpp)52
-rw-r--r--src/mongo/transport/asio_networking_baton.h (renamed from src/mongo/transport/baton_asio_linux.h)18
-rw-r--r--src/mongo/transport/asio_session.h2
-rw-r--r--src/mongo/transport/asio_transport_layer.cpp4
-rw-r--r--src/mongo/transport/asio_transport_layer.h2
-rw-r--r--src/mongo/transport/asio_transport_layer_test.cpp75
9 files changed, 84 insertions, 81 deletions
diff --git a/docs/baton.md b/docs/baton.md
index b0bbd066a6d..0196451f482 100644
--- a/docs/baton.md
+++ b/docs/baton.md
@@ -10,7 +10,7 @@ path. A total of four baton classes are available today:
- [Baton][baton]
- [DefaultBaton][defaultBaton]
- [NetworkingBaton][networkingBaton]
-- [BatonASIO][batonASIO]
+- [AsioNetworkingBaton][asioNetworkingBaton]
## Baton Hierarchy
@@ -39,9 +39,9 @@ and using `OperationContext::getBaton()::schedule(...)`.
Note that this baton is not available for an `OperationContext` that belongs to
a `ServiceContext` with an `AsioTransportLayer` transport layer. In that case,
-the aforementioned interface will return a handle to *BatonASIO*.
+the aforementioned interface will return a handle to *AsioNetworkingBaton*.
-### BatonASIO
+### AsioNetworkingBaton
This baton is only available for Linux and extends *NetworkingBaton* to
implement a networking reactor. It utilizes `poll(2)` and `eventfd(2)` to allow
@@ -60,6 +60,6 @@ must be non-blocking and preferably short-lived to ensure forward progress.
[baton]:https://github.com/mongodb/mongo/blob/5906d967c3144d09fab6a4cc1daddb295df19ffb/src/mongo/db/baton.h#L61-L178
[defaultBaton]: https://github.com/mongodb/mongo/blob/9cfe13115e92a43d1b9273ee1d5817d548264ba7/src/mongo/db/default_baton.h#L46-L75
[networkingBaton]: https://github.com/mongodb/mongo/blob/9cfe13115e92a43d1b9273ee1d5817d548264ba7/src/mongo/transport/baton.h#L61-L96
-[batonASIO]: https://github.com/mongodb/mongo/blob/9cfe13115e92a43d1b9273ee1d5817d548264ba7/src/mongo/transport/baton_asio_linux.h#L60-L529
+[asioNetworkingBaton]: https://github.com/mongodb/mongo/blob/9cfe13115e92a43d1b9273ee1d5817d548264ba7/src/mongo/transport/baton_asio_linux.h#L60-L529
[example]: https://github.com/mongodb/mongo/blob/262e5a961fa7221bfba5722aeea2db719f2149f5/src/mongo/s/multi_statement_transaction_requests_sender.cpp#L91-L99
diff --git a/src/mongo/transport/README.md b/src/mongo/transport/README.md
index c81f4bfd533..d6b9ba2af14 100644
--- a/src/mongo/transport/README.md
+++ b/src/mongo/transport/README.md
@@ -73,7 +73,7 @@ to the client.
## See Also
For details on egress networking, see [this document][egress_networking]. For
details on command dispatch, see [this document][command_dispatch]. For details
-on *NetworkingBaton* and *BatonASIO*, see [this document][baton].
+on *NetworkingBaton* and *AsioNetworkingBaton*, see [this document][baton].
[ServiceExecutor]: service_executor.h
[ServiceStateMachine]: service_state_machine.h
diff --git a/src/mongo/transport/SConscript b/src/mongo/transport/SConscript
index ed708094e8c..d00ae133c78 100644
--- a/src/mongo/transport/SConscript
+++ b/src/mongo/transport/SConscript
@@ -69,10 +69,10 @@ tlEnv.Library(
tlEnv.Library(
target='transport_layer',
source=[
+ 'asio_networking_baton.cpp' if env.TargetOSIs('linux') else [],
'asio_session.cpp',
'asio_transport_layer.cpp',
'asio_utils.cpp',
- 'baton_asio_linux.cpp' if env.TargetOSIs('linux') else [],
'proxy_protocol_header_parser.cpp',
'transport_options.idl',
],
diff --git a/src/mongo/transport/baton_asio_linux.cpp b/src/mongo/transport/asio_networking_baton.cpp
index 86eba10e47f..b463545c4a6 100644
--- a/src/mongo/transport/baton_asio_linux.cpp
+++ b/src/mongo/transport/asio_networking_baton.cpp
@@ -30,7 +30,7 @@
#include <sys/eventfd.h>
-#include "mongo/transport/baton_asio_linux.h"
+#include "mongo/transport/asio_networking_baton.h"
#include "mongo/base/checked_cast.h"
#include "mongo/base/error_codes.h"
@@ -49,7 +49,7 @@ namespace mongo {
namespace transport {
namespace {
-MONGO_FAIL_POINT_DEFINE(blockBatonASIOBeforePoll);
+MONGO_FAIL_POINT_DEFINE(blockAsioNetworkingBatonBeforePoll);
Status getDetachedError() {
return {ErrorCodes::ShutdownInProgress, "Baton detached"};
@@ -62,7 +62,7 @@ Status getCanceledError() {
/**
* RAII type that wraps up an `eventfd` and reading/writing to it.
* We don't use the counter portion and only use the file descriptor (i.e., `fd`) to notify and
- * interrupt the client thread blocked polling (see `BatonASIO::run`).
+ * interrupt the client thread blocked polling (see `AsioNetworkingBaton::run`).
*/
struct EventFDHolder {
EventFDHolder(const EventFDHolder&) = delete;
@@ -140,7 +140,7 @@ public:
} // namespace
-void AsioTransportLayer::BatonASIO::schedule(Task func) noexcept {
+void AsioTransportLayer::AsioNetworkingBaton::schedule(Task func) noexcept {
auto task = [this, func = std::move(func)](stdx::unique_lock<Mutex> lk) mutable {
auto status = _opCtx ? Status::OK() : getDetachedError();
lk.unlock();
@@ -159,12 +159,12 @@ void AsioTransportLayer::BatonASIO::schedule(Task func) noexcept {
notify();
}
-void AsioTransportLayer::BatonASIO::notify() noexcept {
+void AsioTransportLayer::AsioNetworkingBaton::notify() noexcept {
efd(_opCtx).notify();
}
-Waitable::TimeoutState AsioTransportLayer::BatonASIO::run_until(ClockSource* clkSource,
- Date_t deadline) noexcept {
+Waitable::TimeoutState AsioTransportLayer::AsioNetworkingBaton::run_until(
+ ClockSource* clkSource, Date_t deadline) noexcept {
// Set up a timer on the baton with the specified deadline. This synthetic timer is used by
// `_poll()`, which is called through `run()`, to enforce a deadline for the blocking `::poll`.
DummyTimer timer;
@@ -182,7 +182,7 @@ Waitable::TimeoutState AsioTransportLayer::BatonASIO::run_until(ClockSource* clk
}
}
-void AsioTransportLayer::BatonASIO::run(ClockSource* clkSource) noexcept {
+void AsioTransportLayer::AsioNetworkingBaton::run(ClockSource* clkSource) noexcept {
// On the way out, fulfill promises and run scheduled jobs without holding the lock.
std::list<Promise<void>> toFulfill;
const ScopeGuard guard([&] {
@@ -218,7 +218,7 @@ void AsioTransportLayer::BatonASIO::run(ClockSource* clkSource) noexcept {
}
}
-void AsioTransportLayer::BatonASIO::markKillOnClientDisconnect() noexcept {
+void AsioTransportLayer::AsioNetworkingBaton::markKillOnClientDisconnect() noexcept {
auto client = _opCtx->getClient();
invariant(client);
if (auto session = client->session()) {
@@ -229,12 +229,13 @@ void AsioTransportLayer::BatonASIO::markKillOnClientDisconnect() noexcept {
}
}
-Future<void> AsioTransportLayer::BatonASIO::addSession(Session& session, Type type) noexcept {
+Future<void> AsioTransportLayer::AsioNetworkingBaton::addSession(Session& session,
+ Type type) noexcept {
return _addSession(session, type == Type::In ? POLLIN : POLLOUT);
}
-Future<void> AsioTransportLayer::BatonASIO::waitUntil(const ReactorTimer& reactorTimer,
- Date_t expiration) noexcept try {
+Future<void> AsioTransportLayer::AsioNetworkingBaton::waitUntil(const ReactorTimer& reactorTimer,
+ Date_t expiration) noexcept try {
auto pf = makePromiseFuture<void>();
_safeExecute(stdx::unique_lock(_mutex),
[this, expiration, timer = Timer{reactorTimer.id(), std::move(pf.promise)}](
@@ -247,8 +248,8 @@ Future<void> AsioTransportLayer::BatonASIO::waitUntil(const ReactorTimer& reacto
return ex.toStatus();
}
-Future<void> AsioTransportLayer::BatonASIO::waitUntil(Date_t expiration,
- const CancellationToken& token) noexcept try {
+Future<void> AsioTransportLayer::AsioNetworkingBaton::waitUntil(
+ Date_t expiration, const CancellationToken& token) noexcept try {
auto pf = makePromiseFuture<void>();
DummyTimer dummy;
const size_t timerId = dummy.id();
@@ -269,7 +270,7 @@ Future<void> AsioTransportLayer::BatonASIO::waitUntil(Date_t expiration,
return ex.toStatus();
}
-bool AsioTransportLayer::BatonASIO::cancelSession(Session& session) noexcept {
+bool AsioTransportLayer::AsioNetworkingBaton::cancelSession(Session& session) noexcept {
const auto id = session.id();
stdx::unique_lock lk(_mutex);
@@ -291,12 +292,12 @@ bool AsioTransportLayer::BatonASIO::cancelSession(Session& session) noexcept {
return true;
}
-bool AsioTransportLayer::BatonASIO::cancelTimer(const ReactorTimer& timer) noexcept {
+bool AsioTransportLayer::AsioNetworkingBaton::cancelTimer(const ReactorTimer& timer) noexcept {
const auto id = timer.id();
return _cancelTimer(id);
}
-bool AsioTransportLayer::BatonASIO::_cancelTimer(size_t id) noexcept {
+bool AsioTransportLayer::AsioNetworkingBaton::_cancelTimer(size_t id) noexcept {
stdx::unique_lock lk(_mutex);
if (_timersById.find(id) == _timersById.end())
return false;
@@ -317,13 +318,13 @@ bool AsioTransportLayer::BatonASIO::_cancelTimer(size_t id) noexcept {
return true;
}
-bool AsioTransportLayer::BatonASIO::canWait() noexcept {
+bool AsioTransportLayer::AsioNetworkingBaton::canWait() noexcept {
stdx::lock_guard lk(_mutex);
return _opCtx;
}
-void AsioTransportLayer::BatonASIO::_safeExecute(stdx::unique_lock<Mutex> lk,
- AsioTransportLayer::BatonASIO::Job job) {
+void AsioTransportLayer::AsioNetworkingBaton::_safeExecute(
+ stdx::unique_lock<Mutex> lk, AsioTransportLayer::AsioNetworkingBaton::Job job) {
if (!_opCtx) {
// If we're detached, no job can safely execute.
iasserted(getDetachedError());
@@ -337,8 +338,8 @@ void AsioTransportLayer::BatonASIO::_safeExecute(stdx::unique_lock<Mutex> lk,
}
}
-std::list<Promise<void>> AsioTransportLayer::BatonASIO::_poll(stdx::unique_lock<Mutex>& lk,
- ClockSource* clkSource) {
+std::list<Promise<void>> AsioTransportLayer::AsioNetworkingBaton::_poll(
+ stdx::unique_lock<Mutex>& lk, ClockSource* clkSource) {
const auto now = clkSource->now();
// If we have a timer, then use it to enforce a timeout for polling.
@@ -379,7 +380,7 @@ std::list<Promise<void>> AsioTransportLayer::BatonASIO::_poll(stdx::unique_lock<
_inPoll = false;
});
- blockBatonASIOBeforePoll.pauseWhileSet();
+ blockAsioNetworkingBatonBeforePoll.pauseWhileSet();
int timeout = deadline ? Milliseconds(*deadline - now).count() : -1;
int events = ::poll(_pollSet.data(), _pollSet.size(), timeout);
if (events < 0) {
@@ -414,7 +415,8 @@ std::list<Promise<void>> AsioTransportLayer::BatonASIO::_poll(stdx::unique_lock<
return promises;
}
-Future<void> AsioTransportLayer::BatonASIO::_addSession(Session& session, short events) try {
+Future<void> AsioTransportLayer::AsioNetworkingBaton::_addSession(Session& session,
+ short events) try {
auto pf = makePromiseFuture<void>();
TransportSession ts{checked_cast<AsioSession&>(session).getSocket().native_handle(),
events,
@@ -429,7 +431,7 @@ Future<void> AsioTransportLayer::BatonASIO::_addSession(Session& session, short
return ex.toStatus();
}
-void AsioTransportLayer::BatonASIO::detachImpl() noexcept {
+void AsioTransportLayer::AsioNetworkingBaton::detachImpl() noexcept {
decltype(_scheduled) scheduled;
decltype(_sessions) sessions;
decltype(_timers) timers;
diff --git a/src/mongo/transport/baton_asio_linux.h b/src/mongo/transport/asio_networking_baton.h
index a71b53c4cb8..6103d655063 100644
--- a/src/mongo/transport/baton_asio_linux.h
+++ b/src/mongo/transport/asio_networking_baton.h
@@ -53,11 +53,11 @@ namespace transport {
*
* We implement our networking reactor on top of poll + eventfd for wakeups
*/
-class AsioTransportLayer::BatonASIO : public NetworkingBaton {
+class AsioTransportLayer::AsioNetworkingBaton : public NetworkingBaton {
public:
- BatonASIO(OperationContext* opCtx) : _opCtx(opCtx) {}
+ AsioNetworkingBaton(OperationContext* opCtx) : _opCtx(opCtx) {}
- ~BatonASIO() {
+ ~AsioNetworkingBaton() {
invariant(!_opCtx);
invariant(_sessions.empty());
invariant(_scheduled.empty());
@@ -105,11 +105,11 @@ private:
bool _cancelTimer(size_t timerId) noexcept;
/*
- * Internally, `BatonASIO` thinks in terms of synchronized units of work. This is because a
- * baton effectively represents a green thread with the potential to add or remove work (i.e.,
- * jobs) at any time. Thus, scheduled jobs must release their lock before executing any task
- * external to the baton (e.g., `OutOfLineExecutor::Task`, `TransportSession:promise`, and
- * `ReactorTimer::promise`).
+ * Internally, `AsioNetworkingBaton` thinks in terms of synchronized units of work. This is
+ * because a baton effectively represents a green thread with the potential to add or remove
+ * work (i.e., jobs) at any time. Thus, scheduled jobs must release their lock before executing
+ * any task external to the baton (e.g., `OutOfLineExecutor::Task`, `TransportSession:promise`,
+ * and `ReactorTimer::promise`).
*/
using Job = unique_function<void(stdx::unique_lock<Mutex>)>;
@@ -141,7 +141,7 @@ private:
void detachImpl() noexcept override;
- Mutex _mutex = MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "BatonASIO::_mutex");
+ Mutex _mutex = MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "AsioNetworkingBaton::_mutex");
OperationContext* _opCtx;
diff --git a/src/mongo/transport/asio_session.h b/src/mongo/transport/asio_session.h
index c85554683dc..781fcc95817 100644
--- a/src/mongo/transport/asio_session.h
+++ b/src/mongo/transport/asio_session.h
@@ -150,7 +150,7 @@ public:
protected:
friend class AsioTransportLayer;
- friend AsioTransportLayer::BatonASIO;
+ friend class AsioTransportLayer::AsioNetworkingBaton;
#ifdef MONGO_CONFIG_SSL
// Constructs a SSL socket required to initiate SSL handshake for egress connections.
diff --git a/src/mongo/transport/asio_transport_layer.cpp b/src/mongo/transport/asio_transport_layer.cpp
index e96df2dc36d..4d4fa0daade 100644
--- a/src/mongo/transport/asio_transport_layer.cpp
+++ b/src/mongo/transport/asio_transport_layer.cpp
@@ -73,7 +73,7 @@
// asio_session.h has some header dependencies that require it to be the last header.
#ifdef __linux__
-#include "mongo/transport/baton_asio_linux.h"
+#include "mongo/transport/asio_networking_baton.h"
#endif
#include "mongo/transport/asio_session.h"
@@ -1675,7 +1675,7 @@ AsioTransportLayer::createTransientSSLContext(const TransientSSLParams& transien
BatonHandle AsioTransportLayer::makeBaton(OperationContext* opCtx) const {
invariant(!opCtx->getBaton());
- auto baton = std::make_shared<BatonASIO>(opCtx);
+ auto baton = std::make_shared<AsioNetworkingBaton>(opCtx);
opCtx->setBaton(baton);
return baton;
diff --git a/src/mongo/transport/asio_transport_layer.h b/src/mongo/transport/asio_transport_layer.h
index b428c514347..7391b2595fb 100644
--- a/src/mongo/transport/asio_transport_layer.h
+++ b/src/mongo/transport/asio_transport_layer.h
@@ -234,7 +234,7 @@ public:
#endif
private:
- class BatonASIO;
+ class AsioNetworkingBaton;
class AsioSession;
class ASIOReactor;
diff --git a/src/mongo/transport/asio_transport_layer_test.cpp b/src/mongo/transport/asio_transport_layer_test.cpp
index 9f856e023fe..9b128c0409e 100644
--- a/src/mongo/transport/asio_transport_layer_test.cpp
+++ b/src/mongo/transport/asio_transport_layer_test.cpp
@@ -836,11 +836,12 @@ TEST_F(AsioTransportLayerWithServiceContextTest, ShutdownDuringSSLHandshake) {
#ifdef __linux__
/**
- * Creates a connection between a client and a server, then runs tests against the `BatonASIO`
- * associated with the server-side of the connection (i.e., `Client`). The client-side of this
- * connection is associated with `_connThread`, and the server-side is wrapped inside `_client`.
+ * Creates a connection between a client and a server, then runs tests against the
+ * `AsioNetworkingBaton` associated with the server-side of the connection (i.e., `Client`). The
+ * client-side of this connection is associated with `_connThread`, and the server-side is wrapped
+ * inside `_client`.
*/
-class BatonASIOLinuxTest : public LockerNoopServiceContextTest {
+class LinuxAsioNetworkingBatonTest : public LockerNoopServiceContextTest {
// A service entry point that accepts one, and only one, connection.
class SingleSessionSEP : public ServiceEntryPoint {
public:
@@ -946,7 +947,7 @@ void waitForTimesEntered(const FailPointEnableBlock& fp, FailPoint::EntryCountT
fp->waitForTimesEntered(fp.initialTimesEntered() + times);
}
-TEST_F(BatonASIOLinuxTest, CanWait) {
+TEST_F(LinuxAsioNetworkingBatonTest, CanWait) {
auto opCtx = client().makeOperationContext();
BatonHandle baton = opCtx->getBaton(); // ensures the baton outlives its opCtx.
@@ -958,7 +959,7 @@ TEST_F(BatonASIOLinuxTest, CanWait) {
ASSERT_FALSE(netBaton->canWait());
}
-TEST_F(BatonASIOLinuxTest, MarkKillOnClientDisconnect) {
+TEST_F(LinuxAsioNetworkingBatonTest, MarkKillOnClientDisconnect) {
auto opCtx = client().makeOperationContext();
opCtx->markKillOnClientDisconnect();
ASSERT_FALSE(opCtx->isKillPending());
@@ -970,7 +971,7 @@ TEST_F(BatonASIOLinuxTest, MarkKillOnClientDisconnect) {
ASSERT_EQ(opCtx->getKillStatus(), ErrorCodes::ClientDisconnect);
}
-TEST_F(BatonASIOLinuxTest, Schedule) {
+TEST_F(LinuxAsioNetworkingBatonTest, Schedule) {
// Note that the baton runs all scheduled jobs on the main test thread, so it's safe to use
// assertions inside tasks scheduled on the baton.
auto opCtx = client().makeOperationContext();
@@ -1005,7 +1006,7 @@ TEST_F(BatonASIOLinuxTest, Schedule) {
ASSERT_FALSE(pending);
}
-TEST_F(BatonASIOLinuxTest, AddAndRemoveSession) {
+TEST_F(LinuxAsioNetworkingBatonTest, AddAndRemoveSession) {
auto opCtx = client().makeOperationContext();
auto baton = opCtx->getBaton()->networking();
@@ -1015,7 +1016,7 @@ TEST_F(BatonASIOLinuxTest, AddAndRemoveSession) {
ASSERT_THROWS_CODE(future.get(), DBException, ErrorCodes::CallbackCanceled);
}
-TEST_F(BatonASIOLinuxTest, AddAndRemoveSessionWhileInPoll) {
+TEST_F(LinuxAsioNetworkingBatonTest, AddAndRemoveSessionWhileInPoll) {
// Attempts to add and remove a session while the baton is polling. This, for example, could
// happen on `mongos` while an operation is blocked, waiting for `AsyncDBClient` to create an
// egress connection, and then the connection has to be ended for some reason before the baton
@@ -1027,7 +1028,7 @@ TEST_F(BatonASIOLinuxTest, AddAndRemoveSessionWhileInPoll) {
auto baton = opCtx->getBaton()->networking();
auto session = client().session();
- FailPointEnableBlock fp("blockBatonASIOBeforePoll");
+ FailPointEnableBlock fp("blockAsioNetworkingBatonBeforePoll");
isReady.set();
waitForTimesEntered(fp, 1);
@@ -1041,19 +1042,19 @@ TEST_F(BatonASIOLinuxTest, AddAndRemoveSessionWhileInPoll) {
ASSERT_FALSE(cancelSessionResult.get(opCtx.get()));
}
-TEST_F(BatonASIOLinuxTest, WaitAndNotify) {
- // Exercises the underlying `wait` and `notify` functionality through `BatonASIO::run` and
- // `BatonASIO::schedule`, respectively. Here is how this is done:
- // 1) The main thread starts polling (from inside `run`) when waiting on the notification.
- // 2) Once the main thread is ready to poll, `thread` notifies it through `baton->schedule`.
- // 3) `schedule` calls into `notify` internally, which should interrupt the polling.
- // 4) Once polling is interrupted, `baton` runs the scheduled job and sets the notification.
+TEST_F(LinuxAsioNetworkingBatonTest, WaitAndNotify) {
+ // Exercises the underlying `wait` and `notify` functionality through `AsioNetworkingBaton::run`
+ // and `AsioNetworkingBaton::schedule`, respectively. Here is how this is done: 1) The main
+ // thread starts polling (from inside `run`) when waiting on the notification. 2) Once the main
+ // thread is ready to poll, `thread` notifies it through `baton->schedule`. 3) `schedule` calls
+ // into `notify` internally, which should interrupt the polling. 4) Once polling is interrupted,
+ // `baton` runs the scheduled job and sets the notification.
auto opCtx = client().makeOperationContext();
Notification<void> notification;
MilestoneThread thread([&](Notification<void>& isReady) {
auto baton = opCtx->getBaton()->networking();
- FailPointEnableBlock fp("blockBatonASIOBeforePoll");
+ FailPointEnableBlock fp("blockAsioNetworkingBatonBeforePoll");
isReady.set();
waitForTimesEntered(fp, 1);
baton->schedule([&](Status) { notification.set(); });
@@ -1067,22 +1068,22 @@ void blockIfBatonPolls(Client& client,
Notification<void> notification;
auto opCtx = client.makeOperationContext();
- FailPointEnableBlock fp("blockBatonASIOBeforePoll");
+ FailPointEnableBlock fp("blockAsioNetworkingBatonBeforePoll");
modifyBaton(opCtx->getBaton(), notification);
- // This will internally call into `BatonASIO::run()`, which will block forever (since the
- // failpoint is enabled) if the baton starts polling.
+ // This will internally call into `AsioNetworkingBaton::run()`, which will block forever (since
+ // the failpoint is enabled) if the baton starts polling.
notification.get(opCtx.get());
}
-TEST_F(BatonASIOLinuxTest, BatonWithPendingTasksNeverPolls) {
+TEST_F(LinuxAsioNetworkingBatonTest, BatonWithPendingTasksNeverPolls) {
blockIfBatonPolls(client(), [](const BatonHandle& baton, Notification<void>& notification) {
baton->schedule([&](Status) { notification.set(); });
});
}
-TEST_F(BatonASIOLinuxTest, BatonWithAnExpiredTimerNeverPolls) {
+TEST_F(LinuxAsioNetworkingBatonTest, BatonWithAnExpiredTimerNeverPolls) {
auto timer = makeDummyTimer();
auto clkSource = getServiceContext()->getPreciseClockSource();
@@ -1102,7 +1103,7 @@ TEST_F(BatonASIOLinuxTest, BatonWithAnExpiredTimerNeverPolls) {
});
}
-TEST_F(BatonASIOLinuxTest, WaitUntilWithUncancellableTokenFiresAtDeadline) {
+TEST_F(LinuxAsioNetworkingBatonTest, WaitUntilWithUncancellableTokenFiresAtDeadline) {
auto opCtx = client().makeOperationContext();
auto baton = opCtx->getBaton()->networking();
auto deadline = Date_t::now() + Milliseconds(10);
@@ -1115,7 +1116,7 @@ TEST_F(BatonASIOLinuxTest, WaitUntilWithUncancellableTokenFiresAtDeadline) {
ASSERT_EQ(fut.getNoThrow(opCtx.get()), Status::OK());
}
-TEST_F(BatonASIOLinuxTest, WaitUntilWithCanceledTokenIsCanceled) {
+TEST_F(LinuxAsioNetworkingBatonTest, WaitUntilWithCanceledTokenIsCanceled) {
CancellationSource source;
auto token = source.token();
auto opCtx = client().makeOperationContext();
@@ -1127,11 +1128,11 @@ TEST_F(BatonASIOLinuxTest, WaitUntilWithCanceledTokenIsCanceled) {
ASSERT_EQ(fut.getNoThrow(opCtx.get()), expectedError);
}
-TEST_F(BatonASIOLinuxTest, NotifyInterruptsRunUntilBeforeTimeout) {
+TEST_F(LinuxAsioNetworkingBatonTest, NotifyInterruptsRunUntilBeforeTimeout) {
auto opCtx = client().makeOperationContext();
MilestoneThread thread([&](Notification<void>& isReady) {
auto baton = opCtx->getBaton();
- FailPointEnableBlock fp("blockBatonASIOBeforePoll");
+ FailPointEnableBlock fp("blockAsioNetworkingBatonBeforePoll");
isReady.set();
waitForTimesEntered(fp, 1);
baton->notify();
@@ -1142,21 +1143,21 @@ TEST_F(BatonASIOLinuxTest, NotifyInterruptsRunUntilBeforeTimeout) {
ASSERT(state == Waitable::TimeoutState::NoTimeout);
}
-TEST_F(BatonASIOLinuxTest, RunUntilProperlyTimesout) {
+TEST_F(LinuxAsioNetworkingBatonTest, RunUntilProperlyTimesout) {
auto opCtx = client().makeOperationContext();
auto clkSource = getServiceContext()->getPreciseClockSource();
const auto state = opCtx->getBaton()->run_until(clkSource, clkSource->now() + Milliseconds(1));
ASSERT(state == Waitable::TimeoutState::Timeout);
}
-TEST_F(BatonASIOLinuxTest, AddAndRemoveTimerWhileInPoll) {
+TEST_F(LinuxAsioNetworkingBatonTest, AddAndRemoveTimerWhileInPoll) {
auto opCtx = client().makeOperationContext();
Notification<bool> cancelTimerResult;
MilestoneThread thread([&](Notification<void>& isReady) {
auto baton = opCtx->getBaton()->networking();
- FailPointEnableBlock fp("blockBatonASIOBeforePoll");
+ FailPointEnableBlock fp("blockAsioNetworkingBatonBeforePoll");
isReady.set();
waitForTimesEntered(fp, 1);
@@ -1171,7 +1172,7 @@ TEST_F(BatonASIOLinuxTest, AddAndRemoveTimerWhileInPoll) {
ASSERT_FALSE(cancelTimerResult.get(opCtx.get()));
}
-DEATH_TEST_F(BatonASIOLinuxTest, AddAnAlreadyAddedSession, "invariant") {
+DEATH_TEST_F(LinuxAsioNetworkingBatonTest, AddAnAlreadyAddedSession, "invariant") {
auto opCtx = client().makeOperationContext();
auto baton = opCtx->getBaton()->networking();
auto session = client().session();
@@ -1180,11 +1181,11 @@ DEATH_TEST_F(BatonASIOLinuxTest, AddAnAlreadyAddedSession, "invariant") {
baton->addSession(*session, transport::NetworkingBaton::Type::In).getAsync([](Status) {});
}
-// This could be considered a test for either `AsioSession` or `BatonASIOLinux`, as it's testing the
-// interaction between the two when `AsioSession` calls `addSession` and `cancelAsyncOperations` on
-// the networking baton. This is currently added to the `BatonASIOLinuxTest` fixture to utilize the
-// existing infrastructure.
-TEST_F(BatonASIOLinuxTest, CancelAsyncOperationsInterruptsOngoingOperations) {
+// This could be considered a test for either `AsioSession` or `AsioNetworkingBatonLinux`, as it's
+// testing the interaction between the two when `AsioSession` calls `addSession` and
+// `cancelAsyncOperations` on the networking baton. This is currently added to the
+// `LinuxAsioNetworkingBatonTest` fixture to utilize the existing infrastructure.
+TEST_F(LinuxAsioNetworkingBatonTest, CancelAsyncOperationsInterruptsOngoingOperations) {
MilestoneThread thread([&](Notification<void>& isReady) {
// Blocks the main thread as it schedules an opportunistic read, but before it starts
// polling on the networking baton. Then it cancels the operation before unblocking the main
@@ -1201,7 +1202,7 @@ TEST_F(BatonASIOLinuxTest, CancelAsyncOperationsInterruptsOngoingOperations) {
ErrorCodes::CallbackCanceled);
}
-TEST_F(BatonASIOLinuxTest, AsyncOpsMakeProgressWhenSessionAddedToDetachedBaton) {
+TEST_F(LinuxAsioNetworkingBatonTest, AsyncOpsMakeProgressWhenSessionAddedToDetachedBaton) {
Notification<void> ready;
auto opCtx = client().makeOperationContext();