mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-12-23 22:47:56 -05:00
Fix backpressure issue when TUN is disabled
This commit is contained in:
@@ -41,7 +41,9 @@ func (tun *TunAdapter) queue() {
|
||||
tun.log.Errorln("Exiting TUN writer due to core read error:", err)
|
||||
return
|
||||
}
|
||||
tun.ch <- p[:n]
|
||||
if tun.ch != nil {
|
||||
tun.ch <- p[:n]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,8 +125,9 @@ func (tun *TunAdapter) _start() error {
|
||||
if tun.config.name == "none" || tun.config.name == "dummy" {
|
||||
tun.log.Debugln("Not starting TUN as ifname is none or dummy")
|
||||
tun.isEnabled = false
|
||||
// Need to keep the queue goroutine running to stop underlying
|
||||
// layers from getting blocked.
|
||||
go tun.queue()
|
||||
go tun.write()
|
||||
return nil
|
||||
}
|
||||
mtu := uint64(tun.config.mtu)
|
||||
|
||||
Reference in New Issue
Block a user