Index: third_party/mojo/src/mojo/public/dart/src/proxy.dart |
diff --git a/third_party/mojo/src/mojo/public/dart/src/proxy.dart b/third_party/mojo/src/mojo/public/dart/src/proxy.dart |
index 5317e5648b558843fb533c2e90c1b1f66083dccf..a84ca3ec0c23726726e432aa7f8e111552c27f25 100644 |
--- a/third_party/mojo/src/mojo/public/dart/src/proxy.dart |
+++ b/third_party/mojo/src/mojo/public/dart/src/proxy.dart |
@@ -4,6 +4,12 @@ |
part of bindings; |
+class ProxyCloseException { |
+ final String message; |
+ ProxyCloseException(this.message); |
+ String toString() => message; |
+} |
+ |
abstract class Proxy extends core.MojoEventStreamListener { |
Map<int, Completer> _completerMap; |
int _nextId = 0; |
@@ -40,6 +46,15 @@ abstract class Proxy extends core.MojoEventStreamListener { |
throw 'Unexpected write signal in proxy.'; |
} |
+ @override |
+ Future close({bool nodefer: false}) { |
+ for (var completer in _completerMap.values) { |
+ completer.completeError(new ProxyCloseException('Proxy closed')); |
+ } |
+ _completerMap.clear(); |
+ return super.close(nodefer: nodefer); |
+ } |
+ |
void sendMessage(Struct message, int name) { |
if (!isOpen) { |
listen(); |