Fix a race condition
This commit is contained in:
@@ -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 }
|
||||||
|
|||||||
@@ -155,4 +155,8 @@ class TetheringService : IpNeighbourMonitoringService(), TetheringManager.Tether
|
|||||||
callbackRegistered = false
|
callbackRegistered = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun updateNotification() {
|
||||||
|
launch { super.updateNotification() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user