瀏覽代碼

Go 1.5 compat change

1.5 handles connection refused slightly differently (probably
by using SO_ERROR) that needed adjustment to code that detects it.
Eugene Yakubovich 9 年之前
父節點
當前提交
d6b2515217
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      remote/remote_test.go

+ 4 - 0
remote/remote_test.go

@@ -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
 		}
 	}