summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristina <kristina@10gen.com>2012-01-20 12:14:10 -0500
committerKristina <kristina@10gen.com>2012-01-20 12:14:10 -0500
commit29f74a507c12350da117f32630ae5a7fc789c578 (patch)
treeb137a69ff0ceaf088eb0da840233c4e0fba3bad9
parent68e305862aad6c618211d4e100768a62834d6d2a (diff)
downloadmongo-29f74a507c12350da117f32630ae5a7fc789c578.tar.gz
Always lock ScopedConn before returning SERVER-4714
-rw-r--r--db/repl/connections.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/db/repl/connections.h b/db/repl/connections.h
index 3e08f80b047..3ada71cdb1e 100644
--- a/db/repl/connections.h
+++ b/db/repl/connections.h
@@ -116,12 +116,18 @@ namespace mongo {
}
}
- // Keep trying to connect if we're not yet connected
- if( !first && x->connected ) {
- connLock.reset( new scoped_lock(x->z) );
+ // already locked connLock above
+ if (first) {
+ connect();
return;
}
+ connLock.reset( new scoped_lock(x->z) );
+ if (x->connected) {
+ return;
+ }
+
+ // Keep trying to connect if we're not yet connected
connect();
}