Skip to content

Commit

Permalink
Do not set ATTR_LB_ADDR if not balancer addresses specified for test,…
Browse files Browse the repository at this point in the history
… mirror what DnsNameResolver is doing.
  • Loading branch information
voidzcy committed Jan 28, 2020
1 parent 3fccafe commit a9d6a40
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -2356,15 +2356,17 @@ private void deliverResolvedAddresses(
final List<EquivalentAddressGroup> backendAddrs,
final List<EquivalentAddressGroup> balancerAddrs,
Attributes attrs) {
final Attributes attributes =
attrs.toBuilder().set(GrpclbConstants.ATTR_LB_ADDRS, balancerAddrs).build();
if (!balancerAddrs.isEmpty()) {
attrs = attrs.toBuilder().set(GrpclbConstants.ATTR_LB_ADDRS, balancerAddrs).build();
}
final Attributes finalAttrs = attrs;
syncContext.execute(new Runnable() {
@Override
public void run() {
balancer.handleResolvedAddresses(
ResolvedAddresses.newBuilder()
.setAddresses(backendAddrs)
.setAttributes(attributes)
.setAttributes(finalAttrs)
.build());
}
});
Expand Down

0 comments on commit a9d6a40

Please sign in to comment.