@@ -402,11 +402,7 @@ public void run() {
402
402
public void onStatusReceived (final Status status ) {
403
403
lastStateWasReady = false ;
404
404
syncContext .execute (() -> {
405
- if (status .isOk ()) {
406
- handleRpcStreamClosed (Status .UNAVAILABLE .withDescription (CLOSED_BY_SERVER ));
407
- } else {
408
- handleRpcStreamClosed (status );
409
- }
405
+ handleRpcStreamClosed (status );
410
406
});
411
407
}
412
408
@@ -425,7 +421,7 @@ final void handleRpcResponse(XdsResourceType<?> type, String versionInfo, List<A
425
421
processingTracker .onComplete ();
426
422
}
427
423
428
- private void handleRpcStreamClosed (Status error ) {
424
+ private void handleRpcStreamClosed (Status status ) {
429
425
if (closed ) {
430
426
return ;
431
427
}
@@ -440,15 +436,18 @@ private void handleRpcStreamClosed(Status error) {
440
436
// concurrently with the stopwatch and schedule.
441
437
long delayNanos = scheduleRpcRetry ();
442
438
443
- checkArgument (!error .isOk (), "unexpected OK status" );
444
- String errorMsg = error .getDescription () != null
445
- && error .getDescription ().equals (CLOSED_BY_SERVER )
446
- ? "ADS stream closed with status {0}: {1}. Cause: {2}"
447
- : "ADS stream failed with status {0}: {1}. Cause: {2}" ;
448
- logger .log (
449
- XdsLogLevel .ERROR , errorMsg , error .getCode (), error .getDescription (), error .getCause ());
439
+ if (status .isOk ()) {
440
+ logger .log (XdsLogLevel .WARNING , "ADS stream closed, backoff {0} ns" , delayNanos );
441
+ } else {
442
+ String errorMsg = status .getDescription () != null
443
+ && status .getDescription ().equals (CLOSED_BY_SERVER )
444
+ ? "ADS stream closed with status {0}: {1}. Cause: {2}"
445
+ : "ADS stream failed with status {0}: {1}. Cause: {2}" ;
446
+ logger .log (
447
+ XdsLogLevel .ERROR , errorMsg , status .getCode (), status .getDescription (), status .getCause ());
448
+ }
450
449
closed = true ;
451
- xdsResponseHandler .handleStreamClosed (error );
450
+ xdsResponseHandler .handleStreamClosed (status );
452
451
cleanUp ();
453
452
454
453
logger .log (XdsLogLevel .INFO , "Retry ADS stream in {0} ns" , delayNanos );
0 commit comments