Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: runtime/bin/socket_win.cc

Issue 257243002: Don't use AI_V4MAPPED. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also for win. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/eventhandler.h" 9 #include "bin/eventhandler.h"
10 #include "bin/file.h" 10 #include "bin/file.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 Initialize(); 226 Initialize();
227 227
228 // getaddrinfo is not thread-safe on Windows. Use a mutex to get around it. 228 // getaddrinfo is not thread-safe on Windows. Use a mutex to get around it.
229 MutexLocker locker(getaddrinfo_mutex); 229 MutexLocker locker(getaddrinfo_mutex);
230 230
231 // Perform a name lookup for a host name. 231 // Perform a name lookup for a host name.
232 struct addrinfo hints; 232 struct addrinfo hints;
233 memset(&hints, 0, sizeof(hints)); 233 memset(&hints, 0, sizeof(hints));
234 hints.ai_family = SocketAddress::FromType(type); 234 hints.ai_family = SocketAddress::FromType(type);
235 hints.ai_socktype = SOCK_STREAM; 235 hints.ai_socktype = SOCK_STREAM;
236 hints.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG); 236 hints.ai_flags = AI_ADDRCONFIG;
237 hints.ai_protocol = IPPROTO_TCP; 237 hints.ai_protocol = IPPROTO_TCP;
238 struct addrinfo* info = NULL; 238 struct addrinfo* info = NULL;
239 int status = getaddrinfo(host, 0, &hints, &info); 239 int status = getaddrinfo(host, 0, &hints, &info);
240 if (status != 0) { 240 if (status != 0) {
241 // We failed, try without AI_ADDRCONFIG. This can happen when looking up 241 // We failed, try without AI_ADDRCONFIG. This can happen when looking up
242 // e.g. '::1', when there are no global IPv6 addresses. 242 // e.g. '::1', when there are no global IPv6 addresses.
243 hints.ai_flags = AI_V4MAPPED; 243 hints.ai_flags = 0;
244 status = getaddrinfo(host, 0, &hints, &info); 244 status = getaddrinfo(host, 0, &hints, &info);
245 } 245 }
246 if (status != 0) { 246 if (status != 0) {
247 ASSERT(*os_error == NULL); 247 ASSERT(*os_error == NULL);
248 DWORD error_code = WSAGetLastError(); 248 DWORD error_code = WSAGetLastError();
249 SetLastError(error_code); 249 SetLastError(error_code);
250 *os_error = new OSError(); 250 *os_error = new OSError();
251 return NULL; 251 return NULL;
252 } 252 }
253 intptr_t count = 0; 253 intptr_t count = 0;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 proto, 647 proto,
648 MCAST_LEAVE_GROUP, 648 MCAST_LEAVE_GROUP,
649 reinterpret_cast<char *>(&mreq), 649 reinterpret_cast<char *>(&mreq),
650 sizeof(mreq)) == 0; 650 sizeof(mreq)) == 0;
651 } 651 }
652 652
653 } // namespace bin 653 } // namespace bin
654 } // namespace dart 654 } // namespace dart
655 655
656 #endif // defined(TARGET_OS_WINDOWS) 656 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698