Index: third_party/mojo/src/mojo/public/dart/src/stub.dart |
diff --git a/third_party/mojo/src/mojo/public/dart/src/stub.dart b/third_party/mojo/src/mojo/public/dart/src/stub.dart |
index 823873627ec267adaa25db536f4e036bca2990dd..1ce098239cec317e1093c564d98eb7a319e1f890 100644 |
--- a/third_party/mojo/src/mojo/public/dart/src/stub.dart |
+++ b/third_party/mojo/src/mojo/public/dart/src/stub.dart |
@@ -40,9 +40,10 @@ abstract class Stub extends core.MojoEventStreamListener { |
responseFuture.then((response) { |
_outstandingResponseFutures--; |
if (isOpen) { |
- endpoint.write(response.buffer, |
- response.buffer.lengthInBytes, |
- response.handles); |
+ endpoint.write( |
+ response.buffer, |
+ response.buffer.lengthInBytes, |
+ response.handles); |
if (!endpoint.status.isOk) { |
throw 'message pipe write failed: ${endpoint.status}'; |
} |
@@ -69,9 +70,10 @@ abstract class Stub extends core.MojoEventStreamListener { |
// NB: |nodefer| should only be true when calling close() while handling an |
// exception thrown from handleRead(), e.g. when we receive a malformed |
// message. |
- void close({bool nodefer : false}) { |
- if (!isOpen) return; |
- if (!nodefer && (isInHandler || (_outstandingResponseFutures > 0))) { |
+ void close({bool nodefer: false}) { |
+ if (isOpen && |
+ !nodefer && |
+ (isInHandler || (_outstandingResponseFutures > 0))) { |
// Either close() is being called from within handleRead() or |
// handleWrite(), or close() is being called while there are outstanding |
// response futures. Defer the actual close until all response futures |