tun: windows: Make writing persistent too

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-03-22 12:44:14 +01:00
parent 9748a52073
commit a80db5e65e

View file

@ -284,6 +284,7 @@ func (tun *NativeTun) Flush() error {
return nil return nil
} }
for {
// Get TUN data pipe. // Get TUN data pipe.
_, file, err := tun.getTUN() _, file, err := tun.getTUN()
if err != nil { if err != nil {
@ -297,11 +298,12 @@ func (tun *NativeTun) Flush() error {
if err != nil { if err != nil {
if tun.shouldReopenHandle(err) { if tun.shouldReopenHandle(err) {
tun.closeTUN() tun.closeTUN()
return nil continue
} }
return err return err
} }
return nil return nil
}
} }
func (tun *NativeTun) putTunPacket(buff []byte) error { func (tun *NativeTun) putTunPacket(buff []byte) error {