Handle if ifname became non-null

This commit is contained in:
Mygod
2018-10-25 10:57:15 +08:00
parent 3c81fcd95a
commit 04acc9d75e
2 changed files with 8 additions and 0 deletions

View File

@@ -38,6 +38,10 @@ object DefaultNetworkMonitor : UpstreamMonitor() {
}
override fun onLinkPropertiesChanged(network: Network, properties: LinkProperties) {
if (currentNetwork == null) {
onAvailable(network)
return
}
if (currentNetwork != network) return
val oldProperties = currentLinkProperties!!
currentLinkProperties = properties

View File

@@ -43,6 +43,10 @@ object VpnMonitor : UpstreamMonitor() {
override fun onLinkPropertiesChanged(network: Network, properties: LinkProperties) {
synchronized(this@VpnMonitor) {
if (currentNetwork == null) {
onAvailable(network)
return
}
if (currentNetwork != network) return
val oldProperties = available.put(network, properties)!!
val ifname = properties.interfaceName