| 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 final String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; | 5 final String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
| 6 | 6 |
| 7 class _WebSocketMessageType { | 7 class _WebSocketMessageType { |
| 8 static final int NONE = 0; | 8 static final int NONE = 0; |
| 9 static final int BINARY = 1; | 9 static final int BINARY = 1; |
| 10 static final int TEXT = 2; | 10 static final int TEXT = 2; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 if (_closeTimer != null) _closeTimer.cancel(); | 438 if (_closeTimer != null) _closeTimer.cancel(); |
| 439 _socket.close(); | 439 _socket.close(); |
| 440 }; | 440 }; |
| 441 _closeTimer = new Timer(5000, (t) { | 441 _closeTimer = new Timer(5000, (t) { |
| 442 _socket.close(); | 442 _socket.close(); |
| 443 }); | 443 }); |
| 444 } else { | 444 } else { |
| 445 // Half close the socket and expect a close frame in response | 445 // Half close the socket and expect a close frame in response |
| 446 // before closing the socket. If a close frame does not arrive | 446 // before closing the socket. If a close frame does not arrive |
| 447 // within a reasonable amount of time just close the socket. | 447 // within a reasonable amount of time just close the socket. |
| 448 _socket.close(true); | 448 _socket.outputStream.close(); |
| 449 _closeTimer = new Timer(5000, (t) { | 449 _closeTimer = new Timer(5000, (t) { |
| 450 _socket.close(); | 450 _socket.close(); |
| 451 }); | 451 }); |
| 452 } | 452 } |
| 453 _closeSent = true; | 453 _closeSent = true; |
| 454 } | 454 } |
| 455 | 455 |
| 456 _onWebSocketMessageStart(int type) { | 456 _onWebSocketMessageStart(int type) { |
| 457 _currentMessageType = type; | 457 _currentMessageType = type; |
| 458 if (_currentMessageType == _WebSocketMessageType.TEXT) { | 458 if (_currentMessageType == _WebSocketMessageType.TEXT) { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 } | 726 } |
| 727 return true; | 727 return true; |
| 728 } | 728 } |
| 729 | 729 |
| 730 Function _onRequest; | 730 Function _onRequest; |
| 731 Function _onOpen; | 731 Function _onOpen; |
| 732 Function _onNoUpgrade; | 732 Function _onNoUpgrade; |
| 733 HttpClientConnection _conn; | 733 HttpClientConnection _conn; |
| 734 String _nonce; | 734 String _nonce; |
| 735 } | 735 } |
| OLD | NEW |