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, (const char*)&value, |
jar (doing other things)
2013/10/04 02:49:19
nit: please use C++ style
reinterpret_cast<const
halyavin
2013/10/04 13:16:59
Done.
|
+ sizeof(value))) { |
+ closesocket(result); |
+ result = kInvalidSocket; |
jar (doing other things)
2013/10/04 02:49:19
nit: easier to read is a direct:
return kInvalidSo
halyavin
2013/10/04 13:16:59
Done.
|
+ } |
+ } |
+ return result; |
#else // OS_WIN |
return ::socket(family, type, protocol); |
#endif // OS_WIN |