1From 6a4ab3d6429ec13e8c875ebc611683bb26453770 Mon Sep 17 00:00:00 2001 2From: Lepton Wu <lepton@chromium.org> 3Date: Tue, 15 Sep 2020 16:58:14 +0000 4Subject: [PATCH] Fix pending_broker_clients handling 5 6We always remove invitee from pending_invitations_ before adding it to 7pending_broker_clients, so the old code actually is buggy and invitees 8in pending_broker_clients_ will never be added as a broker client. Fix 9it by checking peers_ instead of pending_invitations_. 10 11BUG=b:146518063,b:150661600,b:168250032,chromium:1121709 12TEST=manual - Keep running arc.Boot.vm with updated mojo code. 13 14Change-Id: Ib0353944e7d5b9edc04947f8bd2db1442a4ed78d 15Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2411560 16Commit-Queue: Ken Rockot <rockot@google.com> 17Reviewed-by: Ken Rockot <rockot@google.com> 18Auto-Submit: Lepton Wu <lepton@chromium.org> 19Cr-Commit-Position: refs/heads/master@{#807076} 20--- 21 mojo/core/node_controller.cc | 7 ++----- 22 1 file changed, 2 insertions(+), 5 deletions(-) 23 24diff --git a/mojo/core/node_controller.cc b/mojo/core/node_controller.cc 25index 298079f4e234..029bd350b08b 100644 26--- a/mojo/core/node_controller.cc 27+++ b/mojo/core/node_controller.cc 28@@ -993,11 +993,8 @@ void NodeController::OnAcceptBrokerClient(const ports::NodeName& from_node, 29 // Feed the broker any pending invitees of our own. 30 while (!pending_broker_clients.empty()) { 31 const ports::NodeName& invitee_name = pending_broker_clients.front(); 32- auto it = pending_invitations_.find(invitee_name); 33- // If for any reason we don't have a pending invitation for the invitee, 34- // there's nothing left to do: we've already swapped the relevant state into 35- // the stack. 36- if (it != pending_invitations_.end()) { 37+ auto it = peers_.find(invitee_name); 38+ if (it != peers_.end()) { 39 broker->AddBrokerClient(invitee_name, 40 it->second->CloneRemoteProcessHandle()); 41 } 42-- 432.28.0.618.gf4bc123cb7-goog 44 45