Commit d8aba7b0 authored by yzshen's avatar yzshen Committed by Commit bot

Mojo C++ bindings: handle double peer endpoint closed event for the same endpoint.

BUG=None

Review-Url: https://codereview.chromium.org/2037793003
Cr-Commit-Position: refs/heads/master@{#397811}
parent d36b726b
...@@ -526,11 +526,18 @@ bool MultiplexRouter::OnPeerAssociatedEndpointClosed(InterfaceId id) { ...@@ -526,11 +526,18 @@ bool MultiplexRouter::OnPeerAssociatedEndpointClosed(InterfaceId id) {
return false; return false;
InterfaceEndpoint* endpoint = FindOrInsertEndpoint(id, nullptr); InterfaceEndpoint* endpoint = FindOrInsertEndpoint(id, nullptr);
DCHECK(!endpoint->peer_closed());
if (endpoint->client()) // It is possible that this endpoint has been set as peer closed. That is
tasks_.push_back(Task::CreateNotifyErrorTask(endpoint)); // because when the message pipe is closed, all the endpoints are updated with
UpdateEndpointStateMayRemove(endpoint, PEER_ENDPOINT_CLOSED); // PEER_ENDPOINT_CLOSED. We continue to process remaining tasks in the queue,
// as long as there are refs keeping the router alive. If there is a
// PeerAssociatedEndpointClosedEvent control message in the queue, we will get
// here and see that the endpoint has been marked as peer closed.
if (!endpoint->peer_closed()) {
if (endpoint->client())
tasks_.push_back(Task::CreateNotifyErrorTask(endpoint));
UpdateEndpointStateMayRemove(endpoint, PEER_ENDPOINT_CLOSED);
}
// No need to trigger a ProcessTasks() because it is already on the stack. // No need to trigger a ProcessTasks() because it is already on the stack.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment