mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
fix bug with auto reconnect in the client
This commit is contained in:
parent
c5fc4e2919
commit
d654aa6788
@ -384,7 +384,6 @@ namespace mongo {
|
||||
int port;
|
||||
size_t idx = serverAddress.find( ":" );
|
||||
if ( idx != string::npos ) {
|
||||
//out() << "port string:" << ip.substr( idx ) << endl;
|
||||
port = strtol( serverAddress.substr( idx + 1 ).c_str(), 0, 10 );
|
||||
ip = serverAddress.substr( 0 , idx );
|
||||
ip = hostbyname(ip.c_str());
|
||||
@ -590,11 +589,21 @@ namespace mongo {
|
||||
}
|
||||
|
||||
bool DBClientConnection::call( Message &toSend, Message &response, bool assertOk ) {
|
||||
if ( !port().call(toSend, response) ) {
|
||||
/* todo: this is very ugly messagingport::call returns an error code AND can throw
|
||||
an exception. we should make it return void and just throw an exception anytime
|
||||
it fails
|
||||
*/
|
||||
try {
|
||||
if ( !port().call(toSend, response) ) {
|
||||
failed = true;
|
||||
if ( assertOk )
|
||||
massert("dbclient error communicating with server", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch( SocketException & ) {
|
||||
failed = true;
|
||||
if ( assertOk )
|
||||
massert("dbclient error communicating with server", false);
|
||||
return false;
|
||||
throw;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user