xds: Include unknown type in channel logger warning

This makes the log statement more useful and easier to determine whether
this was expected behavior.
This commit is contained in:
Eric Anderson 2023-01-12 09:59:41 -08:00
parent 82ca98f338
commit ce86090322
2 changed files with 10 additions and 7 deletions

View File

@ -301,13 +301,12 @@ final class AbstractXdsClient {
final void handleRpcResponse(XdsResourceType<?> type, String versionInfo, List<Any> resources,
String nonce) {
checkNotNull(type, "type");
if (closed) {
return;
}
responseReceived = true;
if (type != null) {
respNonces.put(type, nonce);
}
xdsResponseHandler.handleResourceResponse(type, serverInfo, versionInfo, resources, nonce);
}
@ -391,6 +390,13 @@ final class AbstractXdsClient {
XdsLogLevel.DEBUG, "Received {0} response:\n{1}", type,
MessagePrinter.print(response));
}
if (type == null) {
logger.log(
XdsLogLevel.WARNING,
"Ignore an unknown type of DiscoveryResponse: {0}",
response.getTypeUrl());
return;
}
handleRpcResponse(type, response.getVersionInfo(), response.getResourcesList(),
response.getNonce());
}

View File

@ -167,11 +167,8 @@ final class XdsClientImpl extends XdsClient
public void handleResourceResponse(
XdsResourceType<?> xdsResourceType, ServerInfo serverInfo, String versionInfo,
List<Any> resources, String nonce) {
checkNotNull(xdsResourceType, "xdsResourceType");
syncContext.throwIfNotInThisSynchronizationContext();
if (xdsResourceType == null) {
logger.log(XdsLogLevel.WARNING, "Ignore an unknown type of DiscoveryResponse");
return;
}
Set<String> toParseResourceNames = null;
if (!(xdsResourceType == XdsListenerResource.getInstance()
|| xdsResourceType == XdsRouteConfigureResource.getInstance())