tun: windows: do not sleep after OPERATION_ABORTED

This commit is contained in:
Jason A. Donenfeld 2019-04-09 07:36:03 +02:00
parent 767c86f8cb
commit e680008700

View File

@ -259,7 +259,7 @@ func (tun *NativeTun) Read(buff []byte, offset int) (int, error) {
} }
// Fill queue. // Fill queue.
retries := retryTimeout * retryRate retries := 1000
for { for {
n, err := file.Read(tun.rdBuff.data[:]) n, err := file.Read(tun.rdBuff.data[:])
if err != nil { if err != nil {
@ -270,7 +270,6 @@ func (tun *NativeTun) Read(buff []byte, offset int) (int, error) {
return 0, os.ErrClosed return 0, 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
} }