Skip to content

Commit

Permalink
Go 1.5 compat change
Browse files Browse the repository at this point in the history
1.5 handles connection refused slightly differently (probably
by using SO_ERROR) that needed adjustment to code that detects it.
Eugene Yakubovich committed Oct 30, 2015
1 parent 86ec894 commit d6b2515
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions remote/remote_test.go
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ import (
"fmt"
"net"
"net/url"
"os"
"sync"
"syscall"
"testing"
@@ -71,6 +72,9 @@ func mustParseIP4Net(s string) ip.IP4Net {
func isConnRefused(err error) bool {
if uerr, ok := err.(*url.Error); ok {
if operr, ok := uerr.Err.(*net.OpError); ok {
if oserr, ok := operr.Err.(*os.SyscallError); ok {
return oserr.Err == syscall.ECONNREFUSED
}
return operr.Err == syscall.ECONNREFUSED
}
}

0 comments on commit d6b2515

Please sign in to comment.