diff options
Diffstat (limited to 'src/mongo/client')
-rw-r--r-- | src/mongo/client/dbclient.cpp | 4 | ||||
-rw-r--r-- | src/mongo/client/dbclient_rs_test.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp index 4732658795c..efeab45e926 100644 --- a/src/mongo/client/dbclient.cpp +++ b/src/mongo/client/dbclient.cpp @@ -845,7 +845,9 @@ Status DBClientConnection::connectSocketOnly(const HostAndPort& serverAddress) { _failed = true; // We need to construct a SockAddr so we can resolve the address. - SockAddr osAddr{serverAddress.host().c_str(), serverAddress.port()}; + SockAddr osAddr{serverAddress.host().c_str(), + serverAddress.port(), + static_cast<sa_family_t>(IPv6Enabled() ? AF_UNSPEC : AF_INET)}; if (!osAddr.isValid()) { return Status(ErrorCodes::InvalidOptions, diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp index 15bc9f24a58..b90b4fe75ee 100644 --- a/src/mongo/client/dbclient_rs_test.cpp +++ b/src/mongo/client/dbclient_rs_test.cpp @@ -31,6 +31,8 @@ * the DBClientReplicaSet talks to, so the tests only covers the client side logic. */ +#include "mongo/platform/basic.h" + #include <map> #include <memory> #include <string> |