Fix: TCP dial error should not return early (#307)
This commit is contained in:
parent
b38663a209
commit
5b76ff53c9
1 changed files with 1 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue