Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
client: fix dialer after vendor update
Browse files Browse the repository at this point in the history
It now sends a dial address with unix prefix.
And we should bailout when timeout in commonDialer.

Signed-off-by: Peng Tao <[email protected]>
  • Loading branch information
bergwolf committed Sep 6, 2018
1 parent cd03e0c commit a6e27d6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions protocols/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a6e27d6

Please sign in to comment.