Skip to content

Commit

Permalink
yugatool: attempt cleartext connection if TLS connection fails
Browse files Browse the repository at this point in the history
Partial fix for #28

This commit implements retry in cleartext if TLS connectivity fails but not vice-versa.

A complete fix will require a bit more refactoring since we have to keep track of whether we've already tried to swap from TLS to cleartext or vice-versa, otherwise we will end up in a loop.
  • Loading branch information
ionthegeek committed Oct 12, 2022
1 parent d527ed4 commit ab00119
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions yugatool/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ func (c *YBClient) Connect() error {

}
if c.Master == nil {
if util.HasTLS(c.Config.GetTlsOpts()) {
c.Log.V(1).Info("could not connect to master leader, disabling TLS and trying again", "error", err)

c.Config.TlsOpts = nil
// Deallocate the existing dialer so a new non-TLS dialer will be created during Connect()
c.dialer = nil

return c.Connect()
}
return errors.Errorf("could not connect to master leader")
}
return err
Expand Down

0 comments on commit ab00119

Please sign in to comment.