Fix DNS update not propagated

This commit is contained in:
Mygod
2018-12-29 00:08:55 +08:00
parent dfc1f3cffa
commit cfada8d0c2

View File

@@ -78,15 +78,18 @@ class Routing(val downstream: String, ownerAddress: InterfaceAddress? = null) {
var dns: List<InetAddress> = emptyList() var dns: List<InetAddress> = emptyList()
override fun onAvailable(ifname: String, dns: List<InetAddress>) = synchronized(this@Routing) { override fun onAvailable(ifname: String, dns: List<InetAddress>) = synchronized(this@Routing) {
if (!upstreams.add(ifname)) return
val subrouting = subrouting val subrouting = subrouting
if (subrouting == null) this.subrouting = try { when {
Subrouting(this@Routing, priority, ifname) subrouting != null -> check(subrouting.upstream == ifname)
} catch (e: Exception) { !upstreams.add(ifname) -> return
SmartSnackbar.make(e).show() else -> this.subrouting = try {
Timber.w(e) Subrouting(this@Routing, priority, ifname)
null } catch (e: Exception) {
} else check(subrouting.upstream == ifname) SmartSnackbar.make(e).show()
Timber.w(e)
null
}
}
this.dns = dns this.dns = dns
updateDnsRoute() updateDnsRoute()
} }