From 5f34fcba1772e504354e8c7e6680dcae0d44473a Mon Sep 17 00:00:00 2001 From: geeksville Date: Thu, 2 Jul 2020 14:08:12 -0700 Subject: [PATCH] 0.7.88 oops - if no work is pending, we also try to reconnect --- app/build.gradle | 4 ++-- .../main/java/com/geeksville/mesh/service/SafeBluetooth.kt | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c6dbff30e..a200cd9c0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,8 +17,8 @@ android { applicationId "com.geeksville.mesh" minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works) targetSdkVersion 29 - versionCode 10787 // format is Mmmss (where M is 1+the numeric major number - versionName "0.7.87" + versionCode 10788 // format is Mmmss (where M is 1+the numeric major number + versionName "0.7.88" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { 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 e894c9d7e..ee817b0e2 100644 --- a/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt +++ b/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt @@ -162,7 +162,9 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD info("Lost connection - aborting current work: $currentWork") // If we get a disconnect, just try again otherwise fail all current operations - if (currentWork?.isConnect() == true) + // Note: if no work is pending (likely) we also just totally teardown and restart the connection, because we won't be + // throwing a lost connection exception to any worker. + if (currentWork == null || currentWork?.isConnect() == true) dropAndReconnect() else lostConnection("lost connection")