summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristina <kristina@10gen.com>2011-12-02 11:46:00 -0500
committerEliot Horowitz <eliot@10gen.com>2011-12-22 11:58:39 -0500
commit774b90baee5ab571d8b22903cf4baf7ecfb3e1a5 (patch)
treec5472531b364d60b25abc845491b31afafd0336d
parent45190b81b571d7cc4eaa0b527d8e120e45672612 (diff)
downloadmongo-774b90baee5ab571d8b22903cf4baf7ecfb3e1a5.tar.gz
Make sure auth is always registered for rs connections SERVER-4238
-rw-r--r--db/repl/connections.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/db/repl/connections.h b/db/repl/connections.h
index 61c581bb635..c3be5e46ab3 100644
--- a/db/repl/connections.h
+++ b/db/repl/connections.h
@@ -72,7 +72,8 @@ namespace mongo {
struct X {
mongo::mutex z;
DBClientConnection cc;
- X() : z("X"), cc(/*reconnect*/ true, 0, /*timeout*/ 10.0) {
+ bool connected;
+ X() : z("X"), cc(/*reconnect*/ true, 0, /*timeout*/ 10.0), connected(false) {
cc._logLevel = 2;
}
} *x;
@@ -88,6 +89,7 @@ namespace mongo {
log() << "couldn't connect to " << _hostport << ": " << err << rsLog;
return false;
}
+ x->connected = true;
// if we cannot authenticate against a member, then either its key file
// or our key file has to change. if our key file has to change, we'll
@@ -113,7 +115,9 @@ namespace mongo {
connLock.reset( new scoped_lock(x->z) );
}
}
- if( !first ) {
+
+ // Keep trying to connect if we're not yet connected
+ if( !first && x->connected ) {
connLock.reset( new scoped_lock(x->z) );
return;
}