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

Unified Diff: sdk/lib/io/http_parser.dart

Issue 12385048: Support canceling an incoming message, while the other end will be notified (by write-error from th… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/http_close_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_parser.dart
diff --git a/sdk/lib/io/http_parser.dart b/sdk/lib/io/http_parser.dart
index d3a7e76261f10559f3b13cc876af4fa0bd20e188..68fbc324ab643af712ada50b8ab1c53930dd198b 100644
--- a/sdk/lib/io/http_parser.dart
+++ b/sdk/lib/io/http_parser.dart
@@ -874,7 +874,7 @@ class _HttpParser
assert(_incoming == null);
assert(_bodyController == null);
_bodyController = new StreamController<List<int>>(
- onSubscriptionStateChange: _updateParsePauseState,
+ onSubscriptionStateChange: _bodySubscriptionStateChange,
onPauseStateChange: _updateParsePauseState);
_incoming = new _HttpIncoming(
_headers, transferLength, _bodyController.stream);
@@ -902,6 +902,14 @@ class _HttpParser
_paused = true;
}
+ void _bodySubscriptionStateChange() {
+ if (_incoming != null && !_bodyController.hasSubscribers) {
+ _closeIncoming();
+ } else {
+ _updateParsePauseState();
+ }
+ }
+
void _updateParsePauseState() {
if (_bodyController != null) {
if (_bodyController.hasSubscribers && !_bodyController.isPaused) {
« no previous file with comments | « no previous file | tests/standalone/io/http_close_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698