Fix monitor flush
This commit is contained in:
@@ -16,8 +16,7 @@ class IpLinkMonitor private constructor() : IpMonitor() {
|
|||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = IpLinkMonitor()
|
monitor = IpLinkMonitor()
|
||||||
instance = monitor
|
instance = monitor
|
||||||
}
|
} else monitor.flushAsync()
|
||||||
monitor.flushAsync()
|
|
||||||
}
|
}
|
||||||
fun unregisterCallback(owner: Any) = synchronized(this) {
|
fun unregisterCallback(owner: Any) = synchronized(this) {
|
||||||
if (callbacks.remove(owner) == null || callbacks.isNotEmpty()) return@synchronized
|
if (callbacks.remove(owner) == null || callbacks.isNotEmpty()) return@synchronized
|
||||||
|
|||||||
@@ -28,9 +28,11 @@ class IpNeighbourMonitor private constructor() : IpMonitor() {
|
|||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = IpNeighbourMonitor()
|
monitor = IpNeighbourMonitor()
|
||||||
instance = monitor
|
instance = monitor
|
||||||
monitor.flushAsync()
|
|
||||||
null
|
null
|
||||||
} else monitor.neighbours.values
|
} else {
|
||||||
|
monitor.flushAsync()
|
||||||
|
monitor.neighbours.values
|
||||||
|
}
|
||||||
}?.let { callback.onIpNeighbourAvailable(it) }
|
}?.let { callback.onIpNeighbourAvailable(it) }
|
||||||
fun unregisterCallback(callback: Callback) = synchronized(callbacks) {
|
fun unregisterCallback(callback: Callback) = synchronized(callbacks) {
|
||||||
if (callbacks.remove(callback) == null) return@synchronized
|
if (callbacks.remove(callback) == null) return@synchronized
|
||||||
|
|||||||
Reference in New Issue
Block a user