void onConnect( DBClientWithCommands &c ) { if ( _nokillop ) { return; } c.setClientRPCProtocols(shellGlobalParams.rpcProtocols); connectionRegistry.registerConnection( c ); }
void ConnectionRegistry::registerConnection(DBClientWithCommands& client) { BSONObj info; if (client.runCommand("admin", BSON("whatsmyuri" << 1), info)) { string connstr = dynamic_cast<DBClientBase&>(client).getServerAddress(); stdx::lock_guard<stdx::mutex> lk(_mutex); _connectionUris[connstr].insert(info["you"].str()); } }
void onConnect(DBClientWithCommands& c) { if (_nokillop) { return; } // Only override the default rpcProtocols if they were set on the command line. if (shellGlobalParams.rpcProtocols) { c.setClientRPCProtocols(*shellGlobalParams.rpcProtocols); } connectionRegistry.registerConnection(c); }