adb: Avoid waiting for emulator connections

This change exempts the emulator connections from
WaitableConnection.WaitForConnection(). This is because emulator
connections are a) more reliable and b) handled a bit differently than
normal TCP connections.

Bug: 78991667
Test: emulator -showkernel ; adb shell
Change-Id: I552946198889a82d6c265f45e8c3b38f6ac9d045
This commit is contained in:
Luis Hector Chavez 2018-05-01 17:12:16 -07:00
parent 49b7f296b9
commit c587f02cc6
1 changed files with 5 additions and 0 deletions

View File

@ -1040,6 +1040,11 @@ int register_socket_transport(int s, const char* serial, int port, int local) {
auto waitable = t->connection_waitable();
register_transport(t);
if (local == 1) {
// Do not wait for emulator transports.
return 0;
}
return waitable->WaitForConnection(std::chrono::seconds(10)) ? 0 : -1;
}