diff options
author | Kristina <kristina@10gen.com> | 2012-01-20 12:14:10 -0500 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2012-01-20 12:14:10 -0500 |
commit | 29f74a507c12350da117f32630ae5a7fc789c578 (patch) | |
tree | b137a69ff0ceaf088eb0da840233c4e0fba3bad9 | |
parent | 68e305862aad6c618211d4e100768a62834d6d2a (diff) | |
download | mongo-29f74a507c12350da117f32630ae5a7fc789c578.tar.gz |
Always lock ScopedConn before returning SERVER-4714
-rw-r--r-- | db/repl/connections.h | 12 |
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(); } |