tun: windows: Adopt new error codes returned by Wintun
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
a291fdd746
commit
ef5f3ad80a
@ -9,7 +9,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
@ -273,7 +272,7 @@ func (tun *NativeTun) Read(buff []byte, offset int) (int, error) {
|
|||||||
retries--
|
retries--
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ok && pe.Err == syscall.Errno(6) /*windows.ERROR_INVALID_HANDLE*/ {
|
if ok && pe.Err == windows.ERROR_HANDLE_EOF {
|
||||||
tun.closeTUN()
|
tun.closeTUN()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -315,7 +314,7 @@ func (tun *NativeTun) Flush() error {
|
|||||||
retries--
|
retries--
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ok && pe.Err == syscall.Errno(6) /*windows.ERROR_INVALID_HANDLE*/ {
|
if ok && pe.Err == windows.ERROR_HANDLE_EOF {
|
||||||
tun.closeTUN()
|
tun.closeTUN()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user