@@ -516,13 +516,15 @@ export class XdsClient {
516
516
}
517
517
}
518
518
519
- private handleAdsCallError ( error : ServiceError ) {
519
+ private handleAdsCallStatus ( streamStatus : StatusObject ) {
520
520
trace (
521
- 'ADS stream ended. code=' + error . code + ' details= ' + error . details
521
+ 'ADS stream ended. code=' + streamStatus . code + ' details= ' + streamStatus . details
522
522
) ;
523
523
this . adsCallV2 = null ;
524
524
this . adsCallV3 = null ;
525
- this . reportStreamError ( error ) ;
525
+ if ( streamStatus . code !== status . OK ) {
526
+ this . reportStreamError ( streamStatus ) ;
527
+ }
526
528
/* If the backoff timer is no longer running, we do not need to wait any
527
529
* more to start the new call. */
528
530
if ( ! this . adsBackoff . isRunning ( ) ) {
@@ -544,9 +546,10 @@ export class XdsClient {
544
546
this . adsCallV2 . on ( 'data' , ( message : DiscoveryResponse__Output ) => {
545
547
this . handleAdsResponse ( message ) ;
546
548
} ) ;
547
- this . adsCallV2 . on ( 'error ' , ( error : ServiceError ) => {
548
- this . handleAdsCallError ( error ) ;
549
+ this . adsCallV2 . on ( 'status ' , ( status : StatusObject ) => {
550
+ this . handleAdsCallStatus ( status ) ;
549
551
} ) ;
552
+ this . adsCallV2 . on ( 'error' , ( ) => { } ) ;
550
553
return true ;
551
554
}
552
555
@@ -564,9 +567,10 @@ export class XdsClient {
564
567
this . adsCallV3 . on ( 'data' , ( message : DiscoveryResponse__Output ) => {
565
568
this . handleAdsResponse ( message ) ;
566
569
} ) ;
567
- this . adsCallV3 . on ( 'error ' , ( error : ServiceError ) => {
568
- this . handleAdsCallError ( error ) ;
570
+ this . adsCallV3 . on ( 'status ' , ( status : StatusObject ) => {
571
+ this . handleAdsCallStatus ( status ) ;
569
572
} ) ;
573
+ this . adsCallV3 . on ( 'error' , ( ) => { } ) ;
570
574
return true ;
571
575
}
572
576
@@ -772,9 +776,9 @@ export class XdsClient {
772
776
this . receivedLrsSettingsForCurrentStream = true ;
773
777
}
774
778
775
- private handleLrsCallError ( error : ServiceError ) {
779
+ private handleLrsCallStatus ( streamStatus : StatusObject ) {
776
780
trace (
777
- 'LRS stream ended. code=' + error . code + ' details= ' + error . details
781
+ 'LRS stream ended. code=' + streamStatus . code + ' details= ' + streamStatus . details
778
782
) ;
779
783
this . lrsCallV2 = null ;
780
784
this . lrsCallV3 = null ;
@@ -798,9 +802,10 @@ export class XdsClient {
798
802
this . lrsCallV2 . on ( 'data' , ( message : LoadStatsResponse__Output ) => {
799
803
this . handleLrsResponse ( message ) ;
800
804
} ) ;
801
- this . lrsCallV2 . on ( 'error ' , ( error : ServiceError ) => {
802
- this . handleLrsCallError ( error ) ;
805
+ this . lrsCallV2 . on ( 'status ' , ( status : StatusObject ) => {
806
+ this . handleLrsCallStatus ( status ) ;
803
807
} ) ;
808
+ this . lrsCallV2 . on ( 'error' , ( ) => { } ) ;
804
809
return true ;
805
810
}
806
811
@@ -816,9 +821,10 @@ export class XdsClient {
816
821
this . lrsCallV3 . on ( 'data' , ( message : LoadStatsResponse__Output ) => {
817
822
this . handleLrsResponse ( message ) ;
818
823
} ) ;
819
- this . lrsCallV3 . on ( 'error ' , ( error : ServiceError ) => {
820
- this . handleLrsCallError ( error ) ;
824
+ this . lrsCallV3 . on ( 'status ' , ( status : StatusObject ) => {
825
+ this . handleLrsCallStatus ( status ) ;
821
826
} ) ;
827
+ this . lrsCallV3 . on ( 'error' , ( ) => { } ) ;
822
828
return true ;
823
829
}
824
830
0 commit comments