From bd34491ad42869b0224163275abfc1efafe1eb44 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 11 Feb 2018 00:25:41 -0800 Subject: [PATCH] Ignore lost devices in notification --- mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt index 3a943e80..bfa26c22 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt @@ -100,7 +100,9 @@ class TetheringService : Service(), VpnMonitor.Callback, IpNeighbourMonitor.Call this.neighbours = neighbours.values.toList() } override fun postIpNeighbourAvailable() { - val sizeLookup = neighbours.groupBy { it.dev }.mapValues { (_, neighbours) -> neighbours.size } + val sizeLookup = neighbours.groupBy { it.dev }.mapValues { (_, neighbours) -> + neighbours.count { it.state != IpNeighbour.State.FAILED } + } ServiceNotification.startForeground(this, routings.keys.associate { Pair(it, sizeLookup[it] ?: 0) }) }