Skip to content

Commit

Permalink
isMaster() - still wasn't right
Browse files Browse the repository at this point in the history
  • Loading branch information
dwight authored and dwight committed Aug 18, 2009
1 parent 4b4efd2 commit 740318b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion db/repl.h
Expand Up @@ -41,10 +41,18 @@ namespace mongo {

class DBClientConnection;
class DBClientCursor;
// --slave = SimpleSlave

/* replication slave? (possibly with slave or repl pair nonmaster)
--slave cmd line setting -> SimpleSlave
*/
typedef enum { NotSlave=0, SimpleSlave, ReplPairSlave } SlaveTypes;
extern SlaveTypes slave;

/* true means we are master and doing replication. if we are not writing to oplog (no --master or repl pairing),
this won't be true.
*/
extern bool master;

extern int opIdMem;

bool cloneFrom(const char *masterHost, string& errmsg, const string& fromdb, bool logForReplication,
Expand Down
3 changes: 3 additions & 0 deletions db/replset.h
Expand Up @@ -111,6 +111,9 @@ namespace mongo {
If 'client' is not specified, the current client is used.
*/
inline bool isMaster( const char *client = 0 ) {
if( !slave )
return true;

if ( !client )
client = database->name.c_str();

Expand Down

0 comments on commit 740318b

Please sign in to comment.