adb: reunregress waiting for device on start-server.
Move the invocation of adb_notify_device_scan_complete to
the end of device_connected, where we decrement connecting_devices.
Also, create a dedicated thread for handling hotplug events, instead of
reusing the main thread for this, since the main thread blocks until
device scan is complete.
Test: `adb kill-server; adb devices`
Change-Id: Ia73b1a57538174282a48ef73ab0a3e58152d6f83
diff --git a/adb.cpp b/adb.cpp
index a7706a0..bfb1144 100644
--- a/adb.cpp
+++ b/adb.cpp
@@ -1257,6 +1257,10 @@
void adb_notify_device_scan_complete() {
{
std::lock_guard<std::mutex> lock(init_mutex);
+ if (device_scan_complete) {
+ return;
+ }
+
device_scan_complete = true;
}