| Index: runtime/bin/socket_stream_impl.dart
|
| diff --git a/runtime/bin/socket_stream_impl.dart b/runtime/bin/socket_stream_impl.dart
|
| index 678259db6f4e2d6bb6d237d1b096ac02a6a2ca7b..952b4d1585b961d22e017e5c342b9b23edfed47e 100644
|
| --- a/runtime/bin/socket_stream_impl.dart
|
| +++ b/runtime/bin/socket_stream_impl.dart
|
| @@ -66,10 +66,6 @@ class _SocketInputStream implements SocketInputStream {
|
| _socket._onClosed = _onClosed;
|
| }
|
|
|
| - void set onError(void callback()) {
|
| - _socket.onError = callback;
|
| - }
|
| -
|
| void _onClosed() {
|
| _closed = true;
|
| if (_clientCloseHandler !== null) {
|
| @@ -77,9 +73,19 @@ class _SocketInputStream implements SocketInputStream {
|
| }
|
| }
|
|
|
| + void set onError(void callback(Exception e)) {
|
| + _errorCallback = callback;
|
| + }
|
| +
|
| + void _onError(Exception e) {
|
| + close();
|
| + if (_errorCallback != null) _errorCallback(e);
|
| + }
|
| +
|
| Socket _socket;
|
| - Function _clientCloseHandler;
|
| bool _closed = false;
|
| + Function _clientCloseHandler;
|
| + Function _errorCallback;
|
| }
|
|
|
|
|
| @@ -123,15 +129,6 @@ class _SocketOutputStream
|
| }
|
| }
|
|
|
| - void set onError(void callback()) {
|
| - _streamErrorHandler = callback;
|
| - if (_streamErrorHandler != null) {
|
| - _socket.onError = _onError;
|
| - } else {
|
| - _socket.onError = null;
|
| - }
|
| - }
|
| -
|
| bool _write(List<int> buffer, int offset, int len, bool copyBuffer) {
|
| if (_closing || _closed) throw new StreamException("Stream closed");
|
| int bytesWritten = 0;
|
| @@ -180,15 +177,19 @@ class _SocketOutputStream
|
| if (_onNoPendingWrites == null) _socket._onWrite = null;
|
| }
|
|
|
| - void _onError() {
|
| + void set onError(void callback(Exception e)) {
|
| + _errorCallback = callback;
|
| + }
|
| +
|
| + void _onError(Exception e) {
|
| close();
|
| - if (_streamErrorHandler != null) _streamErrorHandler();
|
| + if (_errorCallback != null) _errorCallback(e);
|
| }
|
|
|
| Socket _socket;
|
| _BufferList _pendingWrites;
|
| var _onNoPendingWrites;
|
| - var _streamErrorHandler;
|
| + Function _errorCallback;
|
| bool _closing = false;
|
| bool _closed = false;
|
| }
|
|
|