summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/executor/network_interface_asio.cpp4
-rw-r--r--src/mongo/executor/network_interface_asio_command.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/executor/network_interface_asio.cpp b/src/mongo/executor/network_interface_asio.cpp
index d0ce71ed8a9..1016f250e7c 100644
--- a/src/mongo/executor/network_interface_asio.cpp
+++ b/src/mongo/executor/network_interface_asio.cpp
@@ -161,13 +161,15 @@ void NetworkInterfaceASIO::startCommand(const TaskExecutor::CallbackHandle& cbHa
AsyncOp* op = nullptr;
{
- stdx::lock_guard<stdx::mutex> lk(_inProgressMutex);
+ stdx::unique_lock<stdx::mutex> lk(_inProgressMutex);
auto iter = std::find(_inGetConnection.begin(), _inGetConnection.end(), cbHandle);
// If we didn't find the request, we've been canceled
if (iter == _inGetConnection.end()) {
+ lk.unlock();
onFinish({ErrorCodes::CallbackCanceled, "Callback canceled"});
+ signalWorkAvailable();
return;
}
diff --git a/src/mongo/executor/network_interface_asio_command.cpp b/src/mongo/executor/network_interface_asio_command.cpp
index 3467f39304f..af85b54303e 100644
--- a/src/mongo/executor/network_interface_asio_command.cpp
+++ b/src/mongo/executor/network_interface_asio_command.cpp
@@ -259,10 +259,8 @@ void NetworkInterfaceASIO::_completeOperation(AsyncOp* op, const ResponseStatus&
auto iter = _inProgress.find(op);
- // We're in connection start
- if (iter == _inProgress.end()) {
- return;
- }
+ // If we're here, we should not have been canceled.
+ invariant(iter != _inProgress.end());
ownedOp = std::move(iter->second);
_inProgress.erase(iter);