From 8adcc4d83b487c6ba143a5f162d26b113a8ae26f Mon Sep 17 00:00:00 2001 From: Comzyh 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()