Merge pull request #1110 from kollektiv/dial-context

Use DialContext by default
This commit is contained in:
Vladimir Mihailenco 2019-07-31 10:58:11 +03:00 committed by GitHub
commit 0cf98f9217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -112,7 +112,7 @@ func (opt *Options) init() {
KeepAlive: 5 * time.Minute,
}
if opt.TLSConfig == nil {
return netDialer.Dial(network, addr)
return netDialer.DialContext(ctx, network, addr)
}
return tls.DialWithDialer(netDialer, opt.Network, opt.Addr, opt.TLSConfig)
}

View File

@ -51,7 +51,8 @@ var _ = Describe("Client", func() {
Network: "tcp",
Addr: redisAddr,
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
return net.Dial(network, addr)
var d net.Dialer
return d.DialContext(ctx, network, addr)
},
})