| Index: net/socket/socket_descriptor.cc
|
| ===================================================================
|
| --- net/socket/socket_descriptor.cc (revision 226214)
|
| +++ net/socket/socket_descriptor.cc (working copy)
|
| @@ -12,6 +12,8 @@
|
| #include "base/basictypes.h"
|
|
|
| #if defined(OS_WIN)
|
| +#include <ws2tcpip.h>
|
| +#include "base/win/windows_version.h"
|
| #include "net/base/winsock_init.h"
|
| #endif
|
|
|
| @@ -32,7 +34,18 @@
|
| SocketDescriptor CreateSocketDefault(int family, int type, int protocol) {
|
| #if defined(OS_WIN)
|
| EnsureWinsockInit();
|
| - return ::WSASocket(family, type, protocol, NULL, 0, WSA_FLAG_OVERLAPPED);
|
| + SocketDescriptor result = ::WSASocket(family, type, protocol, NULL, 0,
|
| + WSA_FLAG_OVERLAPPED);
|
| + if (result != kInvalidSocket && family == AF_INET6 &&
|
| + base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_VISTA) {
|
| + DWORD value = 0;
|
| + if (setsockopt(result, IPPROTO_IPV6, IPV6_V6ONLY,
|
| + reinterpret_cast<const char*>(&value), sizeof(value))) {
|
| + closesocket(result);
|
| + return kInvalidSocket;
|
| + }
|
| + }
|
| + return result;
|
| #else // OS_WIN
|
| return ::socket(family, type, protocol);
|
| #endif // OS_WIN
|
|
|