revert MQTT disconnect changes

They seem to be causing problems and need to be part of a later
release with more testing.
This commit is contained in:
Eric House 2022-08-09 21:15:20 -07:00
parent 0497a456e7
commit 2a13229a40

View file

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