| 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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
| 6 | 6 |
| 7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
| 8 #if defined(TARGET_OS_MACOS) | 8 #if defined(TARGET_OS_MACOS) |
| 9 | 9 |
| 10 #include "bin/socket.h" | 10 #include "bin/socket.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr))); | 96 bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr))); |
| 97 if ((result != 0) && (errno != EINPROGRESS)) { | 97 if ((result != 0) && (errno != EINPROGRESS)) { |
| 98 VOID_TEMP_FAILURE_RETRY(close(fd)); | 98 VOID_TEMP_FAILURE_RETRY(close(fd)); |
| 99 return -1; | 99 return -1; |
| 100 } | 100 } |
| 101 | 101 |
| 102 return Connect(fd, addr); | 102 return Connect(fd, addr); |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 bool Socket::IsBindError(intptr_t error_number) { | |
| 107 return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL || | |
| 108 error_number == EINVAL; | |
| 109 } | |
| 110 | |
| 111 | |
| 112 intptr_t Socket::Available(intptr_t fd) { | 106 intptr_t Socket::Available(intptr_t fd) { |
| 113 return FDUtils::AvailableBytes(fd); | 107 return FDUtils::AvailableBytes(fd); |
| 114 } | 108 } |
| 115 | 109 |
| 116 | 110 |
| 117 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { | 111 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { |
| 118 ASSERT(fd >= 0); | 112 ASSERT(fd >= 0); |
| 119 ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes)); | 113 ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes)); |
| 120 ASSERT(EAGAIN == EWOULDBLOCK); | 114 ASSERT(EAGAIN == EWOULDBLOCK); |
| 121 if ((read_bytes == -1) && (errno == EWOULDBLOCK)) { | 115 if ((read_bytes == -1) && (errno == EWOULDBLOCK)) { |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 int interfaceIndex) { | 625 int interfaceIndex) { |
| 632 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); | 626 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); |
| 633 } | 627 } |
| 634 | 628 |
| 635 } // namespace bin | 629 } // namespace bin |
| 636 } // namespace dart | 630 } // namespace dart |
| 637 | 631 |
| 638 #endif // defined(TARGET_OS_MACOS) | 632 #endif // defined(TARGET_OS_MACOS) |
| 639 | 633 |
| 640 #endif // !defined(DART_IO_DISABLED) | 634 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |