From: Randy Abernethy Date: Tue, 17 Jun 2014 04:15:23 +0000 (-0700) Subject: THRIFT-2539:TSocket.cpp AI_ADDRCONFIG problems on Windows X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=44c9b4411aac88638797fe37279e632a6799b510;p=common%2Fthrift.git 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. --- 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());