Explicit disconnect during recovery.

BT connection might still be there, but no menu updates coming in.
Thus, explicitely close the connection before attempting to
reconnect.
This commit is contained in:
Johannes Mockenhaupt 2017-12-17 10:27:07 +01:00
parent a85da1d9ec
commit 5f4a90d068
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -282,8 +282,14 @@ public class RuffyScripter implements RuffyCommands {
// on connection loss try to reconnect, confirm warning alerts caused by
// the disconnected and then return the command as failed (the caller
// can retry if needed).
log.debug("Connection unusable, aborting command and attempting reconnect ...");
cmdThread.interrupt();
activeCmd.getResult().success = false;
// the BT connection might be still there, but we might not be receiving
// menu updates, so force a disconnect before connecting again
disconnect();
SystemClock.sleep(500);
for (int attempts = 2; attempts > 0; attempts--) {
boolean reconnected = recoverFromConnectionLoss();
if (reconnected) {