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 | |
939 if (_incoming != null) { | 931 if (_incoming != null) { |
940 if (!_bodyPaused && !_parserCalled) { | 932 if (!_bodyPaused && !_parserCalled) { |
941 _parse(); | 933 _parse(); |
942 } | 934 } |
943 } else { | 935 } else { |
944 if (!_paused && !_parserCalled) { | 936 if (!_paused && !_parserCalled) { |
945 _parse(); | 937 _parse(); |
946 } | 938 } |
947 } | 939 } |
948 } | 940 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 StreamController<_HttpIncoming> _controller; | 983 StreamController<_HttpIncoming> _controller; |
992 StreamController<List<int>> _bodyController; | 984 StreamController<List<int>> _bodyController; |
993 } | 985 } |
994 | 986 |
995 | 987 |
996 class HttpParserException implements Exception { | 988 class HttpParserException implements Exception { |
997 const HttpParserException([String this.message = ""]); | 989 const HttpParserException([String this.message = ""]); |
998 String toString() => "HttpParserException: $message"; | 990 String toString() => "HttpParserException: $message"; |
999 final String message; | 991 final String message; |
1000 } | 992 } |
OLD | NEW |