summaryrefslogtreecommitdiff
path: root/src/mongo/executor
diff options
context:
space:
mode:
authorAdam Midvidy <amidvidy@gmail.com>2015-09-17 18:54:05 -0400
committerAdam Midvidy <amidvidy@gmail.com>2015-09-17 19:09:34 -0400
commit1b0e65b0ccd5725f97b0a679ac7f7476a242c66e (patch)
tree53128dd8d66a25416bd344e73aff7e8cf3deabab /src/mongo/executor
parent0b68c458923d4befe38e6f1294adb393f47bede1 (diff)
downloadmongo-1b0e65b0ccd5725f97b0a679ac7f7476a242c66e.tar.gz
SERVER-20477 reset AsyncOp state before returning it to the pool
Diffstat (limited to 'src/mongo/executor')
-rw-r--r--src/mongo/executor/network_interface_asio.h2
-rw-r--r--src/mongo/executor/network_interface_asio_command.cpp2
-rw-r--r--src/mongo/executor/network_interface_asio_operation.cpp16
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