@@ -309,7 +309,7 @@ private class AdsStream implements XdsTransportFactory.EventHandler<DiscoveryRes
309
309
private boolean responseReceived ;
310
310
private boolean sentInitialRequest ;
311
311
private boolean closed ;
312
- // Response nonce for the most recently received discovery responses of each resource type.
312
+ // Response nonce for the most recently received discovery responses of each resource type URL .
313
313
// Client initiated requests start response nonce with empty string.
314
314
// Nonce in each response is echoed back in the following ACK/NACK request. It is
315
315
// used for management server to identify which response the client is ACKing/NACking.
@@ -318,7 +318,7 @@ private class AdsStream implements XdsTransportFactory.EventHandler<DiscoveryRes
318
318
// map; nonces are only discarded once the stream closes because xds_protocol says "the
319
319
// management server should not send a DiscoveryResponse for any DiscoveryRequest that has a
320
320
// stale nonce."
321
- private final Map <XdsResourceType <?> , String > respNonces = new HashMap <>();
321
+ private final Map <String , String > respNonces = new HashMap <>();
322
322
private final StreamingCall <DiscoveryRequest , DiscoveryResponse > call ;
323
323
private final MethodDescriptor <DiscoveryRequest , DiscoveryResponse > methodDescriptor =
324
324
AggregatedDiscoveryServiceGrpc .getStreamAggregatedResourcesMethod ();
@@ -369,7 +369,7 @@ void sendDiscoveryRequest(XdsResourceType<?> type, String versionInfo,
369
369
final void sendDiscoveryRequest (XdsResourceType <?> type , Collection <String > resources ) {
370
370
logger .log (XdsLogLevel .INFO , "Sending {0} request for resources: {1}" , type , resources );
371
371
sendDiscoveryRequest (type , versions .getOrDefault (type , "" ), resources ,
372
- respNonces .getOrDefault (type , "" ), null );
372
+ respNonces .getOrDefault (type . typeUrl () , "" ), null );
373
373
}
374
374
375
375
@ Override
@@ -400,6 +400,7 @@ public void run() {
400
400
boolean isFirstResponse = !responseReceived ;
401
401
responseReceived = true ;
402
402
inError = false ;
403
+ respNonces .put (response .getTypeUrl (), response .getNonce ());
403
404
404
405
XdsResourceType <?> type = fromTypeUrl (response .getTypeUrl ());
405
406
if (logger .isLoggable (XdsLogLevel .DEBUG )) {
@@ -433,7 +434,6 @@ final void handleRpcResponse(XdsResourceType<?> type, String versionInfo, List<A
433
434
String nonce , boolean isFirstResponse ) {
434
435
checkNotNull (type , "type" );
435
436
436
- respNonces .put (type , nonce );
437
437
ProcessingTracker processingTracker = new ProcessingTracker (
438
438
() -> call .startRecvMessage (), syncContext );
439
439
xdsResponseHandler .handleResourceResponse (type , serverInfo , versionInfo , resources , nonce ,
0 commit comments