OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 8 #if defined(TARGET_OS_FUCHSIA) |
9 | 9 |
10 #include "bin/socket.h" | 10 #include "bin/socket.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 bool Socket::IsBindError(intptr_t error_number) { | 133 bool Socket::IsBindError(intptr_t error_number) { |
134 return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL || | 134 return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL || |
135 error_number == EINVAL; | 135 error_number == EINVAL; |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 intptr_t Socket::Available(intptr_t fd) { | 139 intptr_t Socket::Available(intptr_t fd) { |
140 return FDUtils::AvailableBytes(fd); | 140 intptr_t available = FDUtils::AvailableBytes(fd); |
| 141 LOG_INFO("Socket::Available(%ld) = %ld\n", fd, available); |
| 142 return available; |
141 } | 143 } |
142 | 144 |
143 | 145 |
144 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { | 146 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { |
145 ASSERT(fd >= 0); | 147 ASSERT(fd >= 0); |
146 LOG_INFO("Socket::Read: calling read(%ld, %p, %ld)\n", fd, buffer, num_bytes); | 148 LOG_INFO("Socket::Read: calling read(%ld, %p, %ld)\n", fd, buffer, num_bytes); |
147 ssize_t read_bytes = NO_RETRY_EXPECTED(read(fd, buffer, num_bytes)); | 149 ssize_t read_bytes = NO_RETRY_EXPECTED(read(fd, buffer, num_bytes)); |
148 ASSERT(EAGAIN == EWOULDBLOCK); | 150 ASSERT(EAGAIN == EWOULDBLOCK); |
149 if ((read_bytes == -1) && (errno == EWOULDBLOCK)) { | 151 if ((read_bytes == -1) && (errno == EWOULDBLOCK)) { |
150 // If the read would block we need to retry and therefore return 0 | 152 // If the read would block we need to retry and therefore return 0 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 UNIMPLEMENTED(); | 530 UNIMPLEMENTED(); |
529 return false; | 531 return false; |
530 } | 532 } |
531 | 533 |
532 } // namespace bin | 534 } // namespace bin |
533 } // namespace dart | 535 } // namespace dart |
534 | 536 |
535 #endif // defined(TARGET_OS_FUCHSIA) | 537 #endif // defined(TARGET_OS_FUCHSIA) |
536 | 538 |
537 #endif // !defined(DART_IO_DISABLED) | 539 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |