summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2016-09-19 17:02:23 -0400
committersamantharitter <samantha.ritter@10gen.com>2016-09-20 16:56:26 -0400
commit6a29ec259b45f713b74b1fcd2a033918b0983dbb (patch)
treeb60694f616f4da3588b5caead008b7084ae6668f
parent3d26ac950716bc63e25b1911e7674bf489e3ee52 (diff)
downloadmongo-6a29ec259b45f713b74b1fcd2a033918b0983dbb.tar.gz
SERVER-26159 Increment the AsyncOp id immediately so timeout code will not runr3.2.10-rc1
-rw-r--r--src/mongo/executor/connection_pool_asio.cpp11
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);
};