tun: windows: do not sleep after OPERATION_ABORTED on write
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
d50e390904
commit
a291fdd746
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user