tun: windows: do not sleep after OPERATION_ABORTED on write

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-04-11 19:37:04 +02:00
parent d50e390904
commit a291fdd746

View file

@ -301,7 +301,7 @@ func (tun *NativeTun) Flush() error {
} }
// Flush write buffer. // Flush write buffer.
retries := retryTimeout * retryRate retries := 1000
for { for {
_, err = file.Write(tun.wrBuff.data[:tun.wrBuff.offset]) _, err = file.Write(tun.wrBuff.data[:tun.wrBuff.offset])
tun.wrBuff.packetNum = 0 tun.wrBuff.packetNum = 0
@ -312,7 +312,6 @@ func (tun *NativeTun) Flush() error {
return os.ErrClosed return os.ErrClosed
} }
if retries > 0 && ok && pe.Err == windows.ERROR_OPERATION_ABORTED { if retries > 0 && ok && pe.Err == windows.ERROR_OPERATION_ABORTED {
time.Sleep(time.Second / retryRate)
retries-- retries--
continue continue
} }