mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-47507 Cancel all remaining egress commands on shutdown
This commit is contained in:
parent
0aab1bdb1f
commit
8ae6c7dc3c
@ -201,6 +201,25 @@ void NetworkInterfaceTL::shutdown() {
|
||||
|
||||
LOGV2_DEBUG(22594, 2, "Shutting down network interface.");
|
||||
|
||||
// Cancel any remaining commands. Any attempt to register new commands will throw.
|
||||
auto inProgress = [&] {
|
||||
stdx::lock_guard lk(_inProgressMutex);
|
||||
return std::exchange(_inProgress, {});
|
||||
}();
|
||||
|
||||
for (auto& [_, weakCmdState] : inProgress) {
|
||||
auto cmdState = weakCmdState.lock();
|
||||
if (!cmdState) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!cmdState->finishLine.arriveStrongly()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cmdState->fulfillFinalPromise(kNetworkInterfaceShutdownInProgress);
|
||||
}
|
||||
|
||||
// Stop the reactor/thread first so that nothing runs on a partially dtor'd pool.
|
||||
_reactor->stop();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user