Revert "android: pass interface name to go" (#339)

Revert "android: pass interface name to go (#336)"

This reverts commit bbb3c86fa8.
pull/341/head
kari-ts 2 weeks ago committed by GitHub
parent bbb3c86fa8
commit 75e2d8983b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -166,14 +166,14 @@ class App : Application(), libtailscale.AppContext {
}
if (dns.updateDNSFromNetwork(sb.toString())) {
Libtailscale.onDnsConfigChanged(linkProperties?.getInterfaceName())
Libtailscale.onDnsConfigChanged()
}
}
override fun onLost(network: Network) {
super.onLost(network)
if (dns.updateDNSFromNetwork("")) {
Libtailscale.onDnsConfigChanged("")
Libtailscale.onDnsConfigChanged()
}
}
})

@ -222,9 +222,9 @@ func (a *App) runBackend(ctx context.Context) error {
netns.SetAndroidProtectFunc(nil)
service = nil
}
case i := <-onDNSConfigChanged:
case <-onDNSConfigChanged:
if b != nil {
go b.NetworkChanged(i)
go b.NetworkChanged()
}
}
}

@ -23,14 +23,13 @@ var (
// onGoogleToken receives google ID tokens.
onGoogleToken = make(chan string)
// onDNSConfigChanged is notified when the network changes and the DNS config needs to be updated. It receives the updated interface name.
onDNSConfigChanged = make(chan string, 1)
// onDNSConfigChanged is notified when the network changes and the DNS config needs to be updated.
onDNSConfigChanged = make(chan struct{}, 1)
)
// ifname is the interface name retrieved from LinkProperties on network change, if any.
func OnDnsConfigChanged(ifname string) {
func OnDnsConfigChanged() {
select {
case onDNSConfigChanged <- ifname:
case onDNSConfigChanged <- struct{}{}:
default:
}
}

@ -227,8 +227,7 @@ func (b *backend) CloseTUNs() {
b.devices.Shutdown()
}
// ifname is the interface name retrieved from LinkProperties on network change. If a network is lost, an empty string is passed in.
func (b *backend) NetworkChanged(ifname string) {
func (b *backend) NetworkChanged() {
defer func() {
if p := recover(); p != nil {
log.Printf("panic in NetworkChanged %s: %s", p, debug.Stack())
@ -240,7 +239,6 @@ func (b *backend) NetworkChanged(ifname string) {
if nm, ok := b.sys.NetMon.GetOK(); ok {
nm.InjectEvent()
}
interfaces.UpdateLastKnownDefaultRouteInterface(ifname)
}
}

Loading…
Cancel
Save