@@ -157,9 +157,6 @@ final class XdsClientImpl extends XdsClient {
157
157
// never change.
158
158
@ Nullable
159
159
private ConfigWatcher configWatcher ;
160
- // The host name portion of "xds:" URI that the gRPC client targets for.
161
- @ Nullable
162
- private String hostName ;
163
160
// The "xds:" URI (including port suffix if present) that the gRPC client targets for.
164
161
@ Nullable
165
162
private String ldsResourceName ;
@@ -233,15 +230,10 @@ private void cleanUpResources() {
233
230
}
234
231
235
232
@ Override
236
- void watchConfigData (String hostName , int port , ConfigWatcher watcher ) {
237
- checkState (configWatcher == null , "watcher for %s already registered" , hostName );
233
+ void watchConfigData (String targetAuthority , ConfigWatcher watcher ) {
234
+ checkState (configWatcher == null , "watcher for %s already registered" , targetAuthority );
235
+ ldsResourceName = checkNotNull (targetAuthority , "targetAuthority" );
238
236
configWatcher = checkNotNull (watcher , "watcher" );
239
- this .hostName = checkNotNull (hostName , "hostName" );
240
- if (port == -1 ) {
241
- ldsResourceName = hostName ;
242
- } else {
243
- ldsResourceName = hostName + ":" + port ;
244
- }
245
237
logger .log (XdsLogLevel .INFO , "Started watching config {0}" , ldsResourceName );
246
238
if (rpcRetryTimer != null && rpcRetryTimer .isPending ()) {
247
239
// Currently in retry backoff.
@@ -540,11 +532,12 @@ private void handleLdsResponse(DiscoveryResponse ldsResponse) {
540
532
// data or one supersedes the other. TBD.
541
533
if (requestedHttpConnManager .hasRouteConfig ()) {
542
534
RouteConfiguration rc = requestedHttpConnManager .getRouteConfig ();
543
- clusterName = findClusterNameInRouteConfig (rc , hostName );
535
+ clusterName = findClusterNameInRouteConfig (rc , ldsResourceName );
544
536
if (clusterName == null ) {
545
537
errorMessage =
546
538
"Listener " + ldsResourceName + " : cannot find a valid cluster name in any "
547
- + "virtual hosts inside RouteConfiguration with domains matching: " + hostName ;
539
+ + "virtual hosts inside RouteConfiguration with domains matching: "
540
+ + ldsResourceName ;
548
541
}
549
542
} else if (requestedHttpConnManager .hasRds ()) {
550
543
Rds rds = requestedHttpConnManager .getRds ();
@@ -650,14 +643,14 @@ private void handleRdsResponse(DiscoveryResponse rdsResponse) {
650
643
// Resolved cluster name for the requested resource, if exists.
651
644
String clusterName = null ;
652
645
if (requestedRouteConfig != null ) {
653
- clusterName = findClusterNameInRouteConfig (requestedRouteConfig , hostName );
646
+ clusterName = findClusterNameInRouteConfig (requestedRouteConfig , ldsResourceName );
654
647
if (clusterName == null ) {
655
648
adsStream .sendNackRequest (
656
649
ADS_TYPE_URL_RDS , ImmutableList .of (adsStream .rdsResourceName ),
657
650
rdsResponse .getVersionInfo (),
658
651
"RouteConfiguration " + requestedRouteConfig .getName () + ": cannot find a "
659
652
+ "valid cluster name in any virtual hosts with domains matching: "
660
- + hostName );
653
+ + ldsResourceName );
661
654
return ;
662
655
}
663
656
}
0 commit comments