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

Side by Side Diff: runtime/bin/socket_linux.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 | « no previous file | runtime/bin/socket_win.cc » ('j') | 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_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include <errno.h> // NOLINT 8 #include <errno.h> // NOLINT
9 #include <stdio.h> // NOLINT 9 #include <stdio.h> // NOLINT
10 #include <stdlib.h> // NOLINT 10 #include <stdlib.h> // NOLINT
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 206
207 AddressList<SocketAddress>* Socket::LookupAddress(const char* host, 207 AddressList<SocketAddress>* Socket::LookupAddress(const char* host,
208 int type, 208 int type,
209 OSError** os_error) { 209 OSError** os_error) {
210 // Perform a name lookup for a host name. 210 // Perform a name lookup for a host name.
211 struct addrinfo hints; 211 struct addrinfo hints;
212 memset(&hints, 0, sizeof(hints)); 212 memset(&hints, 0, sizeof(hints));
213 hints.ai_family = SocketAddress::FromType(type); 213 hints.ai_family = SocketAddress::FromType(type);
214 hints.ai_socktype = SOCK_STREAM; 214 hints.ai_socktype = SOCK_STREAM;
215 hints.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG); 215 hints.ai_flags = AI_ADDRCONFIG;
216 hints.ai_protocol = IPPROTO_TCP; 216 hints.ai_protocol = IPPROTO_TCP;
217 struct addrinfo* info = NULL; 217 struct addrinfo* info = NULL;
218 int status = NO_RETRY_EXPECTED(getaddrinfo(host, 0, &hints, &info)); 218 int status = NO_RETRY_EXPECTED(getaddrinfo(host, 0, &hints, &info));
219 if (status != 0) { 219 if (status != 0) {
220 // We failed, try without AI_ADDRCONFIG. This can happen when looking up 220 // We failed, try without AI_ADDRCONFIG. This can happen when looking up
221 // e.g. '::1', when there are no global IPv6 addresses. 221 // e.g. '::1', when there are no global IPv6 addresses.
222 hints.ai_flags = AI_V4MAPPED; 222 hints.ai_flags = 0;
223 status = NO_RETRY_EXPECTED(getaddrinfo(host, 0, &hints, &info)); 223 status = NO_RETRY_EXPECTED(getaddrinfo(host, 0, &hints, &info));
224 if (status != 0) { 224 if (status != 0) {
225 ASSERT(*os_error == NULL); 225 ASSERT(*os_error == NULL);
226 *os_error = new OSError(status, 226 *os_error = new OSError(status,
227 gai_strerror(status), 227 gai_strerror(status),
228 OSError::kGetAddressInfo); 228 OSError::kGetAddressInfo);
229 return NULL; 229 return NULL;
230 } 230 }
231 } 231 }
232 intptr_t count = 0; 232 intptr_t count = 0;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 mreq.gr_interface = interfaceIndex; 560 mreq.gr_interface = interfaceIndex;
561 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr)); 561 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr));
562 return NO_RETRY_EXPECTED( 562 return NO_RETRY_EXPECTED(
563 setsockopt(fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; 563 setsockopt(fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0;
564 } 564 }
565 565
566 } // namespace bin 566 } // namespace bin
567 } // namespace dart 567 } // namespace dart
568 568
569 #endif // defined(TARGET_OS_LINUX) 569 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698