From 2a13229a403deebd75ca6366e9c62fe9c94f83ec Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 9 Aug 2022 21:15:20 -0700 Subject: [PATCH] revert MQTT disconnect changes They seem to be causing problems and need to be part of a later release with more testing. --- .../org/eehouse/android/xw4/MQTTUtils.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java index 9a38fcdf5..46f18da7d 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java @@ -297,7 +297,6 @@ public class MQTTUtils extends Thread if ( !stateOk ) { Log.e( TAG, "%H.setState(): bad state for %s: %s", this, newState, mState ); - Assert.failDbg(); } } @@ -435,7 +434,6 @@ public class MQTTUtils extends Thread mShouldExit = true; - State prevState = mState; setState( State.CLOSING ); MqttAsyncClient client; @@ -451,7 +449,7 @@ public class MQTTUtils extends Thread if ( null == client ) { Log.e( TAG, "disconnect(): null client" ); } else { - startDisconThread( client, prevState ); + startDisconThread( client ); } // Make sure we don't need to call clearInstance(this) @@ -461,7 +459,7 @@ public class MQTTUtils extends Thread Log.d( TAG, "%H.disconnect() DONE", this ); } - private void startDisconThread( final MqttAsyncClient client, State maxState ) + private void startDisconThread( final MqttAsyncClient client ) { new Thread( new Runnable() { @Override @@ -473,16 +471,12 @@ public class MQTTUtils extends Thread try { switch ( ii ) { case 0: - if ( State.SUBSCRIBED == maxState ) { - action = "unsubscribe"; - token = client.unsubscribe( mDevID ); - } + action = "unsubscribe"; + token = client.unsubscribe( mDevID ); break; // not continue, which skips the Log() below case 1: - if ( client.isConnected() ) { - action = "disconnect"; - token = client.disconnect(); - } + action = "disconnect"; + token = client.disconnect(); break; case 2: action = "close";