Allow null interfaceName in onLinkPropertiesChanged
This commit is contained in:
@@ -41,7 +41,11 @@ object DefaultNetworkMonitor : UpstreamMonitor() {
|
|||||||
if (currentNetwork != network) return
|
if (currentNetwork != network) return
|
||||||
val oldProperties = currentLinkProperties!!
|
val oldProperties = currentLinkProperties!!
|
||||||
currentLinkProperties = properties
|
currentLinkProperties = properties
|
||||||
val ifname = properties.interfaceName!!
|
val ifname = properties.interfaceName
|
||||||
|
if (ifname == null) {
|
||||||
|
onLost(network)
|
||||||
|
return
|
||||||
|
}
|
||||||
check(ifname == oldProperties.interfaceName)
|
check(ifname == oldProperties.interfaceName)
|
||||||
if (properties.dnsServers != oldProperties.dnsServers)
|
if (properties.dnsServers != oldProperties.dnsServers)
|
||||||
callbacks.forEach { it.onAvailable(ifname, properties.dnsServers) }
|
callbacks.forEach { it.onAvailable(ifname, properties.dnsServers) }
|
||||||
|
|||||||
@@ -44,7 +44,11 @@ object VpnMonitor : UpstreamMonitor() {
|
|||||||
synchronized(this@VpnMonitor) {
|
synchronized(this@VpnMonitor) {
|
||||||
if (currentNetwork != network) return
|
if (currentNetwork != network) return
|
||||||
val oldProperties = available.put(network, properties)!!
|
val oldProperties = available.put(network, properties)!!
|
||||||
val ifname = properties.interfaceName!!
|
val ifname = properties.interfaceName
|
||||||
|
if (ifname == null) {
|
||||||
|
onLost(network)
|
||||||
|
return
|
||||||
|
}
|
||||||
check(ifname == oldProperties.interfaceName)
|
check(ifname == oldProperties.interfaceName)
|
||||||
if (properties.dnsServers != oldProperties.dnsServers)
|
if (properties.dnsServers != oldProperties.dnsServers)
|
||||||
callbacks.forEach { it.onAvailable(ifname, properties.dnsServers) }
|
callbacks.forEach { it.onAvailable(ifname, properties.dnsServers) }
|
||||||
|
|||||||
Reference in New Issue
Block a user