Skip to content

Commit

Permalink
Do not set ATTR_LB_ADDRS for test if resolved addresses do not contai…
Browse files Browse the repository at this point in the history
…n balancer addresses, this mirrors the real behavior of DnsNameResolver.
  • Loading branch information
voidzcy committed Jan 28, 2020
1 parent 3fccafe commit f02a7fa
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
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 f02a7fa

Please sign in to comment.