Remove unnecessary selects

This commit is contained in:
Neil Alexander 2019-01-15 08:51:19 +00:00
parent 39567bed83
commit 2cd373fc1e
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
8 changed files with 52 additions and 68 deletions

View file

@ -46,19 +46,17 @@ func (tun *tunAdapter) init(core *Core, send chan<- []byte, recv <-chan []byte)
tun.icmpv6.init(tun)
go func() {
for {
select {
case e := <-tun.reconfigure:
tun.core.configMutex.RLock()
updated := tun.core.config.IfName != tun.core.configOld.IfName ||
tun.core.config.IfTAPMode != tun.core.configOld.IfTAPMode ||
tun.core.config.IfMTU != tun.core.configOld.IfMTU
tun.core.configMutex.RUnlock()
if updated {
tun.core.log.Println("Reconfiguring TUN/TAP is not supported yet")
e <- nil
} else {
e <- nil
}
e := <-tun.reconfigure
tun.core.configMutex.RLock()
updated := tun.core.config.IfName != tun.core.configOld.IfName ||
tun.core.config.IfTAPMode != tun.core.configOld.IfTAPMode ||
tun.core.config.IfMTU != tun.core.configOld.IfMTU
tun.core.configMutex.RUnlock()
if updated {
tun.core.log.Println("Reconfiguring TUN/TAP is not supported yet")
e <- nil
} else {
e <- nil
}
}
}()