summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2014-06-27 13:49:24 -0400
committerAndy Schwerin <schwerin@mongodb.com>2014-06-30 19:02:35 -0400
commit1a49d864f34812f73c10b8e0b30c15150cb6ca69 (patch)
treed2616c45c978ef14b0e65cfc11a71cee439ee3fe /src
parent7a0d83d88d18d5c28fe13bd5dc0b13d1c6c2ef22 (diff)
downloadmongo-1a49d864f34812f73c10b8e0b30c15150cb6ca69.tar.gz
SERVER-14367 Preparation for removing some implicit conversion and other methods of HostAndPort.
The setPort and implicit conversion operators are going away. This path fixes their existing users.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/client/dbclient.cpp6
-rw-r--r--src/mongo/client/dbclient_rs.cpp2
-rw-r--r--src/mongo/client/dbclient_rs_test.cpp4
-rw-r--r--src/mongo/client/dbclientinterface.h2
-rw-r--r--src/mongo/client/syncclusterconnection.cpp2
-rw-r--r--src/mongo/db/commands/clone_collection.cpp2
-rw-r--r--src/mongo/db/commands/isself.cpp2
-rw-r--r--src/mongo/db/curop.h7
-rw-r--r--src/mongo/db/pipeline/document_source_merge_cursors.cpp2
-rw-r--r--src/mongo/db/repl/connections.h2
-rw-r--r--src/mongo/db/repl/rs_config.cpp2
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp2
-rw-r--r--src/mongo/dbtests/config_server_fixture.h2
-rw-r--r--src/mongo/dbtests/replica_set_monitor_test.cpp4
-rw-r--r--src/mongo/s/collection_metadata_test.cpp10
-rw-r--r--src/mongo/s/commands_admin.cpp5
-rw-r--r--src/mongo/s/dbclient_shard_resolver.cpp2
-rw-r--r--src/mongo/s/grid.cpp2
-rw-r--r--src/mongo/s/metadata_loader_test.cpp24
-rw-r--r--src/mongo/s/multi_host_query_test.cpp2
-rw-r--r--src/mongo/s/s_only.cpp2
-rw-r--r--src/mongo/tools/bridge.cpp2
-rw-r--r--src/mongo/tools/stat.cpp2
-rw-r--r--src/mongo/util/net/message_port.cpp6
24 files changed, 53 insertions, 45 deletions
diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp
index 1db0158a0b2..cc6a5aea144 100644
--- a/src/mongo/client/dbclient.cpp
+++ b/src/mongo/client/dbclient.cpp
@@ -72,10 +72,10 @@ namespace mongo {
string::size_type idx;
while ( ( idx = s.find( ',' ) ) != string::npos ) {
- _servers.push_back( s.substr( 0 , idx ) );
+ _servers.push_back(HostAndPort(s.substr(0, idx)));
s = s.substr( idx + 1 );
}
- _servers.push_back( s );
+ _servers.push_back(HostAndPort(s));
}
@@ -1521,7 +1521,7 @@ namespace mongo {
bool serverAlive( const string &uri ) {
DBClientConnection c( false, 0, 20 ); // potentially the connection to server could fail while we're checking if it's alive - so use timeouts
string err;
- if ( !c.connect( uri, err ) )
+ if ( !c.connect( HostAndPort(uri), err ) )
return false;
if ( !c.simpleCommand( "admin", 0, "ping" ) )
return false;
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp
index 79d1be3b749..d360a856503 100644
--- a/src/mongo/client/dbclient_rs.cpp
+++ b/src/mongo/client/dbclient_rs.cpp
@@ -718,7 +718,7 @@ namespace {
// callback. We should eventually not need this after we remove the
// callback.
DBClientConnection* newConn = dynamic_cast<DBClientConnection*>(
- pool.get(_lastSlaveOkHost.toString(true), _so_timeout));
+ pool.get(_lastSlaveOkHost.toString(), _so_timeout));
// Assert here instead of returning NULL since the contract of this method is such
// that returning NULL means none of the nodes were good, which is not the case here.
diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp
index 91bafd542c9..cd9ccc55948 100644
--- a/src/mongo/client/dbclient_rs_test.cpp
+++ b/src/mongo/client/dbclient_rs_test.cpp
@@ -172,7 +172,7 @@ namespace {
vector<HostAndPort> hostList(_replSet->getHosts());
for (vector<HostAndPort>::const_iterator iter = hostList.begin();
iter != hostList.end(); ++iter) {
- _replSet->kill(iter->toString(true));
+ _replSet->kill(iter->toString());
}
}
@@ -560,7 +560,7 @@ namespace {
// This is the only difference from ConnShouldPinIfSameSettings which tests that we *do* pin
// in if the host is still marked as up. Note that this only notifies the RSM, and does not
// directly effect the DBClientRS.
- ReplicaSetMonitor::get(replSet->getSetName())->failedHost(dest);
+ ReplicaSetMonitor::get(replSet->getSetName())->failedHost(HostAndPort(dest));
{
Query query;
diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h
index 95589e54e0f..ecb7390299e 100644
--- a/src/mongo/client/dbclientinterface.h
+++ b/src/mongo/client/dbclientinterface.h
@@ -321,7 +321,7 @@ namespace mongo {
static ConnectionString mock( const HostAndPort& server ) {
ConnectionString connStr;
connStr._servers.push_back( server );
- connStr._string = server.toString( true );
+ connStr._string = server.toString();
return connStr;
}
diff --git a/src/mongo/client/syncclusterconnection.cpp b/src/mongo/client/syncclusterconnection.cpp
index 450bf194c50..a06b6c38238 100644
--- a/src/mongo/client/syncclusterconnection.cpp
+++ b/src/mongo/client/syncclusterconnection.cpp
@@ -177,7 +177,7 @@ namespace mongo {
c->setPostRunCommandHook(_postRunCommandHook);
c->setSoTimeout( _socketTimeout );
string errmsg;
- if ( ! c->connect( host , errmsg ) )
+ if ( ! c->connect( HostAndPort(host), errmsg ) )
log() << "SyncClusterConnection connect fail to: " << host << " errmsg: " << errmsg << endl;
_connAddresses.push_back( host );
_conns.push_back( c );
diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp
index eb63c382f57..c0e7ce576aa 100644
--- a/src/mongo/db/commands/clone_collection.cpp
+++ b/src/mongo/db/commands/clone_collection.cpp
@@ -133,7 +133,7 @@ namespace mongo {
Cloner cloner;
auto_ptr<DBClientConnection> myconn;
myconn.reset( new DBClientConnection() );
- if ( ! myconn->connect( fromhost , errmsg ) )
+ if ( ! myconn->connect( HostAndPort(fromhost) , errmsg ) )
return false;
cloner.setConnection( myconn.release() );
diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp
index 6c91db9dfa2..3c95e2ed2d3 100644
--- a/src/mongo/db/commands/isself.cpp
+++ b/src/mongo/db/commands/isself.cpp
@@ -255,7 +255,7 @@ namespace mongo {
isSelfCommand.init();
DBClientConnection conn;
string errmsg;
- if ( ! conn.connect( host , errmsg ) ) {
+ if ( ! conn.connect( *this , errmsg ) ) {
// should this go in the cache?
return false;
}
diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h
index f24da292c98..9be0af8908c 100644
--- a/src/mongo/db/curop.h
+++ b/src/mongo/db/curop.h
@@ -288,7 +288,12 @@ namespace mongo {
// Fetches less information than "info()"; used to search for ops with certain criteria
BSONObj description();
- std::string getRemoteString( bool includePort = true ) { return _remote.toString(includePort); }
+ std::string getRemoteString( bool includePort = true ) {
+ if (includePort)
+ return _remote.toString();
+ return _remote.host();
+ }
+
ProgressMeter& setMessage(const char * msg,
std::string name = "Progress",
unsigned long long progressMeterTotal = 0,
diff --git a/src/mongo/db/pipeline/document_source_merge_cursors.cpp b/src/mongo/db/pipeline/document_source_merge_cursors.cpp
index 408475f022b..b0c56d2878f 100644
--- a/src/mongo/db/pipeline/document_source_merge_cursors.cpp
+++ b/src/mongo/db/pipeline/document_source_merge_cursors.cpp
@@ -71,7 +71,7 @@ namespace mongo {
massert(17027, string("Expected an Object, but got a ") + typeName(cursor.type()),
cursor.type() == Object);
- cursorIds.push_back(make_pair(ConnectionString(cursor["host"].String()),
+ cursorIds.push_back(make_pair(ConnectionString(HostAndPort(cursor["host"].String())),
cursor["id"].Long()));
}
diff --git a/src/mongo/db/repl/connections.h b/src/mongo/db/repl/connections.h
index 32836b3d4a1..eadf4e92d49 100644
--- a/src/mongo/db/repl/connections.h
+++ b/src/mongo/db/repl/connections.h
@@ -132,7 +132,7 @@ namespace repl {
// we should already be locked...
bool connect() {
std::string err;
- if (!connInfo->cc->connect(_hostport, err)) {
+ if (!connInfo->cc->connect(HostAndPort(_hostport), err)) {
log() << "couldn't connect to " << _hostport << ": " << err << rsLog;
return false;
}
diff --git a/src/mongo/db/repl/rs_config.cpp b/src/mongo/db/repl/rs_config.cpp
index f76778ed821..a064289ab86 100644
--- a/src/mongo/db/repl/rs_config.cpp
+++ b/src/mongo/db/repl/rs_config.cpp
@@ -508,7 +508,7 @@ namespace {
m.h = HostAndPort(s);
if ( !m.h.hasPort() ) {
// make port explicit even if default
- m.h.setPort(m.h.port());
+ m.h = HostAndPort(m.h.host(), m.h.port());
}
}
catch (const DBException& e) {
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index 985d751aa8e..3cead0d5d9e 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -352,7 +352,7 @@ namespace repl {
// cloner owns _conn in auto_ptr
cloner.setConnection(tmpConn);
uassert(15908, errmsg,
- tmpConn->connect(host, errmsg) && repl::replAuthenticate(tmpConn));
+ tmpConn->connect(HostAndPort(host), errmsg) && repl::replAuthenticate(tmpConn));
return cloner.copyCollection(txn, ns, BSONObj(), errmsg, true, false, true, false);
}
diff --git a/src/mongo/dbtests/config_server_fixture.h b/src/mongo/dbtests/config_server_fixture.h
index 55c2d7f559f..ee098aee5e2 100644
--- a/src/mongo/dbtests/config_server_fixture.h
+++ b/src/mongo/dbtests/config_server_fixture.h
@@ -101,7 +101,7 @@ namespace mongo {
* Returns a connection std::string to the virtual config server.
*/
ConnectionString configSvr() const {
- return ConnectionString(std::string("$dummy:10000"));
+ return ConnectionString(HostAndPort("$dummy:10000"));
}
/**
diff --git a/src/mongo/dbtests/replica_set_monitor_test.cpp b/src/mongo/dbtests/replica_set_monitor_test.cpp
index 0393ffdd721..e1692732e33 100644
--- a/src/mongo/dbtests/replica_set_monitor_test.cpp
+++ b/src/mongo/dbtests/replica_set_monitor_test.cpp
@@ -1554,7 +1554,7 @@ namespace mongo_test {
ReadPreferenceSetting(mongo::ReadPreference_SecondaryOnly, TagSet()));
ASSERT_FALSE(monitor->isPrimary(node));
- ASSERT_EQUALS(secHost, node.toString(true));
+ ASSERT_EQUALS(secHost, node.toString());
}
// Tests the case where the connection to secondary went bad and the replica set
@@ -1581,6 +1581,6 @@ namespace mongo_test {
ReadPreferenceSetting(mongo::ReadPreference_SecondaryOnly, tags));
ASSERT_FALSE(monitor->isPrimary(node));
- ASSERT_EQUALS(secHost, node.toString(true));
+ ASSERT_EQUALS(secHost, node.toString());
}
}
diff --git a/src/mongo/s/collection_metadata_test.cpp b/src/mongo/s/collection_metadata_test.cpp
index ca4eedd158d..2a46cb15e84 100644
--- a/src/mongo/s/collection_metadata_test.cpp
+++ b/src/mongo/s/collection_metadata_test.cpp
@@ -103,7 +103,7 @@ namespace {
_dummyConfig->insert( ChunkType::ConfigNS, chunkType.toBSON() );
- ConnectionString configLoc( CONFIG_HOST_PORT );
+ ConnectionString configLoc = ConnectionString( HostAndPort(CONFIG_HOST_PORT) );
MetadataLoader loader( configLoc );
Status status = loader.makeCollectionMetadata( "test.foo",
@@ -497,7 +497,7 @@ namespace {
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, fooSingle );
- ConnectionString configLoc( CONFIG_HOST_PORT );
+ ConnectionString configLoc( (HostAndPort(CONFIG_HOST_PORT)) );
MetadataLoader loader( configLoc );
Status status = loader.makeCollectionMetadata( "test.foo",
@@ -838,7 +838,7 @@ namespace {
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, fooSingle );
- ConnectionString configLoc( CONFIG_HOST_PORT );
+ ConnectionString configLoc((HostAndPort(CONFIG_HOST_PORT)));
MetadataLoader loader( configLoc );
Status status = loader.makeCollectionMetadata( "test.foo",
@@ -908,7 +908,7 @@ namespace {
ChunkType::DEPRECATED_epoch(epoch) <<
ChunkType::shard("shard0000")) );
- ConnectionString configLoc( CONFIG_HOST_PORT );
+ ConnectionString configLoc((HostAndPort(CONFIG_HOST_PORT)));
MetadataLoader loader( configLoc );
Status status = loader.makeCollectionMetadata( "test.foo",
@@ -1186,7 +1186,7 @@ namespace {
ChunkType::shard("shard0000")) );
}
- ConnectionString configLoc( CONFIG_HOST_PORT );
+ ConnectionString configLoc((HostAndPort(CONFIG_HOST_PORT)));
MetadataLoader loader( configLoc );
Status status = loader.makeCollectionMetadata( "test.foo",
diff --git a/src/mongo/s/commands_admin.cpp b/src/mongo/s/commands_admin.cpp
index 648d470384e..62dd47e9d38 100644
--- a/src/mongo/s/commands_admin.cpp
+++ b/src/mongo/s/commands_admin.cpp
@@ -1221,7 +1221,8 @@ namespace mongo {
// it's fine if mongods of a set all use default port
if ( ! serverAddrs[i].hasPort() ) {
- serverAddrs[i].setPort(ServerGlobalParams::ShardServerPort);
+ serverAddrs[i] = HostAndPort(serverAddrs[i].host(),
+ ServerGlobalParams::ShardServerPort);
}
}
@@ -1495,7 +1496,7 @@ namespace mongo {
help << "{whatsmyuri:1}";
}
virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
- result << "you" << ClientInfo::get()->getRemote();
+ result << "you" << ClientInfo::get()->getRemote().toString();
return true;
}
} cmdWhatsMyUri;
diff --git a/src/mongo/s/dbclient_shard_resolver.cpp b/src/mongo/s/dbclient_shard_resolver.cpp
index f88bcf11a40..9cd683f3d5a 100644
--- a/src/mongo/s/dbclient_shard_resolver.cpp
+++ b/src/mongo/s/dbclient_shard_resolver.cpp
@@ -89,7 +89,7 @@ namespace mongo {
try {
// This can throw when we don't find a master!
HostAndPort masterHostAndPort = replMonitor->getMasterOrUassert();
- *resolvedHost = ConnectionString::parse( masterHostAndPort.toString( true ), errMsg );
+ *resolvedHost = ConnectionString::parse( masterHostAndPort.toString(), errMsg );
dassert( errMsg == "" );
return Status::OK();
}
diff --git a/src/mongo/s/grid.cpp b/src/mongo/s/grid.cpp
index 1228ac7ad81..c249a5aaef1 100644
--- a/src/mongo/s/grid.cpp
+++ b/src/mongo/s/grid.cpp
@@ -316,7 +316,7 @@ namespace mongo {
vector<HostAndPort> hosts = servers.getServers();
for ( size_t i = 0 ; i < hosts.size() ; i++ ) {
if (!hosts[i].hasPort()) {
- hosts[i].setPort(ServerGlobalParams::DefaultDBPort);
+ hosts[i] = HostAndPort(hosts[i].host(), hosts[i].port());
}
string host = hosts[i].toString(); // host:port
if ( hostSet.find( host ) == hostSet.end() ) {
diff --git a/src/mongo/s/metadata_loader_test.cpp b/src/mongo/s/metadata_loader_test.cpp
index 5903cb1dbc7..d4be8a16620 100644
--- a/src/mongo/s/metadata_loader_test.cpp
+++ b/src/mongo/s/metadata_loader_test.cpp
@@ -73,7 +73,7 @@ namespace {
using std::vector;
const std::string CONFIG_HOST_PORT = "$dummy_config:27017";
- const ConnectionString CONFIG_LOC( CONFIG_HOST_PORT );
+ const ConnectionString CONFIG_LOC((HostAndPort(CONFIG_HOST_PORT)));
// TODO: Test config server down
// TODO: Test read of chunks with new epoch
@@ -285,7 +285,7 @@ namespace {
};
TEST_F(NoChunkHereFixture, CheckNumChunk) {
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr((HostAndPort(CONFIG_HOST_PORT)));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
@@ -388,7 +388,7 @@ namespace {
TEST_F(ConfigServerFixture, SingleChunkCheckNumChunk) {
// Load from mock server.
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr((HostAndPort(CONFIG_HOST_PORT)));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
@@ -401,7 +401,7 @@ namespace {
}
TEST_F(ConfigServerFixture, SingleChunkGetNext) {
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr((HostAndPort(CONFIG_HOST_PORT)));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
@@ -412,7 +412,7 @@ namespace {
}
TEST_F(ConfigServerFixture, SingleChunkGetShardKey) {
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr((HostAndPort(CONFIG_HOST_PORT)));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
@@ -422,7 +422,7 @@ namespace {
}
TEST_F(ConfigServerFixture, SingleChunkGetMaxCollVersion) {
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr((HostAndPort(CONFIG_HOST_PORT)));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
@@ -433,7 +433,7 @@ namespace {
}
TEST_F(ConfigServerFixture, SingleChunkGetMaxShardVersion) {
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr((HostAndPort(CONFIG_HOST_PORT)));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
@@ -446,7 +446,7 @@ namespace {
TEST_F(ConfigServerFixture, NoChunks) {
getConfigServer()->remove( ChunkType::ConfigNS, BSONObj() );
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr((HostAndPort(CONFIG_HOST_PORT)));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
@@ -466,7 +466,7 @@ namespace {
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( _dummyConfig.get() );
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr((HostAndPort(CONFIG_HOST_PORT)));
ConnectionString configLoc( confServerStr );
_loader.reset( new MetadataLoader( configLoc ) );
}
@@ -738,7 +738,7 @@ namespace {
// TODO: MockServer functionality does not support selective query - consider
// inserting nothing at all to chunk/collections collection
TEST_F(ConfigServerFixture, EmptyDataForNS) {
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr(HostAndPort(CONFIG_HOST_PORT));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
@@ -778,7 +778,7 @@ namespace {
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, fooSingle );
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr(HostAndPort(CONFIG_HOST_PORT));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
Status status = loader.makeCollectionMetadata( "not.sharded", // br
@@ -874,7 +874,7 @@ namespace {
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, fooSingle );
- ConnectionString confServerStr( CONFIG_HOST_PORT );
+ ConnectionString confServerStr(HostAndPort(CONFIG_HOST_PORT));
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
diff --git a/src/mongo/s/multi_host_query_test.cpp b/src/mongo/s/multi_host_query_test.cpp
index 7dd1628c727..3b7cc7431e6 100644
--- a/src/mongo/s/multi_host_query_test.cpp
+++ b/src/mongo/s/multi_host_query_test.cpp
@@ -287,7 +287,7 @@ namespace {
// Need to do a connect failure so that we get an empty MessagingPort on the conn and
// the host name is set.
string errMsg;
- ASSERT(!info.conn->connect(host.toString(), errMsg));
+ ASSERT(!info.conn->connect(HostAndPort(host.toString()), errMsg));
}
return StatusWith<DBClientCursor*>(new DBClientCursor(info.conn.get(),
diff --git a/src/mongo/s/s_only.cpp b/src/mongo/s/s_only.cpp
index 65fd0b179c0..eea7e4804f2 100644
--- a/src/mongo/s/s_only.cpp
+++ b/src/mongo/s/s_only.cpp
@@ -96,7 +96,7 @@ namespace mongo {
string Client::clientAddress(bool includePort) const {
ClientInfo * ci = ClientInfo::get();
if ( ci )
- return ci->getRemote();
+ return ci->getRemote().toString();
return "";
}
diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp
index 422237c5b00..663260aea5f 100644
--- a/src/mongo/tools/bridge.cpp
+++ b/src/mongo/tools/bridge.cpp
@@ -55,7 +55,7 @@ public:
string errmsg;
Timer connectTimer;
- while (!dest.connect(mongoBridgeGlobalParams.destUri, errmsg)) {
+ while (!dest.connect(HostAndPort(mongoBridgeGlobalParams.destUri), errmsg)) {
// If we can't connect for the configured timeout, give up
//
if (connectTimer.seconds() >= mongoBridgeGlobalParams.connectTimeoutSec) {
diff --git a/src/mongo/tools/stat.cpp b/src/mongo/tools/stat.cpp
index 3d62324b951..9c10ce1c720 100644
--- a/src/mongo/tools/stat.cpp
+++ b/src/mongo/tools/stat.cpp
@@ -235,7 +235,7 @@ namespace mongo {
DBClientConnection conn( true );
conn._logLevel = logger::LogSeverity::Debug(1);
string errmsg;
- if ( ! conn.connect( state->host , errmsg ) )
+ if ( ! conn.connect( HostAndPort(state->host) , errmsg ) )
state->error = errmsg;
long long cycleNumber = 0;
diff --git a/src/mongo/util/net/message_port.cpp b/src/mongo/util/net/message_port.cpp
index 811e9bf6030..2c4d723d79f 100644
--- a/src/mongo/util/net/message_port.cpp
+++ b/src/mongo/util/net/message_port.cpp
@@ -329,8 +329,10 @@ again:
}
HostAndPort MessagingPort::remote() const {
- if ( ! _remoteParsed.hasPort() )
- _remoteParsed = HostAndPort( psock->remoteAddr() );
+ if ( ! _remoteParsed.hasPort() ) {
+ SockAddr sa = psock->remoteAddr();
+ _remoteParsed = HostAndPort( sa.getAddr(), sa.getPort());
+ }
return _remoteParsed;
}