]> hydra-www.ietfng.org Git - acmetensortoys-ctfws-android/commitdiff
Try harder to tear down old mqtt connections
authorNathaniel Wesley Filardo <nwfilardo@gmail.com>
Tue, 19 Feb 2019 01:18:40 +0000 (01:18 +0000)
committerNathaniel Wesley Filardo <nwfilardo@gmail.com>
Tue, 19 Feb 2019 01:19:14 +0000 (01:19 +0000)
mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java

index 073e4f54ab9dd4302d05fbe8ed6fa62948756633..1681eb7d6703052fac301ab1876666266d84294e 100644 (file)
@@ -219,9 +219,11 @@ public class MainService extends Service {
             // and the documentation for all of this is amazingly lacking.  Burn it all down.
             try {
                 mMqc.close();
+                mMqc.disconnect(0);
             } catch (IllegalArgumentException iae) {
-                Log.d("Service", "domqtt disconn close exn");
-                // *&@#&^*#@#&@#&@#
+                Log.d("Service", "domqtt disconn close iae", iae);
+            } catch (MqttException me) {
+                Log.d("Service", "domqtt disconn close mqtt", me);
             }
             mMqc.unregisterResources();
 
@@ -237,6 +239,7 @@ public class MainService extends Service {
         // holder's reference to the game state.
         if (mqttcb.mCtfwscbs != null) {
             mqttcb.mCtfwscbs.dispose();
+            mqttcb.mCtfwscbs = null;
         }
 
         // If we're deliberately disconnecting, tell the service about it.  Otherwise, we'll