From 5b76ff53c964283a0d2a3b8dead78332353d5d0d Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Tue, 17 Sep 2019 20:11:49 +0800 Subject: [PATCH] Fix: TCP dial error should not return early (#307) --- adapters/outbound/util.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/adapters/outbound/util.go b/adapters/outbound/util.go index b3670b3e..3b173119 100644 --- a/adapters/outbound/util.go +++ b/adapters/outbound/util.go @@ -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()