Fix: TCP dial error should not return early (#307)

This commit is contained in:
Comzyh 2019-09-17 20:11:49 +08:00 committed by Dreamacro
parent b76737bdbb
commit 8adcc4d83b

View File

@ -140,12 +140,9 @@ func dialTimeout(network, address string, timeout time.Duration) (net.Conn, erro
} else {
c, err = dialer.DialContext(ctx, "tcp4", net.JoinHostPort(ip.String(), port))
}
if err != nil {
return
}
select {
case results <- dialResult{Conn: c, error: err, ipv6: ipv6}:
case results <- dialResult{Conn: c, error: err, ipv6: ipv6, done: true}:
case <-returned:
if c != nil {
c.Close()