Skip to content

Commit

Permalink
ca: remove unused method
Browse files Browse the repository at this point in the history
and small refactor to getCAProvider so that GoLand is less confused about what it is doing.
Previously it was reporting that the for condition was always true, which was not the case.
  • Loading branch information
dnephin authored and dhiaayachi committed Jul 12, 2021
1 parent 1960c71 commit 7dae65c
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions agent/consul/leader_connect_ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ func NewCAManager(delegate caServerDelegate, leaderRoutineManager *routine.Manag
}
}

func (c *CAManager) reset() {
c.state = caStateUninitialized
c.primaryRoots = structs.IndexedCARoots{}
c.actingSecondaryCA = false
c.setCAProvider(nil, nil)
}

// setState attempts to update the CA state to the given state.
// Valid state transitions are:
//
Expand Down Expand Up @@ -229,12 +222,10 @@ func parseCARoot(pemValue, provider, clusterID string) (*structs.CARoot, error)
// as well as the active root.
func (c *CAManager) getCAProvider() (ca.Provider, *structs.CARoot) {
retries := 0
var result ca.Provider
var resultRoot *structs.CARoot
for result == nil {
for {
c.providerLock.RLock()
result = c.provider
resultRoot = c.providerRoot
result := c.provider
resultRoot := c.providerRoot
c.providerLock.RUnlock()

// In cases where an agent is started with managed proxies, we may ask
Expand All @@ -246,10 +237,8 @@ func (c *CAManager) getCAProvider() (ca.Provider, *structs.CARoot) {
continue
}

break
return result, resultRoot
}

return result, resultRoot
}

// setCAProvider is being called while holding the stateLock
Expand Down

0 comments on commit 7dae65c

Please sign in to comment.