mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Try to more gracefully handle shutdowns on Windows
This commit is contained in:
parent
b2607a7205
commit
12486b0557
4 changed files with 32 additions and 7 deletions
|
@ -98,6 +98,9 @@ func (tun *TunAdapter) writer() error {
|
|||
util.PutBytes(b)
|
||||
}
|
||||
if err != nil {
|
||||
if !tun.isOpen {
|
||||
return err
|
||||
}
|
||||
tun.log.Errorln("TUN/TAP iface write error:", err)
|
||||
continue
|
||||
}
|
||||
|
@ -114,6 +117,9 @@ func (tun *TunAdapter) reader() error {
|
|||
// Wait for a packet to be delivered to us through the TUN/TAP adapter
|
||||
n, err := tun.iface.Read(bs)
|
||||
if err != nil {
|
||||
if !tun.isOpen {
|
||||
return err
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
if n == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue