| 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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 Socket::SetNonBlocking(fd); | 52 Socket::SetNonBlocking(fd); |
| 53 | 53 |
| 54 SocketAddress::SetAddrPort(&addr, port); | 54 SocketAddress::SetAddrPort(&addr, port); |
| 55 intptr_t result = TEMP_FAILURE_RETRY( | 55 intptr_t result = TEMP_FAILURE_RETRY( |
| 56 connect(fd, | 56 connect(fd, |
| 57 &addr.addr, | 57 &addr.addr, |
| 58 SocketAddress::GetAddrLength(addr))); | 58 SocketAddress::GetAddrLength(addr))); |
| 59 if (result == 0 || errno == EINPROGRESS) { | 59 if (result == 0 || errno == EINPROGRESS) { |
| 60 return fd; | 60 return fd; |
| 61 } | 61 } |
| 62 TEMP_FAILURE_RETRY(close(fd)); | 62 VOID_TEMP_FAILURE_RETRY(close(fd)); |
| 63 return -1; | 63 return -1; |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 intptr_t Socket::Available(intptr_t fd) { | 67 intptr_t Socket::Available(intptr_t fd) { |
| 68 return FDUtils::AvailableBytes(fd); | 68 return FDUtils::AvailableBytes(fd); |
| 69 } | 69 } |
| 70 | 70 |
| 71 | 71 |
| 72 int Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { | 72 int Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 bool Socket::SetNoDelay(intptr_t fd, bool enabled) { | 286 bool Socket::SetNoDelay(intptr_t fd, bool enabled) { |
| 287 int on = enabled ? 1 : 0; | 287 int on = enabled ? 1 : 0; |
| 288 return TEMP_FAILURE_RETRY(setsockopt(fd, | 288 return TEMP_FAILURE_RETRY(setsockopt(fd, |
| 289 IPPROTO_TCP, | 289 IPPROTO_TCP, |
| 290 TCP_NODELAY, | 290 TCP_NODELAY, |
| 291 reinterpret_cast<char *>(&on), | 291 reinterpret_cast<char *>(&on), |
| 292 sizeof(on))) == 0; | 292 sizeof(on))) == 0; |
| 293 } | 293 } |
| 294 | 294 |
| 295 #endif // defined(TARGET_OS_MACOS) | 295 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |