Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 4ad4a11a authored by Daniel Colascione's avatar Daniel Colascione
Browse files

Delay initial accept() until server initialized

When the adb client starts the adb server, it waits until the server
reports that it's fully-initialized (via reply-fd) before executing
its adb client operation. This wait prevent that adb client from
talking to the server while it's initializing and becoming confused.
But if a *different* adb client connects to the server while it's
initializing, *that* client can temporarily observe unexpected state
while the server initializes itself. For example, such a client can
observe a device that's alive and connected as being offline while the
server connects to it.

The new socket activation support makes this race more apparent, since
in the socket activation configuration, there's no initial adb client
waiting for the server's all-clear indication and so even the first
client observes the partially-initialized server state.

This CL prevents the server accepting *any* client connection until
the server has fully initialized itself, preventing all clients, not
just the initial client, from observing a
partially-initialized server.

Test: test_adb.py; test_adb gtest binary
Test: [with socket activation] adb kill-server; adb devices
Change-Id: I5d399ee62436eee63340b6b8b0f64131ad17ac65
parent 4456b5fc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment