Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conn reset handle for windows #465

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions proxy_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,13 @@ import (
"fmt"
"net"
"strings"
"syscall"
)

var _ = fmt.Println

func isErrConnReset(err error) bool {
// fmt.Printf("calling isErrConnReset for err type: %v Error() %s\n",
// reflect.TypeOf(err), err.Error())
if ne, ok := err.(*net.OpError); ok {
// fmt.Println("isErrConnReset net.OpError.Err type:", reflect.TypeOf(ne))
if errno, enok := ne.Err.(syscall.Errno); enok {
// I got these number by print. Only tested on XP.
// fmt.Printf("isErrConnReset errno: %d\n", errno)
return errno == 64 || errno == 10054
}
return strings.Contains(ne.Err.Error(), "An existing connection was forcibly closed by the remote host.")
}
return false
}
Expand Down