From: Nathaniel Wesley Filardo Date: Tue, 19 Feb 2019 01:00:02 +0000 (+0000) Subject: MainService: minor changes to reporting and client handling X-Git-Tag: release-1.3~8 X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=926bfab589161027ca055555fadaef39e8ef9222;p=acmetensortoys-ctfws-android MainService: minor changes to reporting and client handling Don't set the state on timesync events. Null out the client handle slightly earlier. --- diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java index 6a28839..35f3437 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java @@ -137,7 +137,7 @@ public class MainService extends Service { return; } lastServerTimeDeltaEstimate = rxtime - mtime; - setMSE(MqttServerEvent.MSE_SUB); + notifyMSE(); } }); @@ -238,7 +238,7 @@ public class MainService extends Service { Log.d("Service", "domqtt disconn close mqtt", me); } mMqc.unregisterResources(); - + mMqc = null; } else { Log.d("Service", "domqtt no client"); } @@ -267,7 +267,6 @@ public class MainService extends Service { // If disconnecting is all we were told to do, we're done. if (server == null) { - mMqc = null; return; } @@ -325,10 +324,15 @@ public class MainService extends Service { void onHandbookFetch(LocalBinder b); } private final Set mObsvs = new HashSet<>(); + private void notifyMSE() { + synchronized(this) { + for (Observer o : mObsvs) { o.onMqttServerEvent(mBinder, mMSE); } + } + } private void setMSE(MqttServerEvent mse) { synchronized(this) { mMSE = mse; - for (Observer o : mObsvs) { o.onMqttServerEvent(mBinder, mse); } + notifyMSE(); } } private void notifyServerChanged(String sURL) {