Prevent crash while releasing RootManager
This commit is contained in:
@@ -140,7 +140,13 @@ abstract class IpMonitor {
|
|||||||
/**
|
/**
|
||||||
* Possibly blocking. Should run in IO dispatcher or use [flushAsync].
|
* Possibly blocking. Should run in IO dispatcher or use [flushAsync].
|
||||||
*/
|
*/
|
||||||
suspend fun flush() = work(null)?.let { RootManager.release(it) }
|
suspend fun flush() = work(null)?.let {
|
||||||
|
try {
|
||||||
|
RootManager.release(it)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Timber.w(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
fun flushAsync() = GlobalScope.launch(Dispatchers.IO) { flush() }
|
fun flushAsync() = GlobalScope.launch(Dispatchers.IO) { flush() }
|
||||||
|
|
||||||
private suspend fun work(server: RootServer?): RootServer? {
|
private suspend fun work(server: RootServer?): RootServer? {
|
||||||
|
|||||||
Reference in New Issue
Block a user