From c587f02cc689c9cf55c51c266175a63165047fd7 Mon Sep 17 00:00:00 2001 From: Luis Hector Chavez Date: Tue, 1 May 2018 17:12:16 -0700 Subject: [PATCH] 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 --- adb/transport.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/adb/transport.cpp b/adb/transport.cpp index 706aee604..fa7cc8c69 100644 --- a/adb/transport.cpp +++ b/adb/transport.cpp @@ -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; }