Chromium Code Reviews| Index: lib/src/util/multi_channel.dart |
| diff --git a/lib/src/util/multi_channel.dart b/lib/src/util/multi_channel.dart |
| index f897de9994160afadc57822a3102aed302c3fce2..35703bae332962f3c79576917e38c6a8b34b423a 100644 |
| --- a/lib/src/util/multi_channel.dart |
| +++ b/lib/src/util/multi_channel.dart |
| @@ -93,6 +93,9 @@ class _MultiChannel extends StreamChannelMixin implements MultiChannel { |
| /// The subscription to [_innerStream]. |
| StreamSubscription _innerStreamSubscription; |
| + /// Whether this channel has been closed. |
| + var _closed = false; |
|
kevmoo
2015/04/13 21:37:27
type this as bool
nweiz
2015/04/13 22:30:13
Done.
|
| + |
| Stream get stream => _streamController.stream; |
| final _streamController = new StreamController(sync: true); |
| @@ -198,6 +201,9 @@ class _MultiChannel extends StreamChannelMixin implements MultiChannel { |
| /// Closes the virtual channel for which incoming messages have [inputId] and |
| /// outgoing messages have [outputId]. |
| void _closeChannel(int inputId, int outputId) { |
| + if (_closed) return; |
| + _closed = true; |
| + |
| // A message without data indicates that the virtual channel has been |
| // closed. |
| _streamControllers.remove(inputId).close(); |