Ensure record is unregistered if registering fails
This commit is contained in:
@@ -35,7 +35,12 @@ class Subrouting(private val parent: Routing, priority: Int, val upstream: Strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
TrafficRecorder.register(ip, upstream, parent.downstream, mac)
|
try {
|
||||||
|
TrafficRecorder.register(ip, upstream, parent.downstream, mac)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
close()
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
|
|||||||
Reference in New Issue
Block a user