forked from mirror/redis
Merge pull request #1110 from kollektiv/dial-context
Use DialContext by default
This commit is contained in:
commit
0cf98f9217
|
@ -112,7 +112,7 @@ func (opt *Options) init() {
|
||||||
KeepAlive: 5 * time.Minute,
|
KeepAlive: 5 * time.Minute,
|
||||||
}
|
}
|
||||||
if opt.TLSConfig == nil {
|
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)
|
return tls.DialWithDialer(netDialer, opt.Network, opt.Addr, opt.TLSConfig)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,8 @@ var _ = Describe("Client", func() {
|
||||||
Network: "tcp",
|
Network: "tcp",
|
||||||
Addr: redisAddr,
|
Addr: redisAddr,
|
||||||
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
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)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue