From fed418dae2a8dc2559864c3fdea8f5b45c4c01cd Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 30 Jun 2020 12:18:49 -0700 Subject: [PATCH] better debug output for the next time an autobug occurs --- .../java/com/geeksville/mesh/service/BluetoothInterface.kt | 2 +- .../main/java/com/geeksville/mesh/service/SafeBluetooth.kt | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/service/BluetoothInterface.kt b/app/src/main/java/com/geeksville/mesh/service/BluetoothInterface.kt index 8adbf0675..92ba0eb7e 100644 --- a/app/src/main/java/com/geeksville/mesh/service/BluetoothInterface.kt +++ b/app/src/main/java/com/geeksville/mesh/service/BluetoothInterface.kt @@ -425,7 +425,7 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String override fun close() { if (safe != null) { - info("Closing radio interface service") + info("Closing BluetoothInterface") val s = safe safe = null // We do this first, because if we throw we still want to mark that we no longer have a valid connection diff --git a/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt b/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt index aae882bb3..500207a8d 100644 --- a/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt +++ b/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt @@ -11,7 +11,6 @@ import com.geeksville.concurrent.CallbackContinuation import com.geeksville.concurrent.Continuation import com.geeksville.concurrent.SyncContinuation import com.geeksville.util.exceptionReporter -import com.geeksville.util.ignoreException import kotlinx.coroutines.* import java.io.Closeable import java.util.* @@ -387,6 +386,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD */ private fun failAllWork(ex: Exception) { synchronized(workQueue) { + warn("Failing ${workQueue.size} works, because ${ex.message}") workQueue.forEach { it.completion.resumeWithException(ex) } @@ -704,10 +704,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD closeGatt() - ignoreException { - // Hmm - sometimes the "Connection closing" exception comes back to us - ignore it - failAllWork(BLEException("Connection closing")) - } + failAllWork(BLEException("Connection closing")) } /**