Unwrap errors properly for patform specific connection retry code.

Include more possible errors for Windows.

For #442
This commit is contained in:
Nick Craig-Wood
2016-06-10 13:48:41 +01:00
parent 661715733a
commit 7fe653c350
2 changed files with 18 additions and 6 deletions
+9 -2
View File
@@ -16,8 +16,15 @@ func isClosedConnErrorPlatform(err error) bool {
if oe, ok := err.(*net.OpError); ok {
if se, ok := oe.Err.(*os.SyscallError); ok {
if errno, ok := se.Err.(syscall.Errno); ok {
const WSAECONNABORTED syscall.Errno = 10053
if errno == syscall.WSAECONNRESET || errno == WSAECONNABORTED {
const (
WSAECONNABORTED syscall.Errno = 10053
WSAHOST_NOT_FOUND syscall.Errno = 11001
WSATRY_AGAIN syscall.Errno = 11002
WSAENETRESET syscall.Errno = 10052
WSAETIMEDOUT syscall.Errno = 10060
)
switch errno {
case syscall.WSAECONNRESET, WSAECONNABORTED, WSAHOST_NOT_FOUND, WSATRY_AGAIN, WSAENETRESET, WSAETIMEDOUT:
return true
}
}