summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dwight@10gen.com>2010-08-25 13:01:36 -0400
committerEliot Horowitz <eliot@10gen.com>2010-09-15 14:51:00 -0400
commit5c512c70a08a62e6e8949708f1033acc068e8c0f (patch)
treeb7512959f17a6caec0e7c225faf3ed437308713c
parent0c434ca442aec92f878d97dfb149c67de42bd5f8 (diff)
downloadmongo-5c512c70a08a62e6e8949708f1033acc068e8c0f.tar.gz
cleaning formatting
-rw-r--r--db/client.cpp2
-rw-r--r--db/client.h24
-rw-r--r--db/db.cpp1
-rw-r--r--util/message.cpp4
4 files changed, 8 insertions, 23 deletions
diff --git a/db/client.cpp b/db/client.cpp
index fec02544f1e..f9653f58548 100644
--- a/db/client.cpp
+++ b/db/client.cpp
@@ -251,7 +251,7 @@ namespace mongo {
string sayClientState(){
Client* c = currentClient.get();
- if ( ! c )
+ if ( !c )
return "no client";
return c->toString();
}
diff --git a/db/client.h b/db/client.h
index dfd78ca35d9..d0600e3e5af 100644
--- a/db/client.h
+++ b/db/client.h
@@ -29,12 +29,10 @@
#include "namespace.h"
#include "lasterror.h"
#include "stats/top.h"
-//#include "repl/rs.h"
namespace mongo {
extern class ReplSet *theReplSet;
-
class AuthenticationInfo;
class Database;
class CurOp;
@@ -51,12 +49,13 @@ namespace mongo {
wassert( syncThread == 0 );
syncThread = this;
}
- bool isSyncThread() const { return this == syncThread; }
+ bool isSyncThread() const { return this == syncThread; } // true if this client is the replication secondary pull thread
static mongo::mutex clientsMutex;
static set<Client*> clients; // always be in clientsMutex when manipulating this
static int recommendedYieldMicros( int * writers = 0 , int * readers = 0 );
+ /* set _god=true temporarily, safely */
class GodScope {
bool _prev;
public:
@@ -190,16 +189,10 @@ namespace mongo {
void _invalidateDB(const string& db);
static void invalidateDB(const string& db);
-
static void invalidateNS( const string& ns );
- void setLastOp( ReplTime op ) {
- _lastOp = op;
- }
-
- ReplTime getLastOp() const {
- return _lastOp;
- }
+ void setLastOp( ReplTime op ) { _lastOp = op; }
+ ReplTime getLastOp() const { return _lastOp; }
/* report what the last operation was. used by getlasterror */
void appendLastOp( BSONObjBuilder& b ) {
@@ -223,7 +216,6 @@ namespace mongo {
@return true if anything was done
*/
bool shutdown();
-
/* this is for map/reduce writes */
bool isGod() const { return _god; }
@@ -231,13 +223,12 @@ namespace mongo {
friend class CurOp;
string toString() const;
-
void gotHandshake( const BSONObj& o );
-
BSONObj getRemoteID() const { return _remoteId; }
BSONObj getHandshake() const { return _handshake; }
};
+ /** get the Client object for this thread. */
inline Client& cc() {
Client * c = currentClient.get();
assert( c );
@@ -288,8 +279,5 @@ namespace mongo {
string sayClientState();
- inline bool haveClient(){
- return currentClient.get() > 0;
- }
+ inline bool haveClient() { return currentClient.get() > 0; }
};
-
diff --git a/db/db.cpp b/db/db.cpp
index 6bc7f4ae671..d5b933971b3 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -67,7 +67,6 @@ namespace mongo {
#endif
void setupSignals();
- void closeAllSockets();
void startReplSets(ReplSetCmdline*);
void startReplication();
void pairWith(const char *remoteEnd, const char *arb);
diff --git a/util/message.cpp b/util/message.cpp
index 310da1b88f4..459a9c7c0e1 100644
--- a/util/message.cpp
+++ b/util/message.cpp
@@ -272,7 +272,7 @@ namespace mongo {
mongo::mutex m;
public:
Ports() : ports(), m("Ports") {}
- void closeAll() { \
+ void closeAll() {
scoped_lock bl(m);
for ( set<MessagingPort*>::iterator i = ports.begin(); i != ports.end(); i++ )
(*i)->shutdown();
@@ -291,8 +291,6 @@ namespace mongo {
// are being destructed during termination.
Ports& ports = *(new Ports());
-
-
void closeAllSockets() {
ports.closeAll();
}