From: Simon Rozman Date: Thu, 11 Apr 2019 17:37:04 +0000 (+0200) Subject: tun: windows: do not sleep after OPERATION_ABORTED on write X-Git-Tag: 0.0.20190517~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a291fdd7462768dd54e433f8319c780448a44f7d;p=thirdparty%2Fwireguard-go.git tun: windows: do not sleep after OPERATION_ABORTED on write Signed-off-by: Simon Rozman --- diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 0f39d01..e55fa6f 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -301,7 +301,7 @@ func (tun *NativeTun) Flush() error { } // Flush write buffer. - retries := retryTimeout * retryRate + retries := 1000 for { _, err = file.Write(tun.wrBuff.data[:tun.wrBuff.offset]) tun.wrBuff.packetNum = 0 @@ -312,7 +312,6 @@ func (tun *NativeTun) Flush() error { return os.ErrClosed } if retries > 0 && ok && pe.Err == windows.ERROR_OPERATION_ABORTED { - time.Sleep(time.Second / retryRate) retries-- continue }