2016-04-29 15:42:08 +00:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package fs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
// isClosedConnErrorPlatform reports whether err is an error from use
|
|
|
|
// of a closed network connection using platform specific error codes.
|
|
|
|
//
|
|
|
|
// Code adapted from net/http
|
|
|
|
func isClosedConnErrorPlatform(err error) bool {
|
2016-06-09 14:34:13 +00:00
|
|
|
if oe, ok := err.(*net.OpError); ok {
|
|
|
|
if se, ok := oe.Err.(*os.SyscallError); ok {
|
2016-04-29 15:42:08 +00:00
|
|
|
if errno, ok := se.Err.(syscall.Errno); ok {
|
|
|
|
const WSAECONNABORTED syscall.Errno = 10053
|
|
|
|
if errno == syscall.WSAECONNRESET || errno == WSAECONNABORTED {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|