mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2026-05-22 05:46:30 +03: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)
|
tun.log.Errorln("Exiting TUN writer due to core read error:", err)
|
||||||
return
|
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" {
|
if tun.config.name == "none" || tun.config.name == "dummy" {
|
||||||
tun.log.Debugln("Not starting TUN as ifname is none or dummy")
|
tun.log.Debugln("Not starting TUN as ifname is none or dummy")
|
||||||
tun.isEnabled = false
|
tun.isEnabled = false
|
||||||
|
// Need to keep the queue goroutine running to stop underlying
|
||||||
|
// layers from getting blocked.
|
||||||
go tun.queue()
|
go tun.queue()
|
||||||
go tun.write()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
mtu := uint64(tun.config.mtu)
|
mtu := uint64(tun.config.mtu)
|
||||||
|
|||||||
Reference in New Issue
Block a user