replace deprecated Dail with DailContext

Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
This commit is contained in:
zounengren 2021-09-08 06:41:33 +08:00
parent 61a46e9fdd
commit 8e850bc0fe

View File

@ -77,7 +77,9 @@ func SocketAddress(ctx context.Context, socketPath, id string) (string, error) {
// AnonDialer returns a dialer for a socket // AnonDialer returns a dialer for a socket
func AnonDialer(address string, timeout time.Duration) (net.Conn, error) { func AnonDialer(address string, timeout time.Duration) (net.Conn, error) {
return dialer.Dialer(socket(address).path(), timeout) ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
return dialer.ContextDialer(ctx, socket(address).path())
} }
// AnonReconnectDialer returns a dialer for an existing socket on reconnection // AnonReconnectDialer returns a dialer for an existing socket on reconnection