clustetresolver: Copy endpoints.Addresses slice from DNS updates to a… · grpc/grpc-go@62b9185 (original) (raw)
File tree
1 file changed
lines changed
- xds/internal/balancer/clusterresolver
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -144,6 +144,9 @@ func buildClusterImplConfigForDNS(g *nameGenerator, endpoints []resolver.Endpoin | ||
144 | 144 | pName := fmt.Sprintf("priority-%v", g.prefix) |
145 | 145 | for i, e := range endpoints { |
146 | 146 | retEndpoints[i] = hierarchy.SetInEndpoint(e, []string{pName}) |
147 | +// Copy the nested address field as slice fields are shared by the | |
148 | +// iteration variable and the original slice. | |
149 | +retEndpoints[i].Addresses = append([]resolver.Address{}, e.Addresses...) | |
147 | 150 | } |
148 | 151 | return pName, &clusterimpl.LBConfig{ |
149 | 152 | Cluster: mechanism.Cluster, |