Skip to content

Commit 0b855ec

Browse files
committed
fix #1732
Signed-off-by: monkey <[email protected]>
1 parent b7720fd commit 0b855ec

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sentinel.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,21 @@ func masterSlaveDialer(
219219
failover.trySwitchMaster(ctx, addr)
220220
}
221221
}
222-
223222
if err != nil {
224223
return nil, err
225224
}
226225
if failover.opt.Dialer != nil {
227226
return failover.opt.Dialer(ctx, network, addr)
228227
}
229-
return net.DialTimeout("tcp", addr, failover.opt.DialTimeout)
228+
229+
netDialer := &net.Dialer{
230+
Timeout: failover.opt.DialTimeout,
231+
KeepAlive: 5 * time.Minute,
232+
}
233+
if failover.opt.TLSConfig == nil {
234+
return netDialer.DialContext(ctx, network, addr)
235+
}
236+
return tls.DialWithDialer(netDialer, network, addr, failover.opt.TLSConfig)
230237
}
231238
}
232239

0 commit comments

Comments
 (0)