Commit 35ece933 authored by Mygod's avatar Mygod

Ensure AclMatcher is closed only after everyone is done using it

parent 269b0486
...@@ -205,7 +205,9 @@ class LocalDnsServer(private val localResolver: suspend (String) -> Array<InetAd ...@@ -205,7 +205,9 @@ class LocalDnsServer(private val localResolver: suspend (String) -> Array<InetAd
fun shutdown(scope: CoroutineScope) { fun shutdown(scope: CoroutineScope) {
cancel() cancel()
monitor.close(scope) monitor.close(scope)
coroutineContext[Job]!!.also { job -> scope.launch { job.join() } } scope.launch {
acl?.also { scope.launch { it.await().close() } } this@LocalDnsServer.coroutineContext[Job]!!.join()
acl?.also { it.await().close() }
}
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment