Skip to content

Commit b00a9ae

Browse files
authored
Merge pull request #196 from inaryart/master
fix #195
2 parents 139e735 + a3aed22 commit b00a9ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clickhouse/base/socket.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ NetworkAddress::NetworkAddress(const std::string& host, const std::string& port)
181181

182182
hints.ai_family = PF_UNSPEC;
183183
hints.ai_socktype = SOCK_STREAM;
184-
184+
// using AI_ADDRCONFIG on windows will cause getaddrinfo to return WSAHOST_NOT_FOUND
185+
// for more information, see https://github.com/ClickHouse/clickhouse-cpp/issues/195
186+
#if defined(_unix_)
185187
if (!Singleton<LocalNames>()->IsLocalName(host)) {
186188
// https://linux.die.net/man/3/getaddrinfo
187189
// If hints.ai_flags includes the AI_ADDRCONFIG flag,
@@ -193,6 +195,7 @@ NetworkAddress::NetworkAddress(const std::string& host, const std::string& port)
193195
// as valid as a configured address.
194196
hints.ai_flags |= AI_ADDRCONFIG;
195197
}
198+
#endif
196199

197200
const int error = getaddrinfo(host.c_str(), port.c_str(), &hints, &info_);
198201

0 commit comments

Comments
 (0)