@@ -567,7 +567,6 @@ private interface RdsUpdateSupplier {
567567
568568 private class LdsWatcher extends XdsWatcherBase <XdsListenerResource .LdsUpdate >
569569 implements RdsUpdateSupplier {
570- String rdsName ;
571570
572571 private LdsWatcher (String resourceName ) {
573572 super (XdsListenerResource .getInstance (), resourceName );
@@ -582,43 +581,36 @@ public void onChanged(XdsListenerResource.LdsUpdate update) {
582581
583582 HttpConnectionManager httpConnectionManager = update .httpConnectionManager ();
584583 List <VirtualHost > virtualHosts ;
585- String rdsName ;
586584 if (httpConnectionManager == null ) {
587585 // TCP listener. Unsupported config
588586 virtualHosts = Collections .emptyList (); // Not null, to not delegate to RDS
589- rdsName = null ;
590587 } else {
591588 virtualHosts = httpConnectionManager .virtualHosts ();
592- rdsName = httpConnectionManager .rdsName ();
593589 }
594-
595590 if (virtualHosts != null ) {
596- // No RDS watcher since we are getting RDS updates via LDS
597591 updateRoutes (virtualHosts );
598- this .rdsName = null ;
599- } else {
600- this .rdsName = rdsName ;
592+ }
593+
594+ String rdsName = getRdsName (update );
595+ if (rdsName != null ) {
601596 addRdsWatcher (rdsName );
602597 }
603598
604599 setData (update );
605600 maybePublishConfig ();
606601 }
607602
608- @ Override
609- public void onResourceDoesNotExist (String resourceName ) {
610- if (cancelled ) {
611- return ;
603+ private String getRdsName (XdsListenerResource .LdsUpdate update ) {
604+ HttpConnectionManager httpConnectionManager = update .httpConnectionManager ();
605+ if (httpConnectionManager == null ) {
606+ // TCP listener. Unsupported config
607+ return null ;
612608 }
613-
614- checkArgument (resourceName ().equals (resourceName ), "Resource name does not match" );
615- setDataAsStatus (Status .UNAVAILABLE .withDescription (
616- toContextString () + " does not exist" + nodeInfo ()));
617- rdsName = null ;
618- maybePublishConfig ();
609+ return httpConnectionManager .rdsName ();
619610 }
620611
621- private RdsWatcher getRdsWatcher (WatcherTracer tracer ) {
612+ private RdsWatcher getRdsWatcher (XdsListenerResource .LdsUpdate update , WatcherTracer tracer ) {
613+ String rdsName = getRdsName (update );
622614 if (rdsName == null ) {
623615 return null ;
624616 }
@@ -637,7 +629,7 @@ public RdsUpdateSupplier getRouteSource(WatcherTracer tracer) {
637629 if (virtualHosts != null ) {
638630 return this ;
639631 }
640- RdsWatcher rdsWatcher = getRdsWatcher (tracer );
632+ RdsWatcher rdsWatcher = getRdsWatcher (getData (). getValue (), tracer );
641633 assert rdsWatcher != null ;
642634 return rdsWatcher ;
643635 }
0 commit comments