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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 _incoming = null; | 923 _incoming = null; |
924 if (_bodyController != null) { | 924 if (_bodyController != null) { |
925 _bodyController.close(); | 925 _bodyController.close(); |
926 _bodyController = null; | 926 _bodyController = null; |
927 } | 927 } |
928 _bodyPaused = false; | 928 _bodyPaused = false; |
929 _pauseStateChanged(); | 929 _pauseStateChanged(); |
930 } | 930 } |
931 | 931 |
932 void _pauseStateChanged() { | 932 void _pauseStateChanged() { |
933 void update(bool pause) { | |
934 if (pause && !_socketSubscription.isPaused) { | |
935 _socketSubscription.pause(); | |
936 } else if (!pause && _socketSubscription.isPaused) { | |
937 _socketSubscription.resume(); | |
938 } | |
939 } | |
940 | |
941 if (_incoming != null) { | 933 if (_incoming != null) { |
942 if (!_bodyPaused && !_parserCalled) { | 934 if (!_bodyPaused && !_parserCalled) { |
943 _parse(); | 935 _parse(); |
944 } | 936 } |
945 } else { | 937 } else { |
946 if (!_paused && !_parserCalled) { | 938 if (!_paused && !_parserCalled) { |
947 _parse(); | 939 _parse(); |
948 } | 940 } |
949 } | 941 } |
950 } | 942 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 StreamController<_HttpIncoming> _controller; | 985 StreamController<_HttpIncoming> _controller; |
994 StreamController<List<int>> _bodyController; | 986 StreamController<List<int>> _bodyController; |
995 } | 987 } |
996 | 988 |
997 | 989 |
998 class HttpParserException implements Exception { | 990 class HttpParserException implements Exception { |
999 const HttpParserException([String this.message = ""]); | 991 const HttpParserException([String this.message = ""]); |
1000 String toString() => "HttpParserException: $message"; | 992 String toString() => "HttpParserException: $message"; |
1001 final String message; | 993 final String message; |
1002 } | 994 } |
OLD | NEW |