Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 | 214 |
| 215 | 215 |
| 216 AddressList<SocketAddress>* Socket::LookupAddress(const char* host, | 216 AddressList<SocketAddress>* Socket::LookupAddress(const char* host, |
| 217 int type, | 217 int type, |
| 218 OSError** os_error) { | 218 OSError** os_error) { |
| 219 // Perform a name lookup for a host name. | 219 // Perform a name lookup for a host name. |
| 220 struct addrinfo hints; | 220 struct addrinfo hints; |
| 221 memset(&hints, 0, sizeof(hints)); | 221 memset(&hints, 0, sizeof(hints)); |
| 222 hints.ai_family = SocketAddress::FromType(type); | 222 hints.ai_family = SocketAddress::FromType(type); |
| 223 hints.ai_socktype = SOCK_STREAM; | 223 hints.ai_socktype = SOCK_STREAM; |
| 224 hints.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG); | 224 hints.ai_flags = 0; |
|
Anders Johnsen
2014/04/24 06:49:01
Please clean up the code below, as well. Why can w
| |
| 225 hints.ai_protocol = IPPROTO_TCP; | 225 hints.ai_protocol = IPPROTO_TCP; |
| 226 struct addrinfo* info = NULL; | 226 struct addrinfo* info = NULL; |
| 227 int status = getaddrinfo(host, 0, &hints, &info); | 227 int status = getaddrinfo(host, 0, &hints, &info); |
| 228 if (status != 0) { | 228 if (status != 0) { |
| 229 // We failed, try without AI_ADDRCONFIG. This can happen when looking up | 229 // We failed, try without AI_ADDRCONFIG. This can happen when looking up |
| 230 // e.g. '::1', when there are no IPv6 addresses. | 230 // e.g. '::1', when there are no IPv6 addresses. |
| 231 hints.ai_flags = AI_V4MAPPED; | 231 hints.ai_flags = AI_V4MAPPED; |
| 232 status = getaddrinfo(host, 0, &hints, &info); | 232 status = getaddrinfo(host, 0, &hints, &info); |
| 233 if (status != 0) { | 233 if (status != 0) { |
| 234 ASSERT(*os_error == NULL); | 234 ASSERT(*os_error == NULL); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 mreq.gr_interface = interfaceIndex; | 561 mreq.gr_interface = interfaceIndex; |
| 562 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr)); | 562 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr)); |
| 563 return NO_RETRY_EXPECTED(setsockopt( | 563 return NO_RETRY_EXPECTED(setsockopt( |
| 564 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; | 564 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; |
| 565 } | 565 } |
| 566 | 566 |
| 567 } // namespace bin | 567 } // namespace bin |
| 568 } // namespace dart | 568 } // namespace dart |
| 569 | 569 |
| 570 #endif // defined(TARGET_OS_ANDROID) | 570 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |