Skip to content

Commit

Permalink
Changed flag name from invalidData to dataInvalid
Browse files Browse the repository at this point in the history
  • Loading branch information
voidzcy committed Nov 15, 2019
1 parent 63500ce commit bc8c4c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xds/src/main/java/io/grpc/xds/XdsClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ private void handleCdsResponse(DiscoveryResponse cdsResponse) {
return;
}

boolean invalidData = false;
boolean dataInvalid = false;
// Full cluster information update received in this CDS response to be cached.
Map<String, ClusterUpdate> clusterUpdates = new HashMap<>();
// ClusterUpdate data to be pushed to each watcher.
Expand All @@ -574,14 +574,14 @@ private void handleCdsResponse(DiscoveryResponse cdsResponse) {
updateBuilder.setClusterName(clusterName);
// The type field must be set to EDS.
if (!cluster.getType().equals(DiscoveryType.EDS)) {
invalidData = true;
dataInvalid = true;
break;
}
// In the eds_cluster_config field, the eds_config field must be set to indicate to
// use EDS (must be set to use ADS).
EdsClusterConfig edsClusterConfig = cluster.getEdsClusterConfig();
if (!edsClusterConfig.hasEdsConfig() || !edsClusterConfig.getEdsConfig().hasAds()) {
invalidData = true;
dataInvalid = true;
break;
}
// If the service_name field is set, that value will be used for the EDS request
Expand All @@ -591,7 +591,7 @@ private void handleCdsResponse(DiscoveryResponse cdsResponse) {
}
// The lb_policy field must be set to ROUND_ROBIN.
if (!cluster.getLbPolicy().equals(LbPolicy.ROUND_ROBIN)) {
invalidData = true;
dataInvalid = true;
break;
}
updateBuilder.setLbPolicy("round_robin");
Expand All @@ -600,7 +600,7 @@ private void handleCdsResponse(DiscoveryResponse cdsResponse) {
// LRS load reporting will be disabled.
if (cluster.hasLrsServer()) {
if (!cluster.getLrsServer().hasSelf()) {
invalidData = true;
dataInvalid = true;
break;
}
updateBuilder.setEnableLrs(true);
Expand All @@ -614,7 +614,7 @@ private void handleCdsResponse(DiscoveryResponse cdsResponse) {
desiredClusterUpdates.put(clusterName, update);
}
}
if (invalidData) {
if (dataInvalid) {
adsStream.sendNackRequest(ADS_TYPE_URL_CDS, adsStream.cdsResourceNames,
cdsResponse.getNonce(),
"Cluster message contains invalid information for gRPC's usage");
Expand Down

0 comments on commit bc8c4c6

Please sign in to comment.