skip probe for device with one IP

This commit is contained in:
Miuzarte
2026-05-31 21:29:19 +08:00
parent e13fe8db45
commit 63787857e9

View File

@@ -43,6 +43,16 @@ internal class DeviceAdbConnectionCoordinator(
): ConnectionTarget {
var lastError: Throwable? = null
return withContext(Dispatchers.IO) {
if (addresses.size == 1) {
val target = ConnectionTarget.unmarshalFrom(addresses[0])
?: throw IllegalStateException("Invalid address: ${addresses[0]}")
val resolved = resolveHost(target.host)
withTimeout(timeoutMs) {
adbService.connect(resolved, target.port)
}
return@withContext target
}
val candidates = addresses.mapNotNull { addr ->
val target = ConnectionTarget.unmarshalFrom(addr) ?: return@mapNotNull null
val resolved = resolveHost(target.host)