diff options
author | Ben Caimano <ben.caimano@10gen.com> | 2019-04-25 12:30:35 -0400 |
---|---|---|
committer | Ben Caimano <ben.caimano@10gen.com> | 2019-04-26 17:29:15 -0400 |
commit | 064297825d97e928d40d3117b5c81e4828629728 (patch) | |
tree | ef6e94be771753d0c1b0a73f9d460f3c751146df /src/mongo/executor/connection_pool_tl.cpp | |
parent | 8cbbba49935f632e876037f9f2d9eecc779eb96a (diff) | |
download | mongo-064297825d97e928d40d3117b5c81e4828629728.tar.gz |
SERVER-40819 Use ConnectionPool shared_ptr for full lifetime management
Diffstat (limited to 'src/mongo/executor/connection_pool_tl.cpp')
-rw-r--r-- | src/mongo/executor/connection_pool_tl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/executor/connection_pool_tl.cpp b/src/mongo/executor/connection_pool_tl.cpp index e4a0d9e35ae..44ca5e60f79 100644 --- a/src/mongo/executor/connection_pool_tl.cpp +++ b/src/mongo/executor/connection_pool_tl.cpp @@ -327,10 +327,14 @@ void TLConnection::cancelAsync() { _client->cancel(); } +auto TLTypeFactory::reactor() { + return checked_pointer_cast<transport::Reactor>(_executor); +} + std::shared_ptr<ConnectionPool::ConnectionInterface> TLTypeFactory::makeConnection( const HostAndPort& hostAndPort, transport::ConnectSSLMode sslMode, size_t generation) { auto conn = std::make_shared<TLConnection>(shared_from_this(), - _reactor, + reactor(), getGlobalServiceContext(), hostAndPort, sslMode, @@ -342,13 +346,13 @@ std::shared_ptr<ConnectionPool::ConnectionInterface> TLTypeFactory::makeConnecti } std::shared_ptr<ConnectionPool::TimerInterface> TLTypeFactory::makeTimer() { - auto timer = std::make_shared<TLTimer>(shared_from_this(), _reactor); + auto timer = std::make_shared<TLTimer>(shared_from_this(), reactor()); fasten(timer.get()); return timer; } Date_t TLTypeFactory::now() { - return _reactor->now(); + return checked_cast<transport::Reactor*>(_executor.get())->now(); } } // namespace connection_pool_tl |