Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: sdk/lib/io/http_parser.dart

Issue 12438008: Fix multiple close of incoming in _HttpParser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/io/http_server_early_client_close_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 assert(_bodyController == null); 875 assert(_bodyController == null);
876 _bodyController = new StreamController<List<int>>( 876 _bodyController = new StreamController<List<int>>(
877 onSubscriptionStateChange: _bodySubscriptionStateChange, 877 onSubscriptionStateChange: _bodySubscriptionStateChange,
878 onPauseStateChange: _updateParsePauseState); 878 onPauseStateChange: _updateParsePauseState);
879 _incoming = new _HttpIncoming( 879 _incoming = new _HttpIncoming(
880 _headers, transferLength, _bodyController.stream); 880 _headers, transferLength, _bodyController.stream);
881 _pauseParsing(); // Needed to handle detaching - don't start on the body! 881 _pauseParsing(); // Needed to handle detaching - don't start on the body!
882 } 882 }
883 883
884 void _closeIncoming() { 884 void _closeIncoming() {
885 assert(_incoming != null); 885 // Ignore multiple close (can happend in re-entrance).
886 if (_incoming == null) return;
886 var tmp = _incoming; 887 var tmp = _incoming;
887 _incoming = null; 888 _incoming = null;
888 tmp.close(); 889 tmp.close();
889 if (_bodyController != null) { 890 if (_bodyController != null) {
890 _bodyController.close(); 891 _bodyController.close();
891 _bodyController = null; 892 _bodyController = null;
892 } 893 }
893 _updateParsePauseState(); 894 _updateParsePauseState();
894 } 895 }
895 896
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 StreamController<_HttpIncoming> _controller; 971 StreamController<_HttpIncoming> _controller;
971 StreamController<List<int>> _bodyController; 972 StreamController<List<int>> _bodyController;
972 } 973 }
973 974
974 975
975 class HttpParserException implements Exception { 976 class HttpParserException implements Exception {
976 const HttpParserException([String this.message = ""]); 977 const HttpParserException([String this.message = ""]);
977 String toString() => "HttpParserException: $message"; 978 String toString() => "HttpParserException: $message";
978 final String message; 979 final String message;
979 } 980 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/http_server_early_client_close_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698