| OLD | NEW |
| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 ASSERT(*os_error == NULL); | 201 ASSERT(*os_error == NULL); |
| 202 *os_error = new OSError(status, | 202 *os_error = new OSError(status, |
| 203 gai_strerror(status), | 203 gai_strerror(status), |
| 204 OSError::kGetAddressInfo); | 204 OSError::kGetAddressInfo); |
| 205 return NULL; | 205 return NULL; |
| 206 } | 206 } |
| 207 intptr_t count = 0; | 207 intptr_t count = 0; |
| 208 for (struct addrinfo* c = info; c != NULL; c = c->ai_next) { | 208 for (struct addrinfo* c = info; c != NULL; c = c->ai_next) { |
| 209 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) count++; | 209 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) count++; |
| 210 } | 210 } |
| 211 int i = 0; | 211 intptr_t i = 0; |
| 212 AddressList<SocketAddress>* addresses = new AddressList<SocketAddress>(count); | 212 AddressList<SocketAddress>* addresses = new AddressList<SocketAddress>(count); |
| 213 for (struct addrinfo* c = info; c != NULL; c = c->ai_next) { | 213 for (struct addrinfo* c = info; c != NULL; c = c->ai_next) { |
| 214 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) { | 214 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) { |
| 215 addresses->SetAt(i, new SocketAddress(c->ai_addr)); | 215 addresses->SetAt(i, new SocketAddress(c->ai_addr)); |
| 216 i++; | 216 i++; |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 freeaddrinfo(info); | 219 freeaddrinfo(info); |
| 220 return addresses; | 220 return addresses; |
| 221 } | 221 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 SOL_TCP, | 366 SOL_TCP, |
| 367 TCP_NODELAY, | 367 TCP_NODELAY, |
| 368 reinterpret_cast<char *>(&on), | 368 reinterpret_cast<char *>(&on), |
| 369 sizeof(on))) == 0; | 369 sizeof(on))) == 0; |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace bin | 372 } // namespace bin |
| 373 } // namespace dart | 373 } // namespace dart |
| 374 | 374 |
| 375 #endif // defined(TARGET_OS_LINUX) | 375 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |