From 44c9b4411aac88638797fe37279e632a6799b510 Mon Sep 17 00:00:00 2001 From: Randy Abernethy Date: Mon, 16 Jun 2014 21:15:23 -0700 Subject: [PATCH] THRIFT-2539:TSocket.cpp AI_ADDRCONFIG problems on Windows Client: C++ Lib Patch: Michal Gazda AI_ADDRCONFIG keeps Windows from making local connections when no NICs are present. --- lib/cpp/src/thrift/transport/TSocket.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp index dbd29c3a..8595506f 100755 --- a/lib/cpp/src/thrift/transport/TSocket.cpp +++ b/lib/cpp/src/thrift/transport/TSocket.cpp @@ -378,6 +378,13 @@ void TSocket::local_open(){ error = getaddrinfo(host_.c_str(), port, &hints, &res0); +#ifdef _WIN32 + if (error == WSANO_DATA) { + hints.ai_flags &= ~AI_ADDRCONFIG; + error = getaddrinfo(host_.c_str(), port, &hints, &res0); + } +#endif + if (error) { string errStr = "TSocket::open() getaddrinfo() " + getSocketInfo() + string(THRIFT_GAI_STRERROR(error)); GlobalOutput(errStr.c_str()); -- 2.17.1