Skip to content

Commit

Permalink
Fix address to endpoint conversion logic
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan-bal committed Aug 12, 2024
1 parent 9a2d6a9 commit 2a36f7f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions balancer/pickfirst_leaf/pickfirst_leaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,11 @@ func (b *pickfirstBalancer) updateClientConnState(state balancer.ClientConnState

newEndpoints := state.ResolverState.Endpoints
if len(newEndpoints) == 0 {
newEndpoints = make([]resolver.Endpoint, len(state.ResolverState.Addresses))
// Convert addresses to endpoints.
for _, addr := range state.ResolverState.Addresses {
newEndpoints = append(newEndpoints, resolver.Endpoint{Addresses: []resolver.Address{addr}})
for i, a := range state.ResolverState.Addresses {
newEndpoints[i].Attributes = a.BalancerAttributes
newEndpoints[i].Addresses = []resolver.Address{a}
}
}

Expand Down

0 comments on commit 2a36f7f

Please sign in to comment.