From: Jason A. Donenfeld Date: Tue, 9 Apr 2019 05:36:03 +0000 (+0200) Subject: tun: windows: do not sleep after OPERATION_ABORTED X-Git-Tag: 0.0.20190409~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e680008700e4a187c6f13ccc1ba4c9aeac8dddf9;p=thirdparty%2Fwireguard-go.git tun: windows: do not sleep after OPERATION_ABORTED --- diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 386b518..0f39d01 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -259,7 +259,7 @@ func (tun *NativeTun) Read(buff []byte, offset int) (int, error) { } // Fill queue. - retries := retryTimeout * retryRate + retries := 1000 for { n, err := file.Read(tun.rdBuff.data[:]) if err != nil { @@ -270,7 +270,6 @@ func (tun *NativeTun) Read(buff []byte, offset int) (int, error) { return 0, os.ErrClosed } if retries > 0 && ok && pe.Err == windows.ERROR_OPERATION_ABORTED { - time.Sleep(time.Second / retryRate) retries-- continue }