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

Unified Diff: lib/src/two_way_stream.dart

Issue 1328503003: Add Server.isClosed and Client.isClosed. (Closed) Base URL: git@github.com:dart-lang/json_rpc_2.git@master
Patch Set: Created 5 years, 3 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 | « lib/src/server.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/two_way_stream.dart
diff --git a/lib/src/two_way_stream.dart b/lib/src/two_way_stream.dart
index 5914173876f6d21799bfdcc1c34cd45471c71852..5644c126621a060bb7c6b79f265a4ab9e4468ceb 100644
--- a/lib/src/two_way_stream.dart
+++ b/lib/src/two_way_stream.dart
@@ -38,6 +38,10 @@ class TwoWayStream {
Future get done => _doneCompleter.future;
final _doneCompleter = new Completer();
+ /// Whether the stream has been closed.
+ bool get isClosed => _isClosed;
Bob Nystrom 2015/09/03 18:13:03 Can this just be => _doneCompleter.isCompleted?
nweiz 2015/09/08 21:17:32 Done.
+ bool _isClosed = false;
+
/// Creates a two-way stream.
///
/// [input] and [output] should emit and take (respectively) JSON-encoded
@@ -123,6 +127,7 @@ class TwoWayStream {
throw new StateError("Can't call $_name.close before $_name.listen.");
}
+ _isClosed = true;
if (!_doneCompleter.isCompleted) _doneCompleter.complete();
var inputFuture = _inputSubscription.cancel();
« no previous file with comments | « lib/src/server.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698