Index: mojo/public/cpp/bindings/lib/connector.cc |
diff --git a/mojo/public/cpp/bindings/lib/connector.cc b/mojo/public/cpp/bindings/lib/connector.cc |
index c5e9b7fe12e5a8bc06db0cc2fc620fb677e53056..e6f2d83ab646d2795d6bb0199b1d7485a9254b38 100644 |
--- a/mojo/public/cpp/bindings/lib/connector.cc |
+++ b/mojo/public/cpp/bindings/lib/connector.cc |
@@ -264,7 +264,13 @@ void Connector::ReadAllAvailableMessages() { |
return; |
if (rv == MOJO_RESULT_SHOULD_WAIT) { |
- WaitToReadMore(); |
+ // ReadSingleMessage could end up calling HandleError which resets |
+ // message_pipe_ to a dummy one that is closed. The old EDK will see the |
+ // that the peer is closed immediately, while the new one is asynchronous |
+ // because of thread hops. In that case, there'll still be an async |
+ // waiter. |
+ if (!async_wait_id_) |
+ WaitToReadMore(); |
break; |
} |
} |