Fix a race condition

This commit is contained in:
Mygod
2022-05-15 17:08:01 -04:00
parent 21de3f57d5
commit d7ff8770a7
2 changed files with 5 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ abstract class IpNeighbourMonitoringService : Service(), IpNeighbourMonitor.Call
this.neighbours = neighbours this.neighbours = neighbours
updateNotification() updateNotification()
} }
protected fun updateNotification() { protected open fun updateNotification() {
val sizeLookup = neighbours.groupBy { it.dev }.mapValues { (_, neighbours) -> val sizeLookup = neighbours.groupBy { it.dev }.mapValues { (_, neighbours) ->
neighbours neighbours
.filter { it.ip is Inet4Address && it.state == IpNeighbour.State.VALID } .filter { it.ip is Inet4Address && it.state == IpNeighbour.State.VALID }

View File

@@ -155,4 +155,8 @@ class TetheringService : IpNeighbourMonitoringService(), TetheringManager.Tether
callbackRegistered = false callbackRegistered = false
} }
} }
override fun updateNotification() {
launch { super.updateNotification() }
}
} }