Skip to content

Commit

Permalink
Merge pull request #1734 from monkey92t/failover_tls
Browse files Browse the repository at this point in the history
fix #1732
  • Loading branch information
vmihailenco authored Apr 21, 2021
2 parents b7720fd + 0b855ec commit 8d87a75
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,21 @@ func masterSlaveDialer(
failover.trySwitchMaster(ctx, addr)
}
}

if err != nil {
return nil, err
}
if failover.opt.Dialer != nil {
return failover.opt.Dialer(ctx, network, addr)
}
return net.DialTimeout("tcp", addr, failover.opt.DialTimeout)

netDialer := &net.Dialer{
Timeout: failover.opt.DialTimeout,
KeepAlive: 5 * time.Minute,
}
if failover.opt.TLSConfig == nil {
return netDialer.DialContext(ctx, network, addr)
}
return tls.DialWithDialer(netDialer, network, addr, failover.opt.TLSConfig)
}
}

Expand Down

0 comments on commit 8d87a75

Please sign in to comment.