Commit 30a0b449 authored by Luis Hector Chavez's avatar Luis Hector Chavez Committed by Commit Bot

[mojo]: Avoid a crash when NodeController pending invitations diverge

This change avoids a crash when NodeController::pending_broker_clients_
and NodeController::pending_invitations_ diverge. This might happen with
complex enough node topologies, where there is a node that proxies
invitations to a set of other nodes.

BUG=845709

Change-Id: Ia678f464fafb69628600ec00dac19da3b6868fe0
Reviewed-on: https://chromium-review.googlesource.com/1069728Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Luis Hector Chavez <lhchavez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560857}
parent d879495c
......@@ -929,9 +929,13 @@ void NodeController::OnAcceptBrokerClient(
while (!pending_broker_clients.empty()) {
const ports::NodeName& invitee_name = pending_broker_clients.front();
auto it = pending_invitations_.find(invitee_name);
DCHECK(it != pending_invitations_.end());
broker->AddBrokerClient(invitee_name,
it->second->CloneRemoteProcessHandle());
// If for any reason we don't have a pending invitation for the invitee,
// there's nothing left to do: we've already swapped the relevant state into
// the stack.
if (it != pending_invitations_.end()) {
broker->AddBrokerClient(invitee_name,
it->second->CloneRemoteProcessHandle());
}
pending_broker_clients.pop();
}
......
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