diff options
-rw-r--r-- | src/mongo/executor/connection_pool_asio.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/executor/connection_pool_asio.cpp b/src/mongo/executor/connection_pool_asio.cpp index 9786b0bddcf..45be3537007 100644 --- a/src/mongo/executor/connection_pool_asio.cpp +++ b/src/mongo/executor/connection_pool_asio.cpp @@ -190,6 +190,17 @@ void ASIOConnection::cancelTimeout() { void ASIOConnection::setup(Milliseconds timeout, SetupCallback cb) { _impl->strand().dispatch([this, timeout, cb] { _setupCallback = [this, cb](ConnectionInterface* ptr, Status status) { + { + stdx::lock_guard<stdx::mutex> lk(_impl->_access->mutex); + _impl->_access->id++; + + // If our connection timeout callback ran but wasn't the reason we exited + // the state machine, clear the timedOut flag. + if (status.isOK()) { + _impl->_timedOut = false; + } + } + cancelTimeout(); cb(ptr, status); }; |