0.7.88 oops - if no work is pending, we also try to reconnect

This commit is contained in:
geeksville 2020-07-02 14:08:12 -07:00
parent dde5348b3a
commit 5f34fcba17
2 changed files with 5 additions and 3 deletions

View file

@ -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 {

View file

@ -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")