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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 // Global constants. | 7 // Global constants. |
8 class _Const { | 8 class _Const { |
9 // Bytes for "HTTP". | 9 // Bytes for "HTTP". |
10 static const HTTP = const [72, 84, 84, 80]; | 10 static const HTTP = const [72, 84, 84, 80]; |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 _incoming = null; | 921 _incoming = null; |
922 if (_bodyController != null) { | 922 if (_bodyController != null) { |
923 _bodyController.close(); | 923 _bodyController.close(); |
924 _bodyController = null; | 924 _bodyController = null; |
925 } | 925 } |
926 _bodyPaused = false; | 926 _bodyPaused = false; |
927 _pauseStateChanged(); | 927 _pauseStateChanged(); |
928 } | 928 } |
929 | 929 |
930 void _pauseStateChanged() { | 930 void _pauseStateChanged() { |
| 931 void update(bool pause) { |
| 932 if (pause && !_socketSubscription.isPaused) { |
| 933 _socketSubscription.pause(); |
| 934 } else if (!pause && _socketSubscription.isPaused) { |
| 935 _socketSubscription.resume(); |
| 936 } |
| 937 } |
| 938 |
931 if (_incoming != null) { | 939 if (_incoming != null) { |
932 if (!_bodyPaused && !_parserCalled) { | 940 if (!_bodyPaused && !_parserCalled) { |
933 _parse(); | 941 _parse(); |
934 } | 942 } |
935 } else { | 943 } else { |
936 if (!_paused && !_parserCalled) { | 944 if (!_paused && !_parserCalled) { |
937 _parse(); | 945 _parse(); |
938 } | 946 } |
939 } | 947 } |
940 } | 948 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 StreamController<_HttpIncoming> _controller; | 991 StreamController<_HttpIncoming> _controller; |
984 StreamController<List<int>> _bodyController; | 992 StreamController<List<int>> _bodyController; |
985 } | 993 } |
986 | 994 |
987 | 995 |
988 class HttpParserException implements Exception { | 996 class HttpParserException implements Exception { |
989 const HttpParserException([String this.message = ""]); | 997 const HttpParserException([String this.message = ""]); |
990 String toString() => "HttpParserException: $message"; | 998 String toString() => "HttpParserException: $message"; |
991 final String message; | 999 final String message; |
992 } | 1000 } |
OLD | NEW |