Allow unregister to fail
Race condition might occur when cleaning.
This commit is contained in:
@@ -37,7 +37,8 @@ object TrafficRecorder {
|
|||||||
}
|
}
|
||||||
fun unregister(ip: InetAddress, upstream: String?, downstream: String) = synchronized(this) {
|
fun unregister(ip: InetAddress, upstream: String?, downstream: String) = synchronized(this) {
|
||||||
update() // flush stats before removing
|
update() // flush stats before removing
|
||||||
check(records.remove(Triple(ip, upstream, downstream)) != null)
|
if (records.remove(Triple(ip, upstream, downstream)) == null) Timber.w(
|
||||||
|
"Failed to find traffic record for ($ip, $downstream, $upstream).")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun unscheduleUpdateLocked() {
|
private fun unscheduleUpdateLocked() {
|
||||||
|
|||||||
Reference in New Issue
Block a user