| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 TEMP_FAILURE_RETRY(close(fd)); | 322 TEMP_FAILURE_RETRY(close(fd)); |
| 323 return -1; | 323 return -1; |
| 324 } | 324 } |
| 325 | 325 |
| 326 // Test for invalid socket port 65535 (some browsers disallow it). | 326 // Test for invalid socket port 65535 (some browsers disallow it). |
| 327 if (port == 0 && Socket::GetPort(fd) == 65535) { | 327 if (port == 0 && Socket::GetPort(fd) == 65535) { |
| 328 // Don't close fd until we have created new. By doing that we ensure another | 328 // Don't close fd until we have created new. By doing that we ensure another |
| 329 // port. | 329 // port. |
| 330 intptr_t new_fd = CreateBindListen(addr, 0, backlog, v6_only); | 330 intptr_t new_fd = CreateBindListen(addr, 0, backlog, v6_only); |
| 331 int err = errno; | 331 int err = errno; |
| 332 TEMP_FAILURE_RETRY(close(fd)); | 332 VOID_TEMP_FAILURE_RETRY(close(fd)); |
| 333 errno = err; | 333 errno = err; |
| 334 return new_fd; | 334 return new_fd; |
| 335 } | 335 } |
| 336 | 336 |
| 337 if (TEMP_FAILURE_RETRY(listen(fd, backlog > 0 ? backlog : SOMAXCONN)) != 0) { | 337 if (TEMP_FAILURE_RETRY(listen(fd, backlog > 0 ? backlog : SOMAXCONN)) != 0) { |
| 338 TEMP_FAILURE_RETRY(close(fd)); | 338 TEMP_FAILURE_RETRY(close(fd)); |
| 339 return -1; | 339 return -1; |
| 340 } | 340 } |
| 341 | 341 |
| 342 Socket::SetNonBlocking(fd); | 342 Socket::SetNonBlocking(fd); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 SOL_TCP, | 402 SOL_TCP, |
| 403 TCP_NODELAY, | 403 TCP_NODELAY, |
| 404 reinterpret_cast<char *>(&on), | 404 reinterpret_cast<char *>(&on), |
| 405 sizeof(on))) == 0; | 405 sizeof(on))) == 0; |
| 406 } | 406 } |
| 407 | 407 |
| 408 } // namespace bin | 408 } // namespace bin |
| 409 } // namespace dart | 409 } // namespace dart |
| 410 | 410 |
| 411 #endif // defined(TARGET_OS_ANDROID) | 411 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |