summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Midvidy <amidvidy@gmail.com>2015-10-05 14:45:07 -0400
committerAdam Midvidy <amidvidy@gmail.com>2015-10-05 15:10:40 -0400
commitbd76599a88e8062c634eeb6918bb30f868bc6042 (patch)
tree5e35df42faec4fb5f149d52f02bda6d4163913ce
parent2a86489d6f563a44140e1db7d8b5fb63c66f117c (diff)
downloadmongo-bd76599a88e8062c634eeb6918bb30f868bc6042.tar.gz
SERVER-20689 pull refresh callback out of member variable so we don't use a moved-from closure
-rw-r--r--src/mongo/executor/connection_pool_asio.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/executor/connection_pool_asio.cpp b/src/mongo/executor/connection_pool_asio.cpp
index 89d418c0a43..ea494194053 100644
--- a/src/mongo/executor/connection_pool_asio.cpp
+++ b/src/mongo/executor/connection_pool_asio.cpp
@@ -188,8 +188,9 @@ void ASIOConnection::refresh(Milliseconds timeout, RefreshCallback cb) {
// If we fail during refresh, the _onFinish function of the AsyncOp will get called. As such we
// need to intercept those calls so we can capture them. This will get cleared out when we fill
// in the real onFinish in startCommand.
- op->setOnFinish([this, cb](StatusWith<RemoteCommandResponse> failedResponse) {
+ op->setOnFinish([this](StatusWith<RemoteCommandResponse> failedResponse) {
invariant(!failedResponse.isOK());
+ auto cb = std::move(_refreshCallback);
cb(this, failedResponse.getStatus());
});