| 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 patch class RawServerSocket { | 5 patch class RawServerSocket { |
| 6 /* patch */ static Future<RawServerSocket> bind(address, | 6 /* patch */ static Future<RawServerSocket> bind(address, |
| 7 int port, | 7 int port, |
| 8 {int backlog: 0, | 8 {int backlog: 0, |
| 9 bool v6Only: false}) { | 9 bool v6Only: false}) { |
| 10 return _RawServerSocket.bind(address, port, backlog, v6Only); | 10 return _RawServerSocket.bind(address, port, backlog, v6Only); |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 int available() => _socket.available(); | 814 int available() => _socket.available(); |
| 815 | 815 |
| 816 List<int> read([int len]) { | 816 List<int> read([int len]) { |
| 817 if (_isMacOSTerminalInput) { | 817 if (_isMacOSTerminalInput) { |
| 818 var available = available(); | 818 var available = available(); |
| 819 if (available == 0) return null; | 819 if (available == 0) return null; |
| 820 var data = _socket.read(len); | 820 var data = _socket.read(len); |
| 821 if (data == null || data.length < available) { | 821 if (data == null || data.length < available) { |
| 822 // Reading less than available from a Mac OS terminal indicate Ctrl-D. | 822 // Reading less than available from a Mac OS terminal indicate Ctrl-D. |
| 823 // This is interpreted as read closed. | 823 // This is interpreted as read closed. |
| 824 runAsync(() => _controller.add(RawSocketEvent.READ_CLOSED)); | 824 scheduleMicrotask(() => _controller.add(RawSocketEvent.READ_CLOSED)); |
| 825 } | 825 } |
| 826 return data; | 826 return data; |
| 827 } else { | 827 } else { |
| 828 return _socket.read(len); | 828 return _socket.read(len); |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 | 831 |
| 832 int write(List<int> buffer, [int offset, int count]) => | 832 int write(List<int> buffer, [int offset, int count]) => |
| 833 _socket.write(buffer, offset, count); | 833 _socket.write(buffer, offset, count); |
| 834 | 834 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 if (_detachReady != null) { | 1215 if (_detachReady != null) { |
| 1216 _detachReady.complete(null); | 1216 _detachReady.complete(null); |
| 1217 } else { | 1217 } else { |
| 1218 if (_raw != null) { | 1218 if (_raw != null) { |
| 1219 _raw.shutdown(SocketDirection.SEND); | 1219 _raw.shutdown(SocketDirection.SEND); |
| 1220 _disableWriteEvent(); | 1220 _disableWriteEvent(); |
| 1221 } | 1221 } |
| 1222 } | 1222 } |
| 1223 } | 1223 } |
| 1224 } | 1224 } |
| OLD | NEW |