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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 onData, | 807 onData, |
808 onError: onError, | 808 onError: onError, |
809 onDone: onDone, | 809 onDone: onDone, |
810 cancelOnError: cancelOnError); | 810 cancelOnError: cancelOnError); |
811 } | 811 } |
812 | 812 |
813 int available() => _socket.available(); | 813 int available() => _socket.available(); |
814 | 814 |
815 List<int> read([int len]) { | 815 List<int> read([int len]) { |
816 if (_isMacOSTerminalInput) { | 816 if (_isMacOSTerminalInput) { |
817 var available = available(); | 817 var available = this.available(); |
818 if (available == 0) return null; | 818 if (available == 0) return null; |
819 var data = _socket.read(len); | 819 var data = _socket.read(len); |
820 if (data == null || data.length < available) { | 820 if (data == null || data.length < available) { |
821 // Reading less than available from a Mac OS terminal indicate Ctrl-D. | 821 // Reading less than available from a Mac OS terminal indicate Ctrl-D. |
822 // This is interpreted as read closed. | 822 // This is interpreted as read closed. |
823 scheduleMicrotask(() => _controller.add(RawSocketEvent.READ_CLOSED)); | 823 scheduleMicrotask(() => _controller.add(RawSocketEvent.READ_CLOSED)); |
824 } | 824 } |
825 return data; | 825 return data; |
826 } else { | 826 } else { |
827 return _socket.read(len); | 827 return _socket.read(len); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 if (_detachReady != null) { | 1216 if (_detachReady != null) { |
1217 _detachReady.complete(null); | 1217 _detachReady.complete(null); |
1218 } else { | 1218 } else { |
1219 if (_raw != null) { | 1219 if (_raw != null) { |
1220 _raw.shutdown(SocketDirection.SEND); | 1220 _raw.shutdown(SocketDirection.SEND); |
1221 _disableWriteEvent(); | 1221 _disableWriteEvent(); |
1222 } | 1222 } |
1223 } | 1223 } |
1224 } | 1224 } |
1225 } | 1225 } |
OLD | NEW |