From b52d0e8240fec9dfbaedd8170f03002fd2c2740b Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 22 Aug 2021 00:38:11 -0400 Subject: [PATCH] Fix bugs in TrafficRecorder Addresses #220. --- .../java/be/mygod/vpnhotspot/net/monitor/TrafficRecorder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/TrafficRecorder.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/TrafficRecorder.kt index 52e3dbf8..422fce23 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/TrafficRecorder.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/TrafficRecorder.kt @@ -130,6 +130,7 @@ object TrafficRecorder { } fun update(timeout: Boolean = false) { synchronized(this) { + unscheduleUpdateLocked() if (records.isEmpty()) return val timestamp = System.currentTimeMillis() if (!timeout && timestamp - lastUpdate <= 100) return @@ -141,7 +142,6 @@ object TrafficRecorder { SmartSnackbar.make(e).show() } lastUpdate = timestamp - updateJob = null scheduleUpdateLocked() } }