Chromium Code Reviews| 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); |
| } |
| } |