| 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; | 7 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
| 8 | 8 |
| 9 class _WebSocketMessageType { | 9 class _WebSocketMessageType { |
| 10 static const int NONE = 0; | 10 static const int NONE = 0; |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 (data) => _processor.update(data, 0, data.length), | 555 (data) => _processor.update(data, 0, data.length), |
| 556 onDone: () => _processor.closed(), | 556 onDone: () => _processor.closed(), |
| 557 onError: (error) => _controller.signalError(error)); | 557 onError: (error) => _controller.signalError(error)); |
| 558 | 558 |
| 559 _socket.done | 559 _socket.done |
| 560 .catchError((error) { | 560 .catchError((error) { |
| 561 if (_readyState == WebSocket.CLOSED) return; | 561 if (_readyState == WebSocket.CLOSED) return; |
| 562 _readyState = WebSocket.CLOSED; | 562 _readyState = WebSocket.CLOSED; |
| 563 _controller.signalError(error); | 563 _controller.signalError(error); |
| 564 _controller.close(); | 564 _controller.close(); |
| 565 _processor.closed(); | |
| 566 _socket.destroy(); | 565 _socket.destroy(); |
| 567 }) | 566 }) |
| 568 .whenComplete(() { | 567 .whenComplete(() { |
| 569 _writeClosed = true; | 568 _writeClosed = true; |
| 570 }); | 569 }); |
| 571 } | 570 } |
| 572 | 571 |
| 573 StreamSubscription<Event> listen(void onData(Event event), | 572 StreamSubscription<Event> listen(void onData(Event event), |
| 574 {void onError(AsyncError error), | 573 {void onError(AsyncError error), |
| 575 void onDone(), | 574 void onDone(), |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 691 |
| 693 class _WebSocketCloseEvent implements CloseEvent { | 692 class _WebSocketCloseEvent implements CloseEvent { |
| 694 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); | 693 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); |
| 695 bool get wasClean => _wasClean; | 694 bool get wasClean => _wasClean; |
| 696 int get code => _code; | 695 int get code => _code; |
| 697 String get reason => _reason; | 696 String get reason => _reason; |
| 698 bool _wasClean; | 697 bool _wasClean; |
| 699 int _code; | 698 int _code; |
| 700 String _reason; | 699 String _reason; |
| 701 } | 700 } |
| OLD | NEW |