summaryrefslogtreecommitdiff
path: root/src/mongo/db/client.cpp
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2016-11-04 14:45:32 -0400
committersamantharitter <samantha.ritter@10gen.com>2016-11-05 21:26:59 -0400
commit0ac04999faae1d2fc0e10972aaf21082a2e48c8f (patch)
treed9b74efcf36c5381469cc622c3aea4c0f8166398 /src/mongo/db/client.cpp
parent2d1dd9e07a40f314853e29bffb56b45bf21df940 (diff)
downloadmongo-0ac04999faae1d2fc0e10972aaf21082a2e48c8f.tar.gz
SERVER-26674 transport::Session objects should be shared_ptr managed
Diffstat (limited to 'src/mongo/db/client.cpp')
-rw-r--r--src/mongo/db/client.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp
index 179b0938d5b..643a25fda05 100644
--- a/src/mongo/db/client.cpp
+++ b/src/mongo/db/client.cpp
@@ -44,7 +44,6 @@
#include "mongo/db/lasterror.h"
#include "mongo/db/service_context.h"
#include "mongo/stdx/thread.h"
-#include "mongo/transport/session.h"
#include "mongo/util/concurrency/thread_name.h"
#include "mongo/util/exit.h"
#include "mongo/util/mongoutils/str.h"
@@ -64,11 +63,13 @@ void Client::initThreadIfNotAlready() {
initThreadIfNotAlready(getThreadName().c_str());
}
-void Client::initThread(const char* desc, transport::Session* session) {
- initThread(desc, getGlobalServiceContext(), session);
+void Client::initThread(const char* desc, transport::SessionHandle session) {
+ initThread(desc, getGlobalServiceContext(), std::move(session));
}
-void Client::initThread(const char* desc, ServiceContext* service, transport::Session* session) {
+void Client::initThread(const char* desc,
+ ServiceContext* service,
+ transport::SessionHandle session) {
invariant(currentClient.getMake()->get() == nullptr);
std::string fullDesc;
@@ -81,7 +82,7 @@ void Client::initThread(const char* desc, ServiceContext* service, transport::Se
setThreadName(fullDesc.c_str());
// Create the client obj, attach to thread
- *currentClient.get() = service->makeClient(fullDesc, session);
+ *currentClient.get() = service->makeClient(fullDesc, std::move(session));
}
void Client::destroy() {
@@ -99,12 +100,12 @@ int64_t generateSeed(const std::string& desc) {
}
} // namespace
-Client::Client(std::string desc, ServiceContext* serviceContext, transport::Session* session)
+Client::Client(std::string desc, ServiceContext* serviceContext, transport::SessionHandle session)
: _serviceContext(serviceContext),
- _session(session),
+ _session(std::move(session)),
_desc(std::move(desc)),
_threadId(stdx::this_thread::get_id()),
- _connectionId(session ? session->id() : 0),
+ _connectionId(_session ? _session->id() : 0),
_prng(generateSeed(_desc)) {}
void Client::reportState(BSONObjBuilder& builder) {