| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class _SocketInputStream implements SocketInputStream { | 5 class _SocketInputStream implements SocketInputStream { |
| 6 _SocketInputStream(Socket socket) : _socket = socket { | 6 _SocketInputStream(Socket socket) : _socket = socket { |
| 7 if (_socket._id == -1) _closed = true; | 7 if (_socket._id == -1) _closed = true; |
| 8 _socket.onClosed = _onClosed; | 8 _socket.onClosed = _onClosed; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 void destroy() { | 132 void destroy() { |
| 133 _socket.onWrite = null; | 133 _socket.onWrite = null; |
| 134 _pendingWrites.clear(); | 134 _pendingWrites.clear(); |
| 135 _socket.close(); | 135 _socket.close(); |
| 136 _closed = true; | 136 _closed = true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool get closed() => _closed; |
| 140 |
| 139 void set onNoPendingWrites(void callback()) { | 141 void set onNoPendingWrites(void callback()) { |
| 140 _onNoPendingWrites = callback; | 142 _onNoPendingWrites = callback; |
| 141 if (_onNoPendingWrites != null) { | 143 if (_onNoPendingWrites != null) { |
| 142 _socket._onWrite = _onWrite; | 144 _socket._onWrite = _onWrite; |
| 143 } | 145 } |
| 144 } | 146 } |
| 145 | 147 |
| 146 void set onClosed(void callback()) { | 148 void set onClosed(void callback()) { |
| 147 _onClosed = callback; | 149 _onClosed = callback; |
| 148 } | 150 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 214 } |
| 213 } | 215 } |
| 214 | 216 |
| 215 Socket _socket; | 217 Socket _socket; |
| 216 _BufferList _pendingWrites; | 218 _BufferList _pendingWrites; |
| 217 Function _onNoPendingWrites; | 219 Function _onNoPendingWrites; |
| 218 Function _onClosed; | 220 Function _onClosed; |
| 219 bool _closing = false; | 221 bool _closing = false; |
| 220 bool _closed = false; | 222 bool _closed = false; |
| 221 } | 223 } |
| OLD | NEW |