diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-04-07 07:35:46 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-04-07 07:35:46 +0200 |
commit | 8d913e98e8058c6322975a858f884a769735bb43 (patch) | |
tree | 52da0129272024f7132594b8227d81ec72f83af1 /client/dbclient.cpp | |
parent | 582fc32574a3b158c81e49cb00e6ae59205e66ba (diff) | |
download | mongodb-8d913e98e8058c6322975a858f884a769735bb43.tar.gz |
Imported Upstream version 1.8.1
Diffstat (limited to 'client/dbclient.cpp')
-rw-r--r-- | client/dbclient.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/client/dbclient.cpp b/client/dbclient.cpp index b4214ab..a68b1af 100644 --- a/client/dbclient.cpp +++ b/client/dbclient.cpp @@ -915,13 +915,14 @@ namespace mongo { void DBClientConnection::checkResponse( const char *data, int nReturned ) { /* check for errors. the only one we really care about at - this stage is "not master" */ + * this stage is "not master" + */ + if ( clientSet && nReturned ) { assert(data); BSONObj o(data); - BSONElement e = o.firstElement(); - if ( strcmp(e.fieldName(), "$err") == 0 && - e.type() == String && strncmp(e.valuestr(), "not master", 10) == 0 ) { + BSONElement e = o["$err"]; + if ( e.type() == String && str::contains( e.valuestr() , "not master" ) ) { clientSet->isntMaster(); } } |