summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2018-10-31 15:42:17 -0400
committerMathias Stearn <mathias@10gen.com>2018-11-15 17:25:11 -0500
commit3d7ed4fdd5e4840e9599a74ec92e16bc619bebf0 (patch)
tree2bd06655367af012e17bf80947cdb792fa1b9b44 /src/mongo/client
parent1ded7067e2d1a6161b15e5a462f8cba2d755c9a6 (diff)
downloadmongo-3d7ed4fdd5e4840e9599a74ec92e16bc619bebf0.tar.gz
SERVER-35682 kill existing SharedPromise type
This required plumbing unique_function into many more places.
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/authenticate.cpp5
-rw-r--r--src/mongo/client/fetcher.cpp6
-rw-r--r--src/mongo/client/fetcher.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/mongo/client/authenticate.cpp b/src/mongo/client/authenticate.cpp
index 6dc0337d627..8931c5de702 100644
--- a/src/mongo/client/authenticate.cpp
+++ b/src/mongo/client/authenticate.cpp
@@ -137,7 +137,7 @@ Future<void> authX509(RunCommandHook runCommand, const BSONObj& params, StringDa
// The runCommand hook checks whether the command returned { ok: 1.0 }, and we don't need to
// extract anything from the command payload, so this is just turning a Future<BSONObj>
// into a Future<void>
- return runCommand(authRequest.getValue()).then([](BSONObj obj) { return Status::OK(); });
+ return runCommand(authRequest.getValue()).ignoreValue();
}
} // namespace
@@ -149,7 +149,6 @@ Future<void> authenticateClient(const BSONObj& params,
const HostAndPort& hostname,
const std::string& clientName,
RunCommandHook runCommand) {
- std::string mechanism;
auto errorHandler = [](Status status) {
if (serverGlobalParams.transitionToAuth && !status.isA<ErrorCategory::NetworkError>()) {
// If auth failed in transitionToAuth, just pretend it succeeded.
@@ -161,6 +160,8 @@ Future<void> authenticateClient(const BSONObj& params,
return status;
};
+
+ std::string mechanism;
auto response = bsonExtractStringField(params, saslCommandMechanismFieldName, &mechanism);
if (!response.isOK())
return response;
diff --git a/src/mongo/client/fetcher.cpp b/src/mongo/client/fetcher.cpp
index f321b956c20..65540e088c4 100644
--- a/src/mongo/client/fetcher.cpp
+++ b/src/mongo/client/fetcher.cpp
@@ -172,7 +172,7 @@ Fetcher::Fetcher(executor::TaskExecutor* executor,
const HostAndPort& source,
const std::string& dbname,
const BSONObj& findCmdObj,
- const CallbackFn& work,
+ CallbackFn work,
const BSONObj& metadata,
Milliseconds findNetworkTimeout,
Milliseconds getMoreNetworkTimeout,
@@ -182,7 +182,7 @@ Fetcher::Fetcher(executor::TaskExecutor* executor,
_dbname(dbname),
_cmdObj(findCmdObj.getOwned()),
_metadata(metadata.getOwned()),
- _work(work),
+ _work(std::move(work)),
_findNetworkTimeout(findNetworkTimeout),
_getMoreNetworkTimeout(getMoreNetworkTimeout),
_firstRemoteCommandScheduler(
@@ -190,7 +190,7 @@ Fetcher::Fetcher(executor::TaskExecutor* executor,
RemoteCommandRequest(_source, _dbname, _cmdObj, _metadata, nullptr, _findNetworkTimeout),
[this](const auto& x) { return this->_callback(x, kFirstBatchFieldName); },
std::move(firstCommandRetryPolicy)) {
- uassert(ErrorCodes::BadValue, "callback function cannot be null", work);
+ uassert(ErrorCodes::BadValue, "callback function cannot be null", _work);
}
Fetcher::~Fetcher() {
diff --git a/src/mongo/client/fetcher.h b/src/mongo/client/fetcher.h
index e917e9f3f30..e7672b382f0 100644
--- a/src/mongo/client/fetcher.h
+++ b/src/mongo/client/fetcher.h
@@ -127,7 +127,7 @@ public:
const HostAndPort& source,
const std::string& dbname,
const BSONObj& cmdObj,
- const CallbackFn& work,
+ CallbackFn work,
const BSONObj& metadata = ReadPreferenceSetting::secondaryPreferredMetadata(),
Milliseconds findNetworkTimeout = RemoteCommandRequest::kNoTimeout,
Milliseconds getMoreNetworkTimeout = RemoteCommandRequest::kNoTimeout,