@@ -280,7 +280,7 @@ XdsResourceType<?> fromTypeUrl(String typeUrl) {
280280 private class AdsStream implements EventHandler <DiscoveryResponse > {
281281 private boolean responseReceived ;
282282 private boolean closed ;
283- // Response nonce for the most recently received discovery responses of each resource type.
283+ // Response nonce for the most recently received discovery responses of each resource type URL .
284284 // Client initiated requests start response nonce with empty string.
285285 // Nonce in each response is echoed back in the following ACK/NACK request. It is
286286 // used for management server to identify which response the client is ACKing/NACking.
@@ -289,7 +289,7 @@ private class AdsStream implements EventHandler<DiscoveryResponse> {
289289 // map; nonces are only discarded once the stream closes because xds_protocol says "the
290290 // management server should not send a DiscoveryResponse for any DiscoveryRequest that has a
291291 // stale nonce."
292- private final Map <XdsResourceType <?> , String > respNonces = new HashMap <>();
292+ private final Map <String , String > respNonces = new HashMap <>();
293293 private final StreamingCall <DiscoveryRequest , DiscoveryResponse > call ;
294294 private final MethodDescriptor <DiscoveryRequest , DiscoveryResponse > methodDescriptor =
295295 AggregatedDiscoveryServiceGrpc .getStreamAggregatedResourcesMethod ();
@@ -337,7 +337,7 @@ void sendDiscoveryRequest(XdsResourceType<?> type, String versionInfo,
337337 final void sendDiscoveryRequest (XdsResourceType <?> type , Collection <String > resources ) {
338338 logger .log (XdsLogLevel .INFO , "Sending {0} request for resources: {1}" , type , resources );
339339 sendDiscoveryRequest (type , versions .getOrDefault (type , "" ), resources ,
340- respNonces .getOrDefault (type , "" ), null );
340+ respNonces .getOrDefault (type . typeUrl () , "" ), null );
341341 }
342342
343343 @ Override
@@ -352,6 +352,7 @@ public void onRecvMessage(DiscoveryResponse response) {
352352 public void run () {
353353 // Reset flag as message has been received on a stream
354354 streamClosedNoResponse = false ;
355+ respNonces .put (response .getTypeUrl (), response .getNonce ());
355356 XdsResourceType <?> type = fromTypeUrl (response .getTypeUrl ());
356357 if (logger .isLoggable (XdsLogLevel .DEBUG )) {
357358 logger .log (
@@ -387,7 +388,6 @@ final void handleRpcResponse(XdsResourceType<?> type, String versionInfo, List<A
387388 return ;
388389 }
389390 responseReceived = true ;
390- respNonces .put (type , nonce );
391391 ProcessingTracker processingTracker = new ProcessingTracker (
392392 () -> call .startRecvMessage (), syncContext );
393393 xdsResponseHandler .handleResourceResponse (type , serverInfo , versionInfo , resources , nonce ,
0 commit comments