Skip to content

Commit

Permalink
Merge pull request #196 from inaryart/master
Browse files Browse the repository at this point in the history
fix #195
  • Loading branch information
Enmk authored Jul 15, 2022
2 parents 139e735 + a3aed22 commit b00a9ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clickhouse/base/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ NetworkAddress::NetworkAddress(const std::string& host, const std::string& port)

hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;

// using AI_ADDRCONFIG on windows will cause getaddrinfo to return WSAHOST_NOT_FOUND
// for more information, see https://github.com/ClickHouse/clickhouse-cpp/issues/195
#if defined(_unix_)
if (!Singleton<LocalNames>()->IsLocalName(host)) {
// https://linux.die.net/man/3/getaddrinfo
// If hints.ai_flags includes the AI_ADDRCONFIG flag,
Expand All @@ -193,6 +195,7 @@ NetworkAddress::NetworkAddress(const std::string& host, const std::string& port)
// as valid as a configured address.
hints.ai_flags |= AI_ADDRCONFIG;
}
#endif

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

Expand Down

0 comments on commit b00a9ae

Please sign in to comment.