From a6e27d65e50eb938e4e8fe41f0f43e14fff03be9 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Thu, 6 Sep 2018 20:19:02 +0800 Subject: [PATCH] client: fix dialer after vendor update It now sends a dial address with unix prefix. And we should bailout when timeout in commonDialer. Signed-off-by: Peng Tao --- protocols/client/client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/protocols/client/client.go b/protocols/client/client.go index 4da19ece98..451beab07f 100644 --- a/protocols/client/client.go +++ b/protocols/client/client.go @@ -217,6 +217,10 @@ func agentDialer(addr *url.URL, enableYamux bool) dialer { } func unixDialer(sock string, timeout time.Duration) (net.Conn, error) { + if strings.HasPrefix(sock, "unix:") { + sock = strings.Trim(sock, "unix:") + } + dialFunc := func() (net.Conn, error) { return net.DialTimeout("unix", sock, timeout) } @@ -285,6 +289,9 @@ func commonDialer(timeout time.Duration, dialFunc func() (net.Conn, error), time if !ok { return nil, timeoutErrMsg } + case <-t.C: + cancel <- true + return nil, timeoutErrMsg } return conn, nil