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

Unified Diff: runtime/bin/socket_patch.dart

Issue 12330109: dart:io | Fix writing to a Socket while and after calling destroy() on it. (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/standalone.status » ('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 15dd4c7773dca2dfed3c5d8f227254c092b1a91e..a980f39ea19128e8adc6e2b5a4ce822f28142037 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -658,17 +658,18 @@ class _SocketStreamConsumer extends StreamConsumer<List<int>, Socket> {
_SocketStreamConsumer(this.socket);
Future<Socket> consume(Stream<List<int>> stream) {
- subscription = stream.listen(
- (data) {
- assert(!paused);
- assert(buffer == null);
- buffer = data;
- offset = 0;
- write();
- },
- onDone: () {
- socket._consumerDone();
- });
+ if (socket._raw != null) {
Anders Johnsen 2013/02/25 14:36:37 == null) return socket._doneFuture;, to avoid nest
Bill Hesse 2013/02/25 14:49:23 I just put that nesting in, on purpose, because it
+ subscription = stream.listen((data) {
+ assert(!paused);
+ assert(buffer == null);
+ buffer = data;
+ offset = 0;
+ write();
+ },
+ onDone: () {
+ socket._consumerDone();
+ });
+ }
return socket._doneFuture;
}
@@ -697,6 +698,7 @@ class _SocketStreamConsumer extends StreamConsumer<List<int>, Socket> {
}
}
} catch (e) {
+ stop();
socket._consumerDone(e);
}
}
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698