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

Unified Diff: runtime/bin/socket_patch.dart

Issue 14753009: Make StreamSubscription be the active part of a stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made tests run (mostly) Created 7 years, 7 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
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 3de4c29597c8148429f16abbd40ccc6adb65e37c..dca4452c67773ff8a700285b54aa4628d03c475e 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -809,6 +809,7 @@ class _SocketStreamConsumer extends StreamConsumer<List<int>> {
socket._ensureRawSocketSubscription();
streamCompleter = new Completer<Socket>();
if (socket._raw != null) {
+ assert(!!!paused);
Anders Johnsen 2013/05/22 13:07:08 !!!?
Lasse Reichstein Nielsen 2013/05/24 06:02:49 !!!!! Deliberately made stupid to mark it as debug
subscription = stream.listen(
(data) {
assert(!paused);
@@ -842,12 +843,12 @@ class _SocketStreamConsumer extends StreamConsumer<List<int>> {
offset += socket._write(buffer, offset, buffer.length - offset);
if (offset < buffer.length) {
if (!paused) {
- paused = true;
// TODO(ajohnsen): It would be nice to avoid this check.
// Some info: socket._write can emit an event, if it fails to write.
// If the user closes the socket in that event, stop() will be called
// before we get a change to pause.
if (subscription == null) return;
Anders Johnsen 2013/05/22 13:07:08 This line (and the comment) can be removed now, du
Lasse Reichstein Nielsen 2013/05/24 06:02:49 YEY
+ paused = true;
Anders Johnsen 2013/05/22 13:07:08 Can you try without these pause?
Lasse Reichstein Nielsen 2013/05/24 06:02:49 I'll try.
subscription.pause();
}
socket._enableWriteEvent();
@@ -880,6 +881,7 @@ class _SocketStreamConsumer extends StreamConsumer<List<int>> {
if (subscription == null) return;
subscription.cancel();
subscription = null;
+ paused = false;
socket._disableWriteEvent();
}
}

Powered by Google App Engine
This is Rietveld 408576698