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

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

Issue 18324006: Extract the correct os-error on Socket.write, and report correctly in IOSink. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | « runtime/bin/socket.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/io_sink.dart
diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart
index 351a30bc10301f0e3ff52bc1d71f0b02505abc92..a3310747fcc44447d4e675fbb26b10237840dbc8 100644
--- a/sdk/lib/io/io_sink.dart
+++ b/sdk/lib/io/io_sink.dart
@@ -62,6 +62,7 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
Completer _controllerCompleter;
bool _isClosed = false;
bool _isBound = false;
+ bool _hasError = false;
_StreamSinkImpl(StreamConsumer<T> this._target) {
_doneFuture = _doneCompleter.future;
@@ -80,6 +81,7 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
throw new StateError("StreamSink is already bound to a stream");
}
_isBound = true;
+ if (_hasError) return done;
// Wait for any sync operations to complete.
Future targetAddStream() {
return _target.addStream(stream)
@@ -121,6 +123,7 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
if (error == null) {
_doneCompleter.complete(value);
} else {
+ _hasError = true;
Bill Hesse 2013/07/01 11:18:05 Do you also want to set hasError in the case that
Anders Johnsen 2013/07/01 11:18:57 No, it's just a guard to avoid us setting it twice
_doneCompleter.completeError(error);
}
_doneCompleter = null;
« no previous file with comments | « runtime/bin/socket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698