Misc fixes

This commit is contained in:
Mygod
2020-07-18 03:20:22 +08:00
parent c344dbfa4a
commit 0f16210c80
6 changed files with 9 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ import be.mygod.vpnhotspot.net.Routing.Companion.IP
import be.mygod.vpnhotspot.root.RoutingCommands
import be.mygod.vpnhotspot.util.RootSession
import be.mygod.vpnhotspot.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import timber.log.Timber
@@ -40,6 +41,7 @@ object DhcpWorkaround : SharedPreferences.OnSharedPreferenceChangeListener {
SmartSnackbar.make(e).show()
}
}
} catch (_: CancellationException) {
} catch (e: Exception) {
Timber.w(e)
SmartSnackbar.make(e).show()

View File

@@ -17,6 +17,7 @@ import be.mygod.vpnhotspot.util.RootSession
import be.mygod.vpnhotspot.util.if_nametoindex
import be.mygod.vpnhotspot.util.parseNumericAddress
import be.mygod.vpnhotspot.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import timber.log.Timber
import java.io.BufferedWriter
import java.io.IOException
@@ -340,7 +341,9 @@ class Routing(private val caller: Any, private val downstream: String) : IpNeigh
currentDns?.transaction?.revert()
currentDns = if (ifindex == 0 || dns == null) null else try {
DnsRoute(ifindex, dns)
} catch (e: RuntimeException) {
} catch (_: CancellationException) {
null
} catch (e: Exception) {
Timber.w(e)
SmartSnackbar.make(e).show()
null