diff options
Diffstat (limited to 'src/mongo/executor')
-rw-r--r-- | src/mongo/executor/network_interface_asio.h | 2 | ||||
-rw-r--r-- | src/mongo/executor/network_interface_asio_command.cpp | 2 | ||||
-rw-r--r-- | src/mongo/executor/network_interface_asio_operation.cpp | 16 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/executor/network_interface_asio.h b/src/mongo/executor/network_interface_asio.h index c96b649ee97..f2570fcd04f 100644 --- a/src/mongo/executor/network_interface_asio.h +++ b/src/mongo/executor/network_interface_asio.h @@ -259,6 +259,8 @@ private: void setOperationProtocol(rpc::Protocol proto); + void reset(); + private: NetworkInterfaceASIO* const _owner; // Information describing a task enqueued on the NetworkInterface diff --git a/src/mongo/executor/network_interface_asio_command.cpp b/src/mongo/executor/network_interface_asio_command.cpp index 48467e4c0b8..c3bb427f53b 100644 --- a/src/mongo/executor/network_interface_asio_command.cpp +++ b/src/mongo/executor/network_interface_asio_command.cpp @@ -292,6 +292,8 @@ void NetworkInterfaceASIO::_completeOperation(AsyncOp* op, const ResponseStatus& auto conn = std::move(op->_connectionPoolHandle); auto asioConn = static_cast<connection_pool_asio::ASIOConnection*>(conn.get()); + ownedOp->reset(); + asioConn->bindAsyncOp(std::move(ownedOp)); if (!resp.isOK()) { asioConn->indicateFailed(resp.getStatus()); diff --git a/src/mongo/executor/network_interface_asio_operation.cpp b/src/mongo/executor/network_interface_asio_operation.cpp index bc783b56e0c..535dc19ba80 100644 --- a/src/mongo/executor/network_interface_asio_operation.cpp +++ b/src/mongo/executor/network_interface_asio_operation.cpp @@ -215,5 +215,21 @@ void NetworkInterfaceASIO::AsyncOp::setOperationProtocol(rpc::Protocol proto) { _operationProtocol = proto; } +void NetworkInterfaceASIO::AsyncOp::reset() { + // We don't reset owner as it never changes + _cbHandle = {}; + _request = {}; + _onFinish = {}; + _connectionPoolHandle = {}; + // We don't reset _connection as we want to reuse it. + // Ditto for _operationProtocol. + _start = {}; + _timeoutAlarm.reset(); + _canceled.store(0u); + _timedOut.store(0u); + _command = boost::none; + // _inSetup should always be false at this point. +} + } // namespace executor } // namespace mongo |