mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-15 07:06:11 -04:00
Fixes a ChromeOS-deadlock during credential refill. The previous logic blocked the IO thread that ChromeOS is using to listen for responses from its CredentialStorage layer, thus preventing it from signaling the latch. Given that CheckCredentialsAndRefillIfNeeded is meant to be async (given its continuation-passing style), this CL avoids any thread trickiness by removing any latch-waiting within the function. The nice side-effect of this is breaking up the function into 3 smaller functions, which should hopefully make it a bit more readable. //.../g3/credential_storage_impl.cc has its mutex locks removed -- they otherwise cause deadlocks, and are now unnecessary. This CL introduces a CHECK_EQ to ensure that the number of remaining valid (not-expired) credentials is equal across the shared and local list. This actually exposed a bug in the credential_manager_impl_test.cc -- the test was only expiring a public credential, and not its corresponding private credential. Thus, the test is also updated in this CL to correctly mark the first credential of the shared and local list as expired. PiperOrigin-RevId: 631822135