mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix an autobug: We gracefully handle safe being null because this can occur if someone has unpaired from our device - just abandon the reconnect attempt
This commit is contained in:
parent
54c832f591
commit
38eabf9d70
1 changed files with 13 additions and 7 deletions
|
|
@ -413,14 +413,20 @@ class RadioInterfaceService : Service(), Logging {
|
|||
DataPair(1)
|
||||
)
|
||||
|
||||
warn("Forcing disconnect and hopefully device will comeback (disabling forced refresh)")
|
||||
hasForcedRefresh = true
|
||||
ignoreException {
|
||||
safe!!.closeConnection()
|
||||
/// We gracefully handle safe being null because this can occur if someone has unpaired from our device - just abandon the reconnect attempt
|
||||
val s = safe
|
||||
if (s != null) {
|
||||
warn("Forcing disconnect and hopefully device will comeback (disabling forced refresh)")
|
||||
hasForcedRefresh = true
|
||||
ignoreException {
|
||||
s.closeConnection()
|
||||
}
|
||||
delay(1000) // Give some nasty time for buggy BLE stacks to shutdown (500ms was not enough)
|
||||
warn("Attempting reconnect")
|
||||
startConnect()
|
||||
} else {
|
||||
warn("Abandoning reconnect because safe==null, someone must have closed the device")
|
||||
}
|
||||
delay(1000) // Give some nasty time for buggy BLE stacks to shutdown (500ms was not enough)
|
||||
warn("Attempting reconnect")
|
||||
startConnect()
|
||||
}
|
||||
|
||||
/// We only try to set MTU once, because some buggy implementations fail
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue