better debug output for the next time an autobug occurs

pull/72/head
geeksville 2020-06-30 12:18:49 -07:00
rodzic 0349e823f8
commit fed418dae2
2 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -425,7 +425,7 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
override fun close() { override fun close() {
if (safe != null) { if (safe != null) {
info("Closing radio interface service") info("Closing BluetoothInterface")
val s = safe val s = safe
safe = safe =
null // We do this first, because if we throw we still want to mark that we no longer have a valid connection null // We do this first, because if we throw we still want to mark that we no longer have a valid connection

Wyświetl plik

@ -11,7 +11,6 @@ import com.geeksville.concurrent.CallbackContinuation
import com.geeksville.concurrent.Continuation import com.geeksville.concurrent.Continuation
import com.geeksville.concurrent.SyncContinuation import com.geeksville.concurrent.SyncContinuation
import com.geeksville.util.exceptionReporter import com.geeksville.util.exceptionReporter
import com.geeksville.util.ignoreException
import kotlinx.coroutines.* import kotlinx.coroutines.*
import java.io.Closeable import java.io.Closeable
import java.util.* import java.util.*
@ -387,6 +386,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
*/ */
private fun failAllWork(ex: Exception) { private fun failAllWork(ex: Exception) {
synchronized(workQueue) { synchronized(workQueue) {
warn("Failing ${workQueue.size} works, because ${ex.message}")
workQueue.forEach { workQueue.forEach {
it.completion.resumeWithException(ex) it.completion.resumeWithException(ex)
} }
@ -704,10 +704,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
closeGatt() closeGatt()
ignoreException { failAllWork(BLEException("Connection closing"))
// Hmm - sometimes the "Connection closing" exception comes back to us - ignore it
failAllWork(BLEException("Connection closing"))
}
} }
/** /**