0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

cleanup ismaster code with replica sets

This commit is contained in:
Eliot Horowitz 2010-10-15 11:04:44 -04:00
parent 5e7c7b630c
commit d432ea51c5

View File

@ -271,6 +271,18 @@ namespace mongo {
bool replAuthenticate(DBClientBase *conn);
void appendReplicationInfo( BSONObjBuilder& result , bool authed , int level ){
if ( replSet ) {
if( theReplSet == 0 ) {
result.append("ismaster", false);
result.append("secondary", false);
result.append("info", ReplSet::startupStatusMsg);
return;
}
theReplSet->fillIsMaster(result);
return;
}
if ( replAllDead ) {
result.append("ismaster", 0);
@ -361,22 +373,9 @@ namespace mongo {
we allow unauthenticated ismaster but we aren't as verbose informationally if
one is not authenticated for admin db to be safe.
*/
bool authed = cc().getAuthenticationInfo()->isAuthorizedReads("admin");
appendReplicationInfo( result , authed );
if( replSet ) {
if( theReplSet == 0 ) {
result.append("ismaster", false);
result.append("secondary", false);
errmsg = "replSet still trying to initialize";
result.append("info", ReplSet::startupStatusMsg);
}
else {
theReplSet->fillIsMaster(result);
}
}
else {
bool authed = cc().getAuthenticationInfo()->isAuthorizedReads("admin");
appendReplicationInfo( result , authed );
}
result.appendNumber("maxBsonObjectSize", BSONObjMaxUserSize);
return true;
}