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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 return fd; | 92 return fd; |
93 } | 93 } |
94 | 94 |
95 intptr_t result = TEMP_FAILURE_RETRY( | 95 intptr_t result = TEMP_FAILURE_RETRY( |
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 FDUtils::SetNonBlocking(fd); | |
Søren Gjesse
2016/08/04 06:35:49
I think moving it to Create would be better - then
floitsch
2016/08/04 12:17:07
Done.
| |
103 | |
102 return Connect(fd, addr); | 104 return Connect(fd, addr); |
103 } | 105 } |
104 | 106 |
105 | 107 |
106 intptr_t Socket::Available(intptr_t fd) { | 108 intptr_t Socket::Available(intptr_t fd) { |
107 return FDUtils::AvailableBytes(fd); | 109 return FDUtils::AvailableBytes(fd); |
108 } | 110 } |
109 | 111 |
110 | 112 |
111 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { | 113 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
625 int interfaceIndex) { | 627 int interfaceIndex) { |
626 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); | 628 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); |
627 } | 629 } |
628 | 630 |
629 } // namespace bin | 631 } // namespace bin |
630 } // namespace dart | 632 } // namespace dart |
631 | 633 |
632 #endif // defined(TARGET_OS_MACOS) | 634 #endif // defined(TARGET_OS_MACOS) |
633 | 635 |
634 #endif // !defined(DART_IO_DISABLED) | 636 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |