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

Unified Diff: mojo/public/cpp/bindings/lib/interface_endpoint_client.cc

Issue 2721333004: Mojo C++ bindings: handle the case where a message is recevied for an interface after it has encoun… (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
index 2eab43036a83a24b9bb24d99d4ee6ecbb41039b5..3ee5aaebf98ed8a63888b0402126a7d4b6aab332 100644
--- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
+++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/location.h"
+#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
@@ -360,7 +361,16 @@ void InterfaceEndpointClient::OnAssociationEvent(
bool InterfaceEndpointClient::HandleValidatedMessage(Message* message) {
DCHECK_EQ(handle_.id(), message->interface_id());
- DCHECK(!encountered_error_);
+
+ if (encountered_error_) {
+ // This message is received after error has been encountered. For associated
+ // interfaces, this means the remote side sends a
+ // PeerAssociatedEndpointClosed event but continues to send more messages
+ // for the same interface. Close the pipe because this shouldn't happen.
+ DVLOG(1) << "A message is received for an interface after it has been "
+ << "disconnected. Closing the pipe.";
+ return false;
+ }
if (message->has_flag(Message::kFlagExpectsResponse)) {
MessageReceiverWithStatus* responder =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698