From 96a28afb8fb6e4e22fb1b3bff1b4d0229dde0d67 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 10 Jun 2020 12:03:31 -0700 Subject: [PATCH] fix autobug: old notifies might come in from devices we are reconnecting to --- .../main/java/com/geeksville/mesh/service/SafeBluetooth.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 3b35cd643..049d3789c 100644 --- a/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt +++ b/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt @@ -598,7 +598,6 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD len: Int, cb: (Result) -> Unit ) { - logAssert(workQueue.isEmpty() && currentWork == null) // I don't think anything should be able to sneak in front queueRequestMtu(len, CallbackContinuation(cb)) } @@ -662,6 +661,9 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD lostConnectCallback = null connectionCallback = null + // Cancel any notifications - because when the device comes back it might have forgotten about us + notifyHandlers.clear() + ignoreException { // Hmm - sometimes the "Connection closing" exception comes back to us - ignore it failAllWork(BLEException("Connection closing"))