diff options
author | Ben Caimano <ben.caimano@10gen.com> | 2018-07-19 14:39:31 -0400 |
---|---|---|
committer | Ben Caimano <ben.caimano@10gen.com> | 2018-07-29 19:29:01 -0400 |
commit | b49a27b359b17cd1b1560134b89527b78db565cc (patch) | |
tree | e582b593010a3f91f94df90078bbfc9e1c931b90 /src/mongo/executor/connection_pool_test_fixture.cpp | |
parent | 3ab73b4546be136606e52549da4e93f469d413b3 (diff) | |
download | mongo-b49a27b359b17cd1b1560134b89527b78db565cc.tar.gz |
SERVER-35056 Flush ready callbacks on NetworkInterfaceTL shutdown
Diffstat (limited to 'src/mongo/executor/connection_pool_test_fixture.cpp')
-rw-r--r-- | src/mongo/executor/connection_pool_test_fixture.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/executor/connection_pool_test_fixture.cpp b/src/mongo/executor/connection_pool_test_fixture.cpp index 560f184a025..77629b0fa94 100644 --- a/src/mongo/executor/connection_pool_test_fixture.cpp +++ b/src/mongo/executor/connection_pool_test_fixture.cpp @@ -42,6 +42,8 @@ TimerImpl::~TimerImpl() { } void TimerImpl::setTimeout(Milliseconds timeout, TimeoutCallback cb) { + _timers.erase(this); + _cb = std::move(cb); _expiration = _global->now() + timeout; @@ -50,10 +52,14 @@ void TimerImpl::setTimeout(Milliseconds timeout, TimeoutCallback cb) { void TimerImpl::cancelTimeout() { _timers.erase(this); + _cb = TimeoutCallback{}; } void TimerImpl::clear() { - _timers.clear(); + while (!_timers.empty()) { + auto* timer = *_timers.begin(); + timer->cancelTimeout(); + } } void TimerImpl::fireIfNecessary() { @@ -233,7 +239,7 @@ std::shared_ptr<ConnectionPool::ConnectionInterface> PoolImpl::makeConnection( return std::make_shared<ConnectionImpl>(hostAndPort, generation, this); } -std::unique_ptr<ConnectionPool::TimerInterface> PoolImpl::makeTimer() { +std::shared_ptr<ConnectionPool::TimerInterface> PoolImpl::makeTimer() { return stdx::make_unique<TimerImpl>(this); } |