Skip to content

Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.

Off Wi-Fi: close the dropped session off the main thread

jesse-agent-23246ce0171b31c
diff --git a/adb/src/main/kotlin/app/tellyscope/adb/DeviceLink.kt b/adb/src/main/kotlin/app/tellyscope/adb/DeviceLink.kt
index f3c1d14..a4833f7 100644
--- a/adb/src/main/kotlin/app/tellyscope/adb/DeviceLink.kt
+++ b/adb/src/main/kotlin/app/tellyscope/adb/DeviceLink.kt
@@ -92,9 +92,11 @@ class DeviceLink(
fun lanLost() {
if (_state.value != DeviceState.ONLINE) return
job?.cancel()
- current.getAndSet(null)?.close()
+ val old = current.getAndSet(null)
_state.value = _state.value.on(DeviceEvent.Lost)
job = scope.launch {
+ // Closing a TLS session sends close_notify: network I/O, so not on the caller's (main) thread.
+ old?.close()
delay(retryEvery)
loop()
}