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

Unified Diff: runtime/bin/socket_patch.dart

Issue 12314148: Make sure the socket unsubscribes on error, so we don't get race conditions between an error and an… (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 | sdk/lib/io/io_stream_consumer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 90cdb56464b9f6b12dafe704b7209d6dc0471c85..3f7362858ba49241c8432f76e3cbc830ec0b0c32 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -659,19 +659,21 @@ class _SocketStreamConsumer extends StreamConsumer<List<int>, Socket> {
Future<Socket> consume(Stream<List<int>> stream) {
if (socket._raw != null) {
- subscription = stream.listen((data) {
- assert(!paused);
- assert(buffer == null);
- buffer = data;
- offset = 0;
- write();
- },
- onError: (error) {
- socket._consumerDone(error);
- },
- onDone: () {
- socket._consumerDone();
- });
+ subscription = stream.listen(
+ (data) {
+ assert(!paused);
+ assert(buffer == null);
+ buffer = data;
+ offset = 0;
+ write();
+ },
+ onError: (error) {
+ socket._consumerDone(error);
+ },
+ onDone: () {
+ socket._consumerDone();
+ },
+ unsubscribeOnError: true);
}
return socket._doneFuture;
}
« no previous file with comments | « no previous file | sdk/lib/io/io_stream_consumer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698