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
diff --git a/adb/transport.cpp b/adb/transport.cpp
index 706aee6..fa7cc8c 100644
--- a/adb/transport.cpp
+++ b/adb/transport.cpp
@@ -1040,6 +1040,11 @@
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;
}