grpc 1.40.0.pre1 → 1.42.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (1093) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +68 -64
  3. data/etc/roots.pem +335 -326
  4. data/include/grpc/byte_buffer.h +1 -1
  5. data/include/grpc/byte_buffer_reader.h +1 -1
  6. data/include/grpc/event_engine/endpoint_config.h +6 -11
  7. data/include/grpc/event_engine/event_engine.h +131 -86
  8. data/include/grpc/event_engine/internal/memory_allocator_impl.h +98 -0
  9. data/include/grpc/event_engine/memory_allocator.h +210 -0
  10. data/include/grpc/event_engine/port.h +1 -3
  11. data/include/grpc/fork.h +1 -1
  12. data/include/grpc/grpc.h +14 -4
  13. data/include/grpc/grpc_posix.h +5 -2
  14. data/include/grpc/grpc_security.h +18 -0
  15. data/include/grpc/grpc_security_constants.h +1 -0
  16. data/include/grpc/impl/codegen/atm.h +5 -3
  17. data/include/grpc/impl/codegen/atm_gcc_atomic.h +2 -0
  18. data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
  19. data/include/grpc/impl/codegen/atm_windows.h +2 -0
  20. data/include/grpc/impl/codegen/byte_buffer.h +2 -0
  21. data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -0
  22. data/include/grpc/impl/codegen/compression_types.h +2 -0
  23. data/include/grpc/impl/codegen/connectivity_state.h +2 -0
  24. data/include/grpc/impl/codegen/fork.h +2 -0
  25. data/include/grpc/impl/codegen/gpr_slice.h +2 -0
  26. data/include/grpc/impl/codegen/gpr_types.h +2 -0
  27. data/include/grpc/impl/codegen/grpc_types.h +4 -5
  28. data/include/grpc/impl/codegen/log.h +2 -0
  29. data/include/grpc/impl/codegen/port_platform.h +33 -22
  30. data/include/grpc/impl/codegen/propagation_bits.h +2 -0
  31. data/include/grpc/impl/codegen/slice.h +2 -0
  32. data/include/grpc/impl/codegen/status.h +2 -0
  33. data/include/grpc/impl/codegen/sync.h +8 -5
  34. data/include/grpc/impl/codegen/sync_abseil.h +2 -0
  35. data/include/grpc/impl/codegen/sync_custom.h +2 -0
  36. data/include/grpc/impl/codegen/sync_generic.h +3 -0
  37. data/include/grpc/impl/codegen/sync_posix.h +4 -2
  38. data/include/grpc/impl/codegen/sync_windows.h +2 -0
  39. data/include/grpc/slice.h +1 -1
  40. data/include/grpc/status.h +1 -1
  41. data/include/grpc/support/atm.h +1 -1
  42. data/include/grpc/support/atm_gcc_atomic.h +1 -1
  43. data/include/grpc/support/atm_gcc_sync.h +1 -1
  44. data/include/grpc/support/atm_windows.h +1 -1
  45. data/include/grpc/support/log.h +1 -1
  46. data/include/grpc/support/port_platform.h +1 -1
  47. data/include/grpc/support/sync.h +1 -1
  48. data/include/grpc/support/sync_abseil.h +1 -1
  49. data/include/grpc/support/sync_custom.h +1 -1
  50. data/include/grpc/support/sync_generic.h +1 -1
  51. data/include/grpc/support/sync_posix.h +1 -1
  52. data/include/grpc/support/sync_windows.h +1 -1
  53. data/include/grpc/support/time.h +2 -2
  54. data/src/core/ext/filters/census/grpc_context.cc +1 -0
  55. data/src/core/ext/filters/client_channel/backend_metric.cc +18 -20
  56. data/src/core/ext/filters/client_channel/backup_poller.cc +2 -1
  57. data/src/core/ext/filters/client_channel/backup_poller.h +1 -0
  58. data/src/core/ext/filters/client_channel/channel_connectivity.cc +72 -91
  59. data/src/core/ext/filters/client_channel/client_channel.cc +196 -289
  60. data/src/core/ext/filters/client_channel/client_channel.h +75 -28
  61. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +6 -5
  62. data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -1
  63. data/src/core/ext/filters/client_channel/client_channel_factory.cc +2 -1
  64. data/src/core/ext/filters/client_channel/client_channel_factory.h +17 -19
  65. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +16 -15
  66. data/src/core/ext/filters/client_channel/config_selector.cc +2 -1
  67. data/src/core/ext/filters/client_channel/config_selector.h +4 -5
  68. data/src/core/ext/filters/client_channel/connector.h +18 -18
  69. data/src/core/ext/filters/client_channel/dynamic_filters.cc +1 -1
  70. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +0 -1
  71. data/src/core/ext/filters/client_channel/health/health_check_client.cc +19 -17
  72. data/src/core/ext/filters/client_channel/health/health_check_client.h +4 -3
  73. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +8 -7
  74. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +10 -2
  75. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -2
  76. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +6 -15
  77. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +168 -90
  78. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +4 -0
  79. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +1 -1
  80. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -2
  81. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +2 -2
  82. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +2 -2
  83. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +2 -3
  84. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +23 -7
  85. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +29 -33
  86. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +3 -3
  87. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +2502 -0
  88. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +6 -1
  89. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +2 -2
  90. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +9 -9
  91. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +21 -20
  92. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +1 -1
  93. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +15 -7
  94. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +10 -9
  95. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +9 -19
  96. data/src/core/ext/filters/client_channel/lb_policy.h +21 -44
  97. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -0
  98. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -7
  99. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +139 -0
  100. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +13 -15
  101. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -0
  102. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -3
  103. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +9 -8
  104. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +26 -58
  105. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +21 -1
  106. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +7 -2
  107. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +5 -3
  108. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +5 -5
  109. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +82 -76
  110. data/src/core/ext/filters/client_channel/resolver.h +1 -1
  111. data/src/core/ext/filters/client_channel/resolver_factory.h +2 -0
  112. data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -8
  113. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +3 -4
  114. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +1 -1
  115. data/src/core/ext/filters/client_channel/retry_filter.cc +64 -89
  116. data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
  117. data/src/core/ext/filters/client_channel/retry_throttle.cc +17 -48
  118. data/src/core/ext/filters/client_channel/server_address.h +1 -1
  119. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +49 -36
  120. data/src/core/ext/filters/client_channel/subchannel.cc +85 -143
  121. data/src/core/ext/filters/client_channel/subchannel.h +29 -49
  122. data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +22 -7
  123. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +11 -2
  124. data/src/core/ext/filters/client_idle/client_idle_filter.cc +29 -206
  125. data/src/core/ext/filters/client_idle/idle_filter_state.cc +96 -0
  126. data/src/core/ext/filters/client_idle/idle_filter_state.h +66 -0
  127. data/src/core/ext/filters/deadline/deadline_filter.cc +23 -26
  128. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +27 -25
  129. data/src/core/ext/filters/fault_injection/service_config_parser.cc +6 -14
  130. data/src/core/ext/filters/fault_injection/service_config_parser.h +1 -1
  131. data/src/core/ext/filters/http/client/http_client_filter.cc +44 -46
  132. data/src/core/ext/filters/http/client_authority_filter.cc +16 -16
  133. data/src/core/ext/filters/http/http_filters_plugin.cc +53 -71
  134. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +19 -13
  135. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +8 -9
  136. data/src/core/ext/filters/http/server/http_server_filter.cc +77 -72
  137. data/src/core/ext/filters/max_age/max_age_filter.cc +24 -26
  138. data/src/core/ext/filters/message_size/message_size_filter.cc +28 -29
  139. data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
  140. data/src/core/ext/{filters/client_channel → service_config}/service_config.cc +2 -2
  141. data/src/core/ext/{filters/client_channel → service_config}/service_config.h +4 -4
  142. data/src/core/ext/service_config/service_config_call_data.h +72 -0
  143. data/src/core/ext/{filters/client_channel → service_config}/service_config_parser.cc +3 -3
  144. data/src/core/ext/{filters/client_channel → service_config}/service_config_parser.h +8 -6
  145. data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -1
  146. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +29 -15
  147. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +2 -0
  148. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +21 -27
  149. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +10 -6
  150. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +29 -53
  151. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +74 -53
  152. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +0 -1
  153. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +12 -6
  154. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +5 -9
  155. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +3 -1
  156. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -1
  157. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -0
  158. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +83 -88
  159. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +4 -1
  160. data/src/core/ext/transport/chttp2/transport/context_list.h +1 -2
  161. data/src/core/ext/transport/chttp2/transport/flow_control.cc +56 -37
  162. data/src/core/ext/transport/chttp2/transport/flow_control.h +13 -7
  163. data/src/core/ext/transport/chttp2/transport/frame_data.cc +11 -11
  164. data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -0
  165. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +6 -4
  166. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -0
  167. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +6 -5
  168. data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -0
  169. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +5 -8
  170. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -0
  171. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +38 -7
  172. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -0
  173. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +12 -7
  174. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -0
  175. data/src/core/ext/transport/chttp2/transport/hpack_constants.h +41 -0
  176. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +311 -665
  177. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +240 -70
  178. data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +107 -0
  179. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +86 -0
  180. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +69 -0
  181. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +816 -1039
  182. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +75 -177
  183. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +146 -0
  184. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +137 -0
  185. data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +46 -0
  186. data/src/core/{lib/transport/authority_override.h → ext/transport/chttp2/transport/hpack_utils.h} +8 -15
  187. data/src/core/ext/transport/chttp2/transport/internal.h +6 -5
  188. data/src/core/ext/transport/chttp2/transport/parsing.cc +50 -203
  189. data/src/core/ext/transport/chttp2/transport/popularity_count.h +60 -0
  190. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -2
  191. data/src/core/ext/transport/chttp2/transport/varint.cc +7 -3
  192. data/src/core/ext/transport/chttp2/transport/varint.h +39 -28
  193. data/src/core/ext/transport/chttp2/transport/writing.cc +61 -50
  194. data/src/core/ext/transport/inproc/inproc_transport.cc +111 -113
  195. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +96 -96
  196. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +221 -89
  197. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +1 -1
  198. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -1
  199. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +3 -3
  200. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +11 -5
  201. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +48 -48
  202. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +151 -61
  203. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +99 -99
  204. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +171 -69
  205. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +15 -15
  206. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +31 -13
  207. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +164 -131
  208. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +368 -102
  209. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +4 -4
  210. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +11 -5
  211. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +23 -23
  212. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +11 -5
  213. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +28 -28
  214. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +71 -29
  215. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +4 -4
  216. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +11 -5
  217. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +95 -83
  218. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +254 -85
  219. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +24 -24
  220. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +51 -21
  221. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +3 -3
  222. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +11 -5
  223. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +9 -9
  224. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +21 -9
  225. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +62 -62
  226. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +131 -53
  227. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +53 -52
  228. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +96 -33
  229. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +5 -5
  230. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +11 -5
  231. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +71 -66
  232. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +164 -57
  233. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +3 -3
  234. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +11 -5
  235. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +7 -7
  236. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +21 -9
  237. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +8 -8
  238. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +11 -5
  239. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +8 -8
  240. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +11 -5
  241. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +4 -4
  242. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +11 -5
  243. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +16 -16
  244. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +31 -13
  245. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +56 -22
  246. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +174 -17
  247. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +32 -32
  248. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +51 -21
  249. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +3 -3
  250. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +11 -5
  251. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +37 -37
  252. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +61 -25
  253. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +40 -40
  254. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +71 -29
  255. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +9 -9
  256. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +11 -5
  257. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +5 -5
  258. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +21 -9
  259. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +30 -30
  260. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +81 -33
  261. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +41 -29
  262. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +141 -43
  263. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +49 -43
  264. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +105 -29
  265. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +18 -18
  266. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +31 -13
  267. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +286 -279
  268. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +618 -267
  269. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +10 -10
  270. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +31 -13
  271. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +6 -6
  272. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +21 -9
  273. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +3 -3
  274. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +11 -5
  275. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +13 -13
  276. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +51 -21
  277. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +23 -23
  278. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +31 -13
  279. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +9 -9
  280. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +11 -5
  281. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +115 -116
  282. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +191 -77
  283. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +1 -1
  284. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -1
  285. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +46 -32
  286. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +118 -34
  287. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +12 -12
  288. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +31 -13
  289. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +44 -42
  290. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +108 -55
  291. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +2 -2
  292. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +11 -5
  293. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +2 -2
  294. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +11 -5
  295. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +42 -42
  296. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +61 -25
  297. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +2 -2
  298. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +11 -5
  299. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +2 -2
  300. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +11 -5
  301. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +9 -9
  302. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +21 -9
  303. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +2 -2
  304. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +11 -5
  305. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +2 -2
  306. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +11 -5
  307. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +28 -28
  308. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +51 -21
  309. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +8 -8
  310. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +41 -17
  311. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +9 -8
  312. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +25 -9
  313. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +4 -4
  314. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +11 -5
  315. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +4 -4
  316. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +11 -5
  317. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +3 -3
  318. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +11 -5
  319. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +9 -9
  320. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +31 -13
  321. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +10 -10
  322. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +21 -9
  323. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +6 -6
  324. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +21 -9
  325. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +11 -11
  326. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +31 -13
  327. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +15 -15
  328. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +71 -29
  329. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +19 -19
  330. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +51 -21
  331. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +1 -1
  332. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -1
  333. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +6 -6
  334. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +21 -9
  335. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +10 -10
  336. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +31 -13
  337. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +5 -5
  338. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +11 -5
  339. data/src/core/ext/upb-generated/google/api/annotations.upb.c +1 -1
  340. data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -1
  341. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +58 -58
  342. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +111 -45
  343. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +68 -68
  344. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +121 -49
  345. data/src/core/ext/upb-generated/google/api/http.upb.c +18 -18
  346. data/src/core/ext/upb-generated/google/api/http.upb.h +31 -13
  347. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +4 -4
  348. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +11 -5
  349. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +153 -153
  350. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +271 -109
  351. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +4 -4
  352. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +11 -5
  353. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +2 -2
  354. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +11 -5
  355. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +15 -15
  356. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +31 -13
  357. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +4 -4
  358. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +11 -5
  359. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +19 -19
  360. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +91 -37
  361. data/src/core/ext/upb-generated/google/rpc/status.upb.c +5 -5
  362. data/src/core/ext/upb-generated/google/rpc/status.upb.h +11 -5
  363. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +12 -12
  364. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +11 -5
  365. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +60 -60
  366. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +101 -41
  367. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +7 -7
  368. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +21 -9
  369. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +5 -5
  370. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +21 -9
  371. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +31 -31
  372. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +91 -37
  373. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +55 -0
  374. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +154 -0
  375. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +8 -8
  376. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +31 -13
  377. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +4 -6
  378. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +11 -5
  379. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +1 -1
  380. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -1
  381. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +4 -4
  382. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +11 -5
  383. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +3 -3
  384. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +11 -5
  385. data/src/core/ext/upb-generated/validate/validate.upb.c +220 -220
  386. data/src/core/ext/upb-generated/validate/validate.upb.h +231 -93
  387. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +58 -0
  388. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +182 -0
  389. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +4 -4
  390. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +11 -5
  391. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +9 -9
  392. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +21 -9
  393. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +7 -7
  394. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +11 -5
  395. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +6 -6
  396. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +11 -5
  397. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +12 -12
  398. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +21 -9
  399. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +7 -7
  400. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +11 -5
  401. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +58 -0
  402. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +130 -0
  403. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +33 -0
  404. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +83 -0
  405. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +410 -384
  406. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +10 -0
  407. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +101 -88
  408. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +5 -0
  409. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +59 -56
  410. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +59 -46
  411. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +90 -63
  412. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +10 -0
  413. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +30 -19
  414. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
  415. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +801 -783
  416. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +96 -100
  417. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +133 -115
  418. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +5 -0
  419. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +178 -173
  420. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +14 -13
  421. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +103 -103
  422. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +5 -4
  423. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +19 -23
  424. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +4 -3
  425. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +5 -3
  426. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +5 -4
  427. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.c +75 -0
  428. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.h +50 -0
  429. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +13 -12
  430. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +25 -24
  431. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +16 -15
  432. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +17 -16
  433. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +33 -32
  434. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +19 -18
  435. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.c +45 -0
  436. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.h +35 -0
  437. data/src/core/ext/xds/certificate_provider_registry.cc +2 -2
  438. data/src/core/ext/xds/xds_api.cc +1140 -1314
  439. data/src/core/ext/xds/xds_api.h +150 -115
  440. data/src/core/ext/xds/xds_bootstrap.cc +27 -52
  441. data/src/core/ext/xds/xds_bootstrap.h +10 -0
  442. data/src/core/ext/xds/xds_certificate_provider.cc +3 -3
  443. data/src/core/ext/xds/xds_channel_stack_modifier.cc +113 -0
  444. data/src/core/ext/xds/xds_channel_stack_modifier.h +52 -0
  445. data/src/core/ext/xds/xds_client.cc +572 -320
  446. data/src/core/ext/xds/xds_client.h +42 -37
  447. data/src/core/ext/xds/xds_client_stats.cc +16 -15
  448. data/src/core/ext/xds/xds_client_stats.h +7 -7
  449. data/src/core/ext/xds/xds_http_fault_filter.cc +4 -3
  450. data/src/core/ext/xds/xds_http_fault_filter.h +3 -2
  451. data/src/core/ext/xds/xds_http_filters.cc +1 -0
  452. data/src/core/ext/xds/xds_server_config_fetcher.cc +15 -17
  453. data/src/core/lib/address_utils/parse_address.cc +6 -8
  454. data/src/core/lib/address_utils/sockaddr_utils.cc +2 -2
  455. data/src/core/lib/avl/avl.cc +5 -5
  456. data/src/core/lib/backoff/backoff.cc +1 -1
  457. data/src/core/lib/channel/channel_args.cc +26 -7
  458. data/src/core/lib/channel/channel_args.h +9 -0
  459. data/src/core/lib/channel/channel_stack.cc +5 -3
  460. data/src/core/lib/channel/channel_stack_builder.cc +4 -14
  461. data/src/core/lib/channel/channel_stack_builder.h +0 -8
  462. data/src/core/lib/channel/channel_trace.cc +5 -4
  463. data/src/core/lib/channel/channel_trace.h +2 -1
  464. data/src/core/lib/channel/channelz.cc +43 -39
  465. data/src/core/lib/channel/channelz.h +29 -29
  466. data/src/core/lib/channel/channelz_registry.cc +8 -7
  467. data/src/core/lib/channel/channelz_registry.h +1 -1
  468. data/src/core/lib/channel/connected_channel.cc +2 -3
  469. data/src/core/lib/channel/connected_channel.h +1 -2
  470. data/src/core/lib/channel/handshaker.cc +2 -1
  471. data/src/core/lib/channel/handshaker.h +1 -2
  472. data/src/core/lib/channel/handshaker_factory.h +10 -2
  473. data/src/core/lib/channel/handshaker_registry.cc +15 -70
  474. data/src/core/lib/channel/handshaker_registry.h +29 -12
  475. data/src/core/lib/channel/status_util.h +2 -2
  476. data/src/core/lib/compression/algorithm_metadata.h +1 -0
  477. data/src/core/lib/compression/compression.cc +2 -2
  478. data/src/core/lib/compression/compression_args.cc +8 -5
  479. data/src/core/lib/compression/compression_internal.cc +4 -6
  480. data/src/core/lib/compression/compression_internal.h +1 -1
  481. data/src/core/lib/compression/message_compress.cc +2 -2
  482. data/src/core/lib/compression/stream_compression.cc +2 -1
  483. data/src/core/lib/compression/stream_compression.h +2 -1
  484. data/src/core/lib/compression/stream_compression_gzip.cc +2 -1
  485. data/src/core/lib/compression/stream_compression_identity.cc +2 -1
  486. data/src/core/lib/config/core_configuration.cc +96 -0
  487. data/src/core/lib/config/core_configuration.h +146 -0
  488. data/src/core/lib/debug/stats.cc +1 -1
  489. data/src/core/lib/debug/stats.h +1 -0
  490. data/src/core/lib/debug/stats_data.cc +15 -14
  491. data/src/core/lib/debug/stats_data.h +1 -0
  492. data/src/core/lib/debug/trace.cc +1 -0
  493. data/src/core/lib/debug/trace.h +2 -1
  494. data/src/core/lib/event_engine/endpoint_config.cc +0 -1
  495. data/src/core/lib/event_engine/event_engine.cc +3 -3
  496. data/src/core/lib/event_engine/sockaddr.cc +3 -3
  497. data/src/core/lib/gpr/alloc.cc +4 -3
  498. data/src/core/lib/gpr/atm.cc +1 -1
  499. data/src/core/lib/gpr/cpu_posix.cc +1 -1
  500. data/src/core/lib/gpr/env_linux.cc +1 -2
  501. data/src/core/lib/gpr/env_posix.cc +2 -3
  502. data/src/core/lib/gpr/log.cc +3 -3
  503. data/src/core/lib/gpr/log_android.cc +3 -2
  504. data/src/core/lib/gpr/log_linux.cc +7 -4
  505. data/src/core/lib/gpr/log_posix.cc +6 -3
  506. data/src/core/lib/gpr/string.cc +2 -2
  507. data/src/core/lib/gpr/string.h +2 -2
  508. data/src/core/lib/gpr/sync.cc +2 -2
  509. data/src/core/lib/gpr/sync_abseil.cc +7 -6
  510. data/src/core/lib/gpr/sync_posix.cc +3 -3
  511. data/src/core/lib/gpr/time.cc +3 -2
  512. data/src/core/lib/gpr/time_windows.cc +3 -2
  513. data/src/core/lib/gpr/tls.h +119 -40
  514. data/src/core/lib/gpr/tmpfile_posix.cc +1 -2
  515. data/src/core/lib/gpr/useful.h +79 -32
  516. data/src/core/lib/gprpp/arena.cc +2 -1
  517. data/src/core/lib/gprpp/arena.h +15 -5
  518. data/src/core/lib/gprpp/atomic_utils.h +47 -0
  519. data/src/core/lib/gprpp/bitset.h +188 -0
  520. data/src/core/lib/gprpp/chunked_vector.h +211 -0
  521. data/src/core/lib/{transport/authority_override.cc → gprpp/construct_destruct.h} +16 -17
  522. data/src/core/lib/gprpp/dual_ref_counted.h +25 -26
  523. data/src/core/lib/gprpp/fork.cc +14 -12
  524. data/src/core/lib/gprpp/fork.h +4 -4
  525. data/src/core/lib/gprpp/global_config.h +1 -2
  526. data/src/core/lib/gprpp/global_config_env.cc +7 -7
  527. data/src/core/lib/gprpp/global_config_generic.h +2 -2
  528. data/src/core/lib/gprpp/manual_constructor.h +8 -5
  529. data/src/core/lib/gprpp/match.h +73 -0
  530. data/src/core/lib/gprpp/memory.h +9 -3
  531. data/src/core/lib/gprpp/mpscq.cc +7 -7
  532. data/src/core/lib/gprpp/mpscq.h +6 -5
  533. data/src/core/lib/gprpp/orphanable.h +3 -3
  534. data/src/core/lib/gprpp/overload.h +59 -0
  535. data/src/core/lib/gprpp/ref_counted.h +18 -18
  536. data/src/core/lib/gprpp/status_helper.cc +27 -7
  537. data/src/core/lib/gprpp/status_helper.h +12 -1
  538. data/src/core/lib/gprpp/sync.h +3 -1
  539. data/src/core/lib/gprpp/table.h +411 -0
  540. data/src/core/lib/gprpp/thd_posix.cc +5 -5
  541. data/src/core/lib/gprpp/thd_windows.cc +4 -11
  542. data/src/core/lib/gprpp/time_util.cc +2 -2
  543. data/src/core/lib/gprpp/time_util.h +2 -2
  544. data/src/core/lib/http/format_request.cc +1 -0
  545. data/src/core/lib/http/format_request.h +1 -0
  546. data/src/core/lib/http/httpcli.cc +202 -184
  547. data/src/core/lib/http/httpcli.h +3 -0
  548. data/src/core/lib/http/httpcli_security_connector.cc +5 -8
  549. data/src/core/lib/http/parser.cc +2 -2
  550. data/src/core/lib/http/parser.h +1 -0
  551. data/src/core/lib/iomgr/buffer_list.cc +2 -1
  552. data/src/core/lib/iomgr/buffer_list.h +1 -2
  553. data/src/core/lib/iomgr/call_combiner.cc +29 -10
  554. data/src/core/lib/iomgr/cfstream_handle.cc +1 -1
  555. data/src/core/lib/iomgr/combiner.cc +9 -23
  556. data/src/core/lib/iomgr/combiner.h +1 -0
  557. data/src/core/lib/iomgr/dualstack_socket_posix.cc +1 -0
  558. data/src/core/lib/iomgr/endpoint.cc +0 -4
  559. data/src/core/lib/iomgr/endpoint.h +1 -3
  560. data/src/core/lib/iomgr/endpoint_cfstream.cc +16 -26
  561. data/src/core/lib/iomgr/endpoint_cfstream.h +1 -1
  562. data/src/core/lib/iomgr/endpoint_pair.h +1 -0
  563. data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +1 -2
  564. data/src/core/lib/iomgr/endpoint_pair_posix.cc +15 -11
  565. data/src/core/lib/iomgr/endpoint_pair_windows.cc +17 -9
  566. data/src/core/lib/iomgr/error.cc +113 -52
  567. data/src/core/lib/iomgr/error.h +73 -18
  568. data/src/core/lib/iomgr/error_cfstream.cc +7 -2
  569. data/src/core/lib/iomgr/error_internal.h +1 -0
  570. data/src/core/lib/iomgr/ev_epoll1_linux.cc +17 -24
  571. data/src/core/lib/iomgr/ev_epollex_linux.cc +22 -29
  572. data/src/core/lib/iomgr/ev_poll_posix.cc +42 -45
  573. data/src/core/lib/iomgr/ev_posix.cc +1 -2
  574. data/src/core/lib/iomgr/event_engine/closure.cc +41 -18
  575. data/src/core/lib/iomgr/event_engine/closure.h +10 -1
  576. data/src/core/lib/iomgr/event_engine/endpoint.cc +6 -25
  577. data/src/core/lib/iomgr/event_engine/endpoint.h +1 -2
  578. data/src/core/lib/iomgr/event_engine/iomgr.cc +18 -19
  579. data/src/core/lib/iomgr/event_engine/iomgr.h +20 -2
  580. data/src/core/lib/iomgr/event_engine/pollset.cc +5 -4
  581. data/src/core/lib/iomgr/event_engine/resolver.cc +12 -8
  582. data/src/core/lib/iomgr/event_engine/tcp.cc +60 -30
  583. data/src/core/lib/iomgr/event_engine/timer.cc +7 -2
  584. data/src/core/lib/iomgr/exec_ctx.cc +4 -13
  585. data/src/core/lib/iomgr/exec_ctx.h +11 -19
  586. data/src/core/lib/iomgr/executor/mpmcqueue.cc +15 -16
  587. data/src/core/lib/iomgr/executor/mpmcqueue.h +7 -11
  588. data/src/core/lib/iomgr/executor/threadpool.cc +2 -2
  589. data/src/core/lib/iomgr/executor/threadpool.h +2 -1
  590. data/src/core/lib/iomgr/executor.cc +11 -26
  591. data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +2 -2
  592. data/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc +2 -2
  593. data/src/core/lib/iomgr/internal_errqueue.cc +3 -2
  594. data/src/core/lib/iomgr/iocp_windows.cc +1 -0
  595. data/src/core/lib/iomgr/iomgr.cc +3 -1
  596. data/src/core/lib/iomgr/iomgr.h +2 -2
  597. data/src/core/lib/iomgr/iomgr_custom.cc +2 -2
  598. data/src/core/lib/iomgr/iomgr_custom.h +2 -2
  599. data/src/core/lib/iomgr/iomgr_internal.cc +6 -10
  600. data/src/core/lib/iomgr/iomgr_internal.h +3 -2
  601. data/src/core/lib/iomgr/iomgr_windows.cc +1 -2
  602. data/src/core/lib/iomgr/is_epollexclusive_available.cc +4 -4
  603. data/src/core/lib/iomgr/load_file.cc +2 -2
  604. data/src/core/lib/iomgr/lockfree_event.cc +18 -0
  605. data/src/core/lib/iomgr/polling_entity.cc +2 -2
  606. data/src/core/lib/iomgr/pollset_custom.cc +4 -5
  607. data/src/core/lib/iomgr/pollset_custom.h +3 -3
  608. data/src/core/lib/iomgr/pollset_set_custom.cc +1 -2
  609. data/src/core/lib/iomgr/pollset_set_windows.cc +1 -0
  610. data/src/core/lib/iomgr/port.h +0 -5
  611. data/src/core/lib/iomgr/python_util.h +1 -0
  612. data/src/core/lib/iomgr/resolve_address.cc +2 -1
  613. data/src/core/lib/iomgr/resolve_address.h +0 -4
  614. data/src/core/lib/iomgr/resolve_address_custom.cc +4 -4
  615. data/src/core/lib/iomgr/resolve_address_custom.h +0 -1
  616. data/src/core/lib/iomgr/resolve_address_posix.cc +7 -11
  617. data/src/core/lib/iomgr/resolve_address_windows.cc +6 -8
  618. data/src/core/lib/iomgr/resource_quota.cc +136 -49
  619. data/src/core/lib/iomgr/resource_quota.h +66 -17
  620. data/src/core/lib/iomgr/sockaddr.h +1 -1
  621. data/src/core/lib/iomgr/socket_factory_posix.cc +5 -5
  622. data/src/core/lib/iomgr/socket_factory_posix.h +1 -0
  623. data/src/core/lib/iomgr/socket_mutator.cc +2 -2
  624. data/src/core/lib/iomgr/socket_mutator.h +2 -2
  625. data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -5
  626. data/src/core/lib/iomgr/socket_utils_linux.cc +4 -4
  627. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -2
  628. data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
  629. data/src/core/lib/iomgr/socket_utils_windows.cc +2 -2
  630. data/src/core/lib/iomgr/tcp_client.cc +4 -2
  631. data/src/core/lib/iomgr/tcp_client.h +4 -0
  632. data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -22
  633. data/src/core/lib/iomgr/tcp_client_custom.cc +10 -18
  634. data/src/core/lib/iomgr/tcp_client_posix.cc +33 -27
  635. data/src/core/lib/iomgr/tcp_client_posix.h +5 -2
  636. data/src/core/lib/iomgr/tcp_client_windows.cc +16 -9
  637. data/src/core/lib/iomgr/tcp_custom.cc +11 -23
  638. data/src/core/lib/iomgr/tcp_custom.h +2 -1
  639. data/src/core/lib/iomgr/tcp_posix.cc +33 -64
  640. data/src/core/lib/iomgr/tcp_posix.h +11 -12
  641. data/src/core/lib/iomgr/tcp_server.cc +6 -4
  642. data/src/core/lib/iomgr/tcp_server.h +12 -9
  643. data/src/core/lib/iomgr/tcp_server_custom.cc +17 -34
  644. data/src/core/lib/iomgr/tcp_server_posix.cc +23 -17
  645. data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
  646. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -2
  647. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +3 -4
  648. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +4 -4
  649. data/src/core/lib/iomgr/tcp_server_windows.cc +17 -14
  650. data/src/core/lib/iomgr/tcp_windows.cc +8 -27
  651. data/src/core/lib/iomgr/tcp_windows.h +2 -1
  652. data/src/core/lib/iomgr/timer.cc +1 -0
  653. data/src/core/lib/iomgr/timer.h +1 -2
  654. data/src/core/lib/iomgr/timer_custom.cc +2 -2
  655. data/src/core/lib/iomgr/timer_generic.cc +21 -51
  656. data/src/core/lib/iomgr/timer_generic.h +1 -0
  657. data/src/core/lib/iomgr/timer_heap.cc +2 -3
  658. data/src/core/lib/iomgr/unix_sockets_posix.cc +3 -5
  659. data/src/core/lib/iomgr/unix_sockets_posix.h +2 -3
  660. data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -0
  661. data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -3
  662. data/src/core/lib/iomgr/wakeup_fd_posix.cc +1 -0
  663. data/src/core/lib/iomgr/work_serializer.cc +4 -4
  664. data/src/core/lib/iomgr/work_serializer.h +1 -1
  665. data/src/core/lib/json/json_reader.cc +9 -17
  666. data/src/core/lib/json/json_util.cc +68 -0
  667. data/src/core/lib/json/json_util.h +65 -115
  668. data/src/core/lib/json/json_writer.cc +0 -3
  669. data/src/core/lib/matchers/matchers.h +0 -1
  670. data/src/core/lib/profiling/basic_timers.cc +8 -6
  671. data/src/core/lib/profiling/stap_timers.cc +2 -2
  672. data/src/core/lib/security/authorization/authorization_policy_provider.h +5 -4
  673. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +1 -1
  674. data/src/core/lib/security/authorization/evaluate_args.cc +16 -12
  675. data/src/core/lib/security/authorization/sdk_server_authz_filter.cc +171 -0
  676. data/src/core/lib/security/authorization/sdk_server_authz_filter.h +67 -0
  677. data/src/core/lib/security/context/security_context.cc +11 -8
  678. data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +2 -2
  679. data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
  680. data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +2 -2
  681. data/src/core/lib/security/credentials/composite/composite_credentials.cc +5 -4
  682. data/src/core/lib/security/credentials/credentials.cc +10 -8
  683. data/src/core/lib/security/credentials/credentials.h +7 -2
  684. data/src/core/lib/security/credentials/credentials_metadata.cc +2 -3
  685. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +13 -26
  686. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +1 -2
  687. data/src/core/lib/security/credentials/external/aws_request_signer.cc +3 -3
  688. data/src/core/lib/security/credentials/external/external_account_credentials.cc +60 -33
  689. data/src/core/lib/security/credentials/external/external_account_credentials.h +1 -0
  690. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +2 -4
  691. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +1 -2
  692. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +56 -4
  693. data/src/core/lib/security/credentials/iam/iam_credentials.cc +2 -1
  694. data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
  695. data/src/core/lib/security/credentials/jwt/json_token.h +2 -1
  696. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +31 -14
  697. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -3
  698. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +5 -11
  699. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +3 -3
  700. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +3 -7
  701. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -0
  702. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +4 -6
  703. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +4 -4
  704. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +0 -1
  705. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +3 -2
  706. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +10 -6
  707. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +2 -1
  708. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +7 -5
  709. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +2 -2
  710. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +6 -8
  711. data/src/core/lib/security/security_connector/load_system_roots_fallback.cc +1 -0
  712. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -3
  713. data/src/core/lib/security/security_connector/security_connector.cc +9 -4
  714. data/src/core/lib/security/security_connector/security_connector.h +1 -1
  715. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -7
  716. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -2
  717. data/src/core/lib/security/security_connector/ssl_utils.cc +3 -4
  718. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +10 -14
  719. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +0 -2
  720. data/src/core/lib/security/transport/auth_filters.h +1 -0
  721. data/src/core/lib/security/transport/client_auth_filter.cc +9 -11
  722. data/src/core/lib/security/transport/secure_endpoint.cc +4 -14
  723. data/src/core/lib/security/transport/secure_endpoint.h +1 -0
  724. data/src/core/lib/security/transport/security_handshaker.cc +78 -47
  725. data/src/core/lib/security/transport/security_handshaker.h +2 -1
  726. data/src/core/lib/security/transport/server_auth_filter.cc +3 -5
  727. data/src/core/lib/security/transport/tsi_error.cc +3 -5
  728. data/src/core/lib/security/util/json_util.cc +6 -8
  729. data/src/core/lib/slice/percent_encoding.cc +73 -30
  730. data/src/core/lib/slice/percent_encoding.h +29 -28
  731. data/src/core/lib/slice/slice.cc +14 -21
  732. data/src/core/lib/{gpr/tls_pthread.cc → slice/slice_api.cc} +15 -6
  733. data/src/core/lib/slice/slice_buffer.cc +6 -7
  734. data/src/core/lib/slice/slice_intern.cc +10 -16
  735. data/src/core/lib/slice/slice_internal.h +3 -246
  736. data/src/core/lib/slice/slice_refcount.cc +17 -0
  737. data/src/core/lib/slice/slice_refcount.h +121 -0
  738. data/src/core/lib/slice/slice_refcount_base.h +173 -0
  739. data/src/core/lib/slice/slice_split.cc +100 -0
  740. data/src/core/lib/slice/slice_split.h +40 -0
  741. data/src/core/lib/slice/slice_string_helpers.cc +0 -83
  742. data/src/core/lib/slice/slice_string_helpers.h +0 -11
  743. data/src/core/lib/slice/static_slice.cc +529 -0
  744. data/src/core/lib/slice/static_slice.h +331 -0
  745. data/src/core/lib/surface/api_trace.cc +2 -1
  746. data/src/core/lib/surface/api_trace.h +1 -0
  747. data/src/core/lib/surface/builtins.cc +49 -0
  748. data/src/core/{ext/filters/workarounds/workaround_cronet_compression_filter.h → lib/surface/builtins.h} +8 -9
  749. data/src/core/lib/surface/byte_buffer_reader.cc +1 -1
  750. data/src/core/lib/surface/call.cc +112 -128
  751. data/src/core/lib/surface/call.h +3 -9
  752. data/src/core/lib/surface/call_details.cc +2 -2
  753. data/src/core/lib/surface/call_log_batch.cc +2 -2
  754. data/src/core/lib/surface/channel.cc +41 -41
  755. data/src/core/lib/surface/channel.h +14 -11
  756. data/src/core/lib/surface/channel_init.cc +23 -76
  757. data/src/core/lib/surface/channel_init.h +52 -44
  758. data/src/core/lib/surface/channel_ping.cc +1 -2
  759. data/src/core/lib/surface/channel_stack_type.cc +2 -1
  760. data/src/core/lib/surface/completion_queue.cc +60 -69
  761. data/src/core/lib/surface/completion_queue_factory.cc +2 -1
  762. data/src/core/lib/surface/completion_queue_factory.h +1 -0
  763. data/src/core/lib/surface/event_string.cc +1 -0
  764. data/src/core/lib/surface/init.cc +4 -48
  765. data/src/core/lib/surface/init.h +0 -1
  766. data/src/core/lib/surface/init_secure.cc +36 -14
  767. data/src/core/lib/surface/lame_client.cc +24 -16
  768. data/src/core/lib/surface/lame_client.h +1 -1
  769. data/src/core/lib/surface/metadata_array.cc +2 -2
  770. data/src/core/lib/surface/server.cc +42 -50
  771. data/src/core/lib/surface/server.h +28 -23
  772. data/src/core/lib/surface/validate_metadata.cc +49 -18
  773. data/src/core/lib/surface/version.cc +2 -2
  774. data/src/core/lib/transport/bdp_estimator.cc +1 -1
  775. data/src/core/lib/transport/byte_stream.h +1 -0
  776. data/src/core/lib/transport/connectivity_state.cc +8 -5
  777. data/src/core/lib/transport/connectivity_state.h +2 -2
  778. data/src/core/lib/transport/error_utils.cc +43 -17
  779. data/src/core/lib/transport/error_utils.h +1 -1
  780. data/src/core/lib/transport/metadata.cc +41 -20
  781. data/src/core/lib/transport/metadata.h +15 -12
  782. data/src/core/lib/transport/metadata_batch.cc +39 -364
  783. data/src/core/lib/transport/metadata_batch.h +916 -67
  784. data/src/core/lib/transport/parsed_metadata.h +263 -0
  785. data/src/core/lib/transport/pid_controller.cc +4 -4
  786. data/src/core/lib/transport/static_metadata.cc +714 -846
  787. data/src/core/lib/transport/static_metadata.h +115 -379
  788. data/src/core/lib/transport/status_metadata.cc +1 -0
  789. data/src/core/lib/transport/transport.cc +4 -5
  790. data/src/core/lib/transport/transport_op_string.cc +40 -20
  791. data/src/core/plugin_registry/grpc_plugin_registry.cc +76 -41
  792. data/src/core/tsi/alts/crypt/aes_gcm.cc +6 -3
  793. data/src/core/tsi/alts/crypt/gsec.h +2 -3
  794. data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +13 -12
  795. data/src/core/tsi/alts/frame_protector/frame_handler.cc +10 -11
  796. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -4
  797. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +2 -3
  798. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +12 -2
  799. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +2 -2
  800. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +1 -1
  801. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +2 -2
  802. data/src/core/tsi/fake_transport_security.cc +15 -7
  803. data/src/core/tsi/local_transport_security.cc +36 -73
  804. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +20 -53
  805. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -3
  806. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +2 -2
  807. data/src/core/tsi/ssl_transport_security.cc +21 -11
  808. data/src/core/tsi/ssl_transport_security.h +3 -1
  809. data/src/core/tsi/transport_security.cc +15 -3
  810. data/src/core/tsi/transport_security.h +16 -1
  811. data/src/core/tsi/transport_security_grpc.h +1 -0
  812. data/src/core/tsi/transport_security_interface.h +26 -0
  813. data/src/ruby/ext/grpc/extconf.rb +12 -9
  814. data/src/ruby/ext/grpc/rb_byte_buffer.c +2 -1
  815. data/src/ruby/ext/grpc/rb_call.c +5 -5
  816. data/src/ruby/ext/grpc/rb_call_credentials.c +5 -5
  817. data/src/ruby/ext/grpc/rb_channel.c +10 -8
  818. data/src/ruby/ext/grpc/rb_channel_args.c +2 -2
  819. data/src/ruby/ext/grpc/rb_channel_credentials.c +4 -4
  820. data/src/ruby/ext/grpc/rb_channel_credentials.h +1 -0
  821. data/src/ruby/ext/grpc/rb_completion_queue.c +3 -2
  822. data/src/ruby/ext/grpc/rb_compression_options.c +5 -4
  823. data/src/ruby/ext/grpc/rb_event_thread.c +4 -4
  824. data/src/ruby/ext/grpc/rb_grpc.c +5 -4
  825. data/src/ruby/ext/grpc/rb_grpc.h +1 -0
  826. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  827. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  828. data/src/ruby/ext/grpc/rb_server.c +6 -5
  829. data/src/ruby/ext/grpc/rb_server_credentials.c +3 -3
  830. data/src/ruby/ext/grpc/rb_server_credentials.h +1 -0
  831. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +8 -5
  832. data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +3 -1
  833. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +6 -5
  834. data/src/ruby/ext/grpc/rb_xds_server_credentials.h +3 -1
  835. data/src/ruby/lib/grpc/version.rb +1 -1
  836. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -2
  837. data/src/ruby/spec/client_server_spec.rb +1 -1
  838. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +4 -4
  839. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +11 -6
  840. data/third_party/address_sorting/address_sorting_posix.c +1 -0
  841. data/third_party/boringssl-with-bazel/err_data.c +300 -292
  842. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +52 -47
  843. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +21 -22
  844. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +0 -2
  845. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +6 -1
  846. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +16 -23
  847. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +14 -7
  848. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_print.c +19 -29
  849. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/a_strex.c +269 -272
  850. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +106 -153
  851. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +3 -3
  852. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
  853. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +1 -40
  854. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utf8.c +1 -1
  855. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.c +1 -1
  856. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/charmap.h +0 -0
  857. data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_locl.h → internal.h} +58 -1
  858. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +9 -9
  859. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +290 -199
  860. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +9 -9
  861. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +10 -14
  862. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +2 -1
  863. data/third_party/boringssl-with-bazel/src/crypto/asn1/time_support.c +1 -1
  864. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +11 -8
  865. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +1 -7
  866. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +1 -5
  867. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +0 -4
  868. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +1 -7
  869. data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +1 -6
  870. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +3 -17
  871. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +4 -6
  872. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbb.c +9 -0
  873. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +8 -0
  874. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +38 -47
  875. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +45 -65
  876. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +14 -3
  877. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +6 -3
  878. data/third_party/boringssl-with-bazel/src/crypto/evp/scrypt.c +32 -34
  879. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +26 -9
  880. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.c +3 -2
  881. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +5 -2
  882. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/sqrt.c +5 -9
  883. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +10 -0
  884. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/des.c +10 -11
  885. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/internal.h +1 -3
  886. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
  887. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +4 -7
  888. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +4 -7
  889. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +1 -1
  890. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +5 -9
  891. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +2 -2
  892. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +4 -6
  893. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +24 -9
  894. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +4 -2
  895. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +35 -35
  896. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +11 -10
  897. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +10 -37
  898. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +34 -0
  899. data/third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c +219 -121
  900. data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +9 -2
  901. data/third_party/boringssl-with-bazel/src/crypto/internal.h +62 -2
  902. data/third_party/boringssl-with-bazel/src/crypto/lhash/internal.h +253 -0
  903. data/third_party/boringssl-with-bazel/src/crypto/lhash/lhash.c +28 -23
  904. data/third_party/boringssl-with-bazel/src/crypto/mem.c +14 -9
  905. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +7 -3
  906. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +0 -9
  907. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_info.c +0 -2
  908. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +0 -8
  909. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +0 -2
  910. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +0 -4
  911. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +16 -7
  912. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +9 -4
  913. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +151 -12
  914. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
  915. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +1 -1
  916. data/third_party/boringssl-with-bazel/src/crypto/pool/pool.c +1 -0
  917. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +4 -0
  918. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/fuchsia.c +4 -0
  919. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +4 -0
  920. data/third_party/boringssl-with-bazel/src/crypto/siphash/siphash.c +6 -6
  921. data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.c +15 -11
  922. data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +1 -1
  923. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +1 -0
  924. data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +2 -0
  925. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +225 -2
  926. data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +246 -0
  927. data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +15 -4
  928. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +10 -5
  929. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +0 -179
  930. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +4 -2
  931. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +6 -23
  932. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +2 -2
  933. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +1 -5
  934. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -0
  935. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +25 -22
  936. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +11 -54
  937. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +1 -1
  938. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +1 -0
  939. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +2 -4
  940. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +1 -3
  941. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +0 -16
  942. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +9 -11
  943. data/third_party/boringssl-with-bazel/src/crypto/x509/x_exten.c +2 -0
  944. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +23 -21
  945. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +12 -11
  946. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +16 -0
  947. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +1 -0
  948. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +1 -1
  949. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_int.h +1 -1
  950. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_map.c +1 -0
  951. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +4 -3
  952. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +24 -5
  953. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +17 -8
  954. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -0
  955. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +1 -0
  956. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +6 -6
  957. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_crld.c +4 -2
  958. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +5 -0
  959. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -0
  960. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ncons.c +112 -55
  961. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pci.c +2 -1
  962. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -13
  963. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -1
  964. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +76 -31
  965. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +521 -296
  966. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +2 -9
  967. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +10 -5
  968. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +3 -1
  969. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +3 -3
  970. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +9 -0
  971. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +8 -2
  972. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +8 -5
  973. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +3 -0
  974. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +6 -0
  975. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +4 -0
  976. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +25 -0
  977. data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +14 -12
  978. data/third_party/boringssl-with-bazel/src/include/openssl/lhash.h +4 -205
  979. data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +12 -3
  980. data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +5 -4
  981. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -20
  982. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +12 -5
  983. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +5 -0
  984. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +37 -15
  985. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +81 -15
  986. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +31 -32
  987. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +713 -146
  988. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +16 -695
  989. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +48 -13
  990. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +9 -16
  991. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +310 -359
  992. data/third_party/boringssl-with-bazel/src/ssl/{t1_lib.cc → extensions.cc} +110 -159
  993. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +24 -13
  994. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +145 -142
  995. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +106 -99
  996. data/third_party/boringssl-with-bazel/src/ssl/internal.h +87 -48
  997. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +1 -2
  998. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
  999. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +11 -5
  1000. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +2 -51
  1001. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +121 -65
  1002. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +6 -12
  1003. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +28 -23
  1004. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +14 -27
  1005. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +210 -212
  1006. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +30 -41
  1007. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +48 -34
  1008. data/third_party/re2/re2/compile.cc +91 -109
  1009. data/third_party/re2/re2/dfa.cc +27 -39
  1010. data/third_party/re2/re2/filtered_re2.cc +18 -2
  1011. data/third_party/re2/re2/filtered_re2.h +10 -5
  1012. data/third_party/re2/re2/nfa.cc +1 -1
  1013. data/third_party/re2/re2/parse.cc +42 -23
  1014. data/third_party/re2/re2/perl_groups.cc +34 -34
  1015. data/third_party/re2/re2/prefilter.cc +3 -2
  1016. data/third_party/re2/re2/prog.cc +182 -4
  1017. data/third_party/re2/re2/prog.h +28 -9
  1018. data/third_party/re2/re2/re2.cc +87 -118
  1019. data/third_party/re2/re2/re2.h +156 -141
  1020. data/third_party/re2/re2/regexp.cc +12 -5
  1021. data/third_party/re2/re2/regexp.h +8 -2
  1022. data/third_party/re2/re2/set.cc +31 -9
  1023. data/third_party/re2/re2/set.h +9 -4
  1024. data/third_party/re2/re2/simplify.cc +11 -3
  1025. data/third_party/re2/re2/tostring.cc +1 -1
  1026. data/third_party/re2/re2/walker-inl.h +1 -1
  1027. data/third_party/re2/util/mutex.h +2 -2
  1028. data/third_party/re2/util/pcre.h +3 -3
  1029. data/third_party/upb/upb/decode.c +129 -60
  1030. data/third_party/upb/upb/decode.h +32 -4
  1031. data/third_party/upb/upb/decode_fast.c +513 -500
  1032. data/third_party/upb/upb/decode_fast.h +27 -0
  1033. data/third_party/upb/upb/{decode.int.h → decode_internal.h} +38 -8
  1034. data/third_party/upb/upb/def.c +171 -181
  1035. data/third_party/upb/upb/def.h +41 -19
  1036. data/third_party/upb/upb/def.hpp +29 -0
  1037. data/third_party/upb/upb/encode.c +49 -16
  1038. data/third_party/upb/upb/encode.h +29 -2
  1039. data/third_party/upb/upb/msg.c +169 -28
  1040. data/third_party/upb/upb/msg.h +75 -580
  1041. data/third_party/upb/upb/msg_internal.h +687 -0
  1042. data/third_party/upb/upb/port_def.inc +85 -24
  1043. data/third_party/upb/upb/port_undef.inc +38 -1
  1044. data/third_party/upb/upb/reflection.c +29 -37
  1045. data/third_party/upb/upb/reflection.h +36 -8
  1046. data/third_party/upb/upb/reflection.hpp +37 -0
  1047. data/third_party/upb/upb/table.c +211 -86
  1048. data/third_party/upb/upb/{table.int.h → table_internal.h} +56 -180
  1049. data/third_party/upb/upb/text_encode.c +32 -4
  1050. data/third_party/upb/upb/text_encode.h +26 -0
  1051. data/third_party/upb/upb/upb.c +59 -8
  1052. data/third_party/upb/upb/upb.h +36 -6
  1053. data/third_party/upb/upb/upb.hpp +24 -0
  1054. data/third_party/upb/upb/upb_internal.h +58 -0
  1055. metadata +102 -87
  1056. data/include/grpc/event_engine/slice_allocator.h +0 -66
  1057. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +0 -179
  1058. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +0 -38
  1059. data/src/core/ext/filters/client_channel/service_config_call_data.h +0 -126
  1060. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +0 -211
  1061. data/src/core/ext/filters/workarounds/workaround_utils.cc +0 -53
  1062. data/src/core/ext/filters/workarounds/workaround_utils.h +0 -39
  1063. data/src/core/ext/transport/chttp2/client/authority.cc +0 -42
  1064. data/src/core/ext/transport/chttp2/client/authority.h +0 -36
  1065. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.cc +0 -66
  1066. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +0 -74
  1067. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +0 -243
  1068. data/src/core/ext/transport/chttp2/transport/hpack_table.h +0 -148
  1069. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +0 -66
  1070. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +0 -58
  1071. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +0 -58
  1072. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +0 -124
  1073. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +0 -33
  1074. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +0 -77
  1075. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +0 -44
  1076. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +0 -35
  1077. data/src/core/lib/gpr/tls_gcc.h +0 -52
  1078. data/src/core/lib/gpr/tls_msvc.h +0 -54
  1079. data/src/core/lib/gpr/tls_pthread.h +0 -56
  1080. data/src/core/lib/gpr/tls_stdcpp.h +0 -48
  1081. data/src/core/lib/gprpp/atomic.h +0 -104
  1082. data/src/core/lib/iomgr/endpoint_pair_uv.cc +0 -40
  1083. data/src/core/lib/iomgr/iomgr_uv.cc +0 -43
  1084. data/src/core/lib/iomgr/pollset_uv.cc +0 -95
  1085. data/src/core/lib/iomgr/pollset_uv.h +0 -36
  1086. data/src/core/lib/iomgr/sockaddr_custom.h +0 -54
  1087. data/src/core/lib/iomgr/socket_utils_uv.cc +0 -49
  1088. data/src/core/lib/iomgr/tcp_uv.cc +0 -421
  1089. data/src/core/lib/iomgr/timer_uv.cc +0 -66
  1090. data/src/core/lib/iomgr/udp_server.cc +0 -748
  1091. data/src/core/lib/iomgr/udp_server.h +0 -103
  1092. data/third_party/upb/third_party/wyhash/wyhash.h +0 -145
  1093. data/third_party/upb/upb/upb.int.h +0 -29
@@ -16,6 +16,8 @@
16
16
 
17
17
  #include <grpc/support/port_platform.h>
18
18
 
19
+ #include "src/core/ext/xds/xds_client.h"
20
+
19
21
  #include <inttypes.h>
20
22
  #include <limits.h>
21
23
  #include <string.h>
@@ -31,11 +33,9 @@
31
33
  #include <grpc/support/time.h>
32
34
 
33
35
  #include "src/core/ext/filters/client_channel/client_channel.h"
34
- #include "src/core/ext/filters/client_channel/service_config.h"
35
36
  #include "src/core/ext/xds/xds_api.h"
36
37
  #include "src/core/ext/xds/xds_bootstrap.h"
37
38
  #include "src/core/ext/xds/xds_channel_args.h"
38
- #include "src/core/ext/xds/xds_client.h"
39
39
  #include "src/core/ext/xds/xds_client_stats.h"
40
40
  #include "src/core/ext/xds/xds_http_filters.h"
41
41
  #include "src/core/lib/address_utils/sockaddr_utils.h"
@@ -54,8 +54,8 @@
54
54
  #include "src/core/lib/slice/slice_string_helpers.h"
55
55
  #include "src/core/lib/surface/call.h"
56
56
  #include "src/core/lib/surface/channel.h"
57
- #include "src/core/lib/surface/channel_init.h"
58
57
  #include "src/core/lib/transport/static_metadata.h"
58
+ #include "src/core/lib/uri/uri_parser.h"
59
59
 
60
60
  #define GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS 1
61
61
  #define GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER 1.6
@@ -71,6 +71,7 @@ TraceFlag grpc_xds_client_refcount_trace(false, "xds_client_refcount");
71
71
  namespace {
72
72
 
73
73
  Mutex* g_mu = nullptr;
74
+
74
75
  const grpc_channel_args* g_channel_args ABSL_GUARDED_BY(*g_mu) = nullptr;
75
76
  XdsClient* g_xds_client ABSL_GUARDED_BY(*g_mu) = nullptr;
76
77
  char* g_fallback_bootstrap_config ABSL_GUARDED_BY(*g_mu) = nullptr;
@@ -87,7 +88,7 @@ template <typename T>
87
88
  class XdsClient::ChannelState::RetryableCall
88
89
  : public InternallyRefCounted<RetryableCall<T>> {
89
90
  public:
90
- explicit RetryableCall(RefCountedPtr<ChannelState> chand);
91
+ explicit RetryableCall(WeakRefCountedPtr<ChannelState> chand);
91
92
 
92
93
  void Orphan() override;
93
94
 
@@ -108,7 +109,7 @@ class XdsClient::ChannelState::RetryableCall
108
109
  // every time we start a new call. It's null during call retry backoff.
109
110
  OrphanablePtr<T> calld_;
110
111
  // The owning xds channel.
111
- RefCountedPtr<ChannelState> chand_;
112
+ WeakRefCountedPtr<ChannelState> chand_;
112
113
 
113
114
  // Retry state.
114
115
  BackOff backoff_;
@@ -134,9 +135,11 @@ class XdsClient::ChannelState::AdsCallState
134
135
  XdsClient* xds_client() const { return chand()->xds_client(); }
135
136
  bool seen_response() const { return seen_response_; }
136
137
 
137
- void SubscribeLocked(const std::string& type_url, const std::string& name)
138
+ void SubscribeLocked(const std::string& type_url,
139
+ const XdsApi::ResourceName& resource)
138
140
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
139
- void UnsubscribeLocked(const std::string& type_url, const std::string& name,
141
+ void UnsubscribeLocked(const std::string& type_url,
142
+ const XdsApi::ResourceName& resource,
140
143
  bool delay_unsubscription)
141
144
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
142
145
 
@@ -145,10 +148,11 @@ class XdsClient::ChannelState::AdsCallState
145
148
  private:
146
149
  class ResourceState : public InternallyRefCounted<ResourceState> {
147
150
  public:
148
- ResourceState(const std::string& type_url, const std::string& name,
151
+ ResourceState(const std::string& type_url,
152
+ const XdsApi::ResourceName& resource,
149
153
  bool sent_initial_request)
150
154
  : type_url_(type_url),
151
- name_(name),
155
+ resource_(resource),
152
156
  sent_initial_request_(sent_initial_request) {
153
157
  GRPC_CLOSURE_INIT(&timer_callback_, OnTimer, this,
154
158
  grpc_schedule_on_exec_ctx);
@@ -193,38 +197,41 @@ class XdsClient::ChannelState::AdsCallState
193
197
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
194
198
  if (error == GRPC_ERROR_NONE && timer_pending_) {
195
199
  timer_pending_ = false;
196
- grpc_error_handle watcher_error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
197
- absl::StrFormat(
200
+ grpc_error_handle watcher_error =
201
+ GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrFormat(
198
202
  "timeout obtaining resource {type=%s name=%s} from xds server",
199
- type_url_, name_)
200
- .c_str());
203
+ type_url_,
204
+ XdsApi::ConstructFullResourceName(resource_.authority,
205
+ type_url_, resource_.id)));
201
206
  watcher_error = grpc_error_set_int(
202
207
  watcher_error, GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
203
208
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
204
209
  gpr_log(GPR_INFO, "[xds_client %p] %s", ads_calld_->xds_client(),
205
210
  grpc_error_std_string(watcher_error).c_str());
206
211
  }
212
+ auto& authority_state =
213
+ ads_calld_->xds_client()->authority_state_map_[resource_.authority];
207
214
  if (type_url_ == XdsApi::kLdsTypeUrl) {
208
- ListenerState& state = ads_calld_->xds_client()->listener_map_[name_];
215
+ ListenerState& state = authority_state.listener_map[resource_.id];
209
216
  state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
210
217
  for (const auto& p : state.watchers) {
211
218
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
212
219
  }
213
220
  } else if (type_url_ == XdsApi::kRdsTypeUrl) {
214
221
  RouteConfigState& state =
215
- ads_calld_->xds_client()->route_config_map_[name_];
222
+ authority_state.route_config_map[resource_.id];
216
223
  state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
217
224
  for (const auto& p : state.watchers) {
218
225
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
219
226
  }
220
227
  } else if (type_url_ == XdsApi::kCdsTypeUrl) {
221
- ClusterState& state = ads_calld_->xds_client()->cluster_map_[name_];
228
+ ClusterState& state = authority_state.cluster_map[resource_.id];
222
229
  state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
223
230
  for (const auto& p : state.watchers) {
224
231
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
225
232
  }
226
233
  } else if (type_url_ == XdsApi::kEdsTypeUrl) {
227
- EndpointState& state = ads_calld_->xds_client()->endpoint_map_[name_];
234
+ EndpointState& state = authority_state.endpoint_map[resource_.id];
228
235
  state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
229
236
  for (const auto& p : state.watchers) {
230
237
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
@@ -238,7 +245,7 @@ class XdsClient::ChannelState::AdsCallState
238
245
  }
239
246
 
240
247
  const std::string type_url_;
241
- const std::string name_;
248
+ const XdsApi::ResourceName resource_;
242
249
 
243
250
  RefCountedPtr<AdsCallState> ads_calld_;
244
251
  bool sent_initial_request_;
@@ -255,30 +262,41 @@ class XdsClient::ChannelState::AdsCallState
255
262
  grpc_error_handle error = GRPC_ERROR_NONE;
256
263
 
257
264
  // Subscribed resources of this type.
258
- std::map<std::string /* name */, OrphanablePtr<ResourceState>>
265
+ std::map<std::string /*authority*/,
266
+ std::map<std::string /*name*/, OrphanablePtr<ResourceState>>>
259
267
  subscribed_resources;
260
268
  };
261
269
 
262
270
  void SendMessageLocked(const std::string& type_url)
263
271
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
264
272
 
265
- void AcceptLdsUpdateLocked(std::string version, grpc_millis update_time,
266
- XdsApi::LdsUpdateMap lds_update_map)
273
+ void AcceptLdsUpdateLocked(
274
+ std::string version, grpc_millis update_time,
275
+ XdsApi::LdsUpdateMap lds_update_map,
276
+ const std::set<XdsApi::ResourceName>& resource_names_failed)
267
277
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
268
278
  void AcceptRdsUpdateLocked(std::string version, grpc_millis update_time,
269
279
  XdsApi::RdsUpdateMap rds_update_map)
270
280
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
271
- void AcceptCdsUpdateLocked(std::string version, grpc_millis update_time,
272
- XdsApi::CdsUpdateMap cds_update_map)
281
+ void AcceptCdsUpdateLocked(
282
+ std::string version, grpc_millis update_time,
283
+ XdsApi::CdsUpdateMap cds_update_map,
284
+ const std::set<XdsApi::ResourceName>& resource_names_failed)
273
285
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
274
286
  void AcceptEdsUpdateLocked(std::string version, grpc_millis update_time,
275
287
  XdsApi::EdsUpdateMap eds_update_map)
276
288
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
277
289
 
278
290
  template <typename StateMap>
291
+ void RejectAdsUpdateHelperLocked(const std::string& resource_name,
292
+ grpc_millis update_time,
293
+ const XdsApi::AdsParseResult& result,
294
+ const std::string& error_details,
295
+ StateMap* state_map)
296
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
297
+
279
298
  void RejectAdsUpdateLocked(grpc_millis update_time,
280
- const XdsApi::AdsParseResult& result,
281
- StateMap* state_map)
299
+ const XdsApi::AdsParseResult& result)
282
300
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
283
301
 
284
302
  static void OnRequestSent(void* arg, grpc_error_handle error);
@@ -293,8 +311,9 @@ class XdsClient::ChannelState::AdsCallState
293
311
 
294
312
  bool IsCurrentCallOnChannel() const;
295
313
 
296
- std::set<absl::string_view> ResourceNamesForRequest(
297
- const std::string& type_url);
314
+ std::map<absl::string_view /*authority*/,
315
+ std::set<absl::string_view /*name*/>>
316
+ ResourceNamesForRequest(const std::string& type_url);
298
317
 
299
318
  // The owning RetryableCall<>.
300
319
  RefCountedPtr<RetryableCall<AdsCallState>> parent_;
@@ -439,7 +458,7 @@ class XdsClient::ChannelState::LrsCallState
439
458
  class XdsClient::ChannelState::StateWatcher
440
459
  : public AsyncConnectivityStateWatcherInterface {
441
460
  public:
442
- explicit StateWatcher(RefCountedPtr<ChannelState> parent)
461
+ explicit StateWatcher(WeakRefCountedPtr<ChannelState> parent)
443
462
  : parent_(std::move(parent)) {}
444
463
 
445
464
  private:
@@ -459,7 +478,7 @@ class XdsClient::ChannelState::StateWatcher
459
478
  }
460
479
  }
461
480
 
462
- RefCountedPtr<ChannelState> parent_;
481
+ WeakRefCountedPtr<ChannelState> parent_;
463
482
  };
464
483
 
465
484
  //
@@ -481,7 +500,7 @@ grpc_channel* CreateXdsChannel(grpc_channel_args* args,
481
500
 
482
501
  XdsClient::ChannelState::ChannelState(WeakRefCountedPtr<XdsClient> xds_client,
483
502
  const XdsBootstrap::XdsServer& server)
484
- : InternallyRefCounted<ChannelState>(
503
+ : DualRefCounted<ChannelState>(
485
504
  GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace)
486
505
  ? "ChannelState"
487
506
  : nullptr),
@@ -505,12 +524,19 @@ XdsClient::ChannelState::~ChannelState() {
505
524
  xds_client_.reset(DEBUG_LOCATION, "ChannelState");
506
525
  }
507
526
 
508
- void XdsClient::ChannelState::Orphan() {
527
+ // This method should only ever be called when holding the lock, but we can't
528
+ // use a ABSL_EXCLUSIVE_LOCKS_REQUIRED annotation, because Orphan() will be
529
+ // called from DualRefCounted::Unref, which cannot have a lock annotation for a
530
+ // lock in this subclass.
531
+ void XdsClient::ChannelState::Orphan() ABSL_NO_THREAD_SAFETY_ANALYSIS {
509
532
  shutting_down_ = true;
510
533
  CancelConnectivityWatchLocked();
534
+ // At this time, all strong refs are removed, remove from channel map to
535
+ // prevent subsequent subscription from trying to use this ChannelState as it
536
+ // is shutting down.
537
+ xds_client_->xds_server_channel_map_.erase(server_);
511
538
  ads_calld_.reset();
512
539
  lrs_calld_.reset();
513
- Unref(DEBUG_LOCATION, "ChannelState+orphaned");
514
540
  }
515
541
 
516
542
  XdsClient::ChannelState::AdsCallState* XdsClient::ChannelState::ads_calld()
@@ -529,8 +555,8 @@ bool XdsClient::ChannelState::HasActiveAdsCall() const {
529
555
 
530
556
  void XdsClient::ChannelState::MaybeStartLrsCall() {
531
557
  if (lrs_calld_ != nullptr) return;
532
- lrs_calld_.reset(
533
- new RetryableCall<LrsCallState>(Ref(DEBUG_LOCATION, "ChannelState+lrs")));
558
+ lrs_calld_.reset(new RetryableCall<LrsCallState>(
559
+ WeakRef(DEBUG_LOCATION, "ChannelState+lrs")));
534
560
  }
535
561
 
536
562
  void XdsClient::ChannelState::StopLrsCall() { lrs_calld_.reset(); }
@@ -538,7 +564,7 @@ void XdsClient::ChannelState::StopLrsCall() { lrs_calld_.reset(); }
538
564
  void XdsClient::ChannelState::StartConnectivityWatchLocked() {
539
565
  ClientChannel* client_channel = ClientChannel::GetFromChannel(channel_);
540
566
  GPR_ASSERT(client_channel != nullptr);
541
- watcher_ = new StateWatcher(Ref(DEBUG_LOCATION, "ChannelState+watch"));
567
+ watcher_ = new StateWatcher(WeakRef(DEBUG_LOCATION, "ChannelState+watch"));
542
568
  client_channel->AddConnectivityWatcher(
543
569
  GRPC_CHANNEL_IDLE,
544
570
  OrphanablePtr<AsyncConnectivityStateWatcherInterface>(watcher_));
@@ -550,12 +576,12 @@ void XdsClient::ChannelState::CancelConnectivityWatchLocked() {
550
576
  client_channel->RemoveConnectivityWatcher(watcher_);
551
577
  }
552
578
 
553
- void XdsClient::ChannelState::SubscribeLocked(const std::string& type_url,
554
- const std::string& name) {
579
+ void XdsClient::ChannelState::SubscribeLocked(
580
+ const std::string& type_url, const XdsApi::ResourceName& resource) {
555
581
  if (ads_calld_ == nullptr) {
556
582
  // Start the ADS call if this is the first request.
557
583
  ads_calld_.reset(new RetryableCall<AdsCallState>(
558
- Ref(DEBUG_LOCATION, "ChannelState+ads")));
584
+ WeakRef(DEBUG_LOCATION, "ChannelState+ads")));
559
585
  // Note: AdsCallState's ctor will automatically subscribe to all
560
586
  // resources that the XdsClient already has watchers for, so we can
561
587
  // return here.
@@ -565,17 +591,19 @@ void XdsClient::ChannelState::SubscribeLocked(const std::string& type_url,
565
591
  // because when the call is restarted it will resend all necessary requests.
566
592
  if (ads_calld() == nullptr) return;
567
593
  // Subscribe to this resource if the ADS call is active.
568
- ads_calld()->SubscribeLocked(type_url, name);
594
+ ads_calld()->SubscribeLocked(type_url, resource);
569
595
  }
570
596
 
571
- void XdsClient::ChannelState::UnsubscribeLocked(const std::string& type_url,
572
- const std::string& name,
573
- bool delay_unsubscription) {
597
+ void XdsClient::ChannelState::UnsubscribeLocked(
598
+ const std::string& type_url, const XdsApi::ResourceName& resource,
599
+ bool delay_unsubscription) {
574
600
  if (ads_calld_ != nullptr) {
575
601
  auto* calld = ads_calld_->calld();
576
602
  if (calld != nullptr) {
577
- calld->UnsubscribeLocked(type_url, name, delay_unsubscription);
578
- if (!calld->HasSubscribedResources()) ads_calld_.reset();
603
+ calld->UnsubscribeLocked(type_url, resource, delay_unsubscription);
604
+ if (!calld->HasSubscribedResources()) {
605
+ ads_calld_.reset();
606
+ }
579
607
  }
580
608
  }
581
609
  }
@@ -586,7 +614,7 @@ void XdsClient::ChannelState::UnsubscribeLocked(const std::string& type_url,
586
614
 
587
615
  template <typename T>
588
616
  XdsClient::ChannelState::RetryableCall<T>::RetryableCall(
589
- RefCountedPtr<ChannelState> chand)
617
+ WeakRefCountedPtr<ChannelState> chand)
590
618
  : chand_(std::move(chand)),
591
619
  backoff_(
592
620
  BackOff::Options()
@@ -644,7 +672,8 @@ void XdsClient::ChannelState::RetryableCall<T>::StartRetryTimerLocked() {
644
672
  if (shutting_down_) return;
645
673
  const grpc_millis next_attempt_time = backoff_.NextAttemptTime();
646
674
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
647
- grpc_millis timeout = GPR_MAX(next_attempt_time - ExecCtx::Get()->Now(), 0);
675
+ grpc_millis timeout =
676
+ std::max(next_attempt_time - ExecCtx::Get()->Now(), grpc_millis(0));
648
677
  gpr_log(GPR_INFO,
649
678
  "[xds_client %p] Failed to connect to xds server (chand: %p) "
650
679
  "retry timer will fire in %" PRId64 "ms.",
@@ -735,17 +764,26 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
735
764
  // Op: send request message.
736
765
  GRPC_CLOSURE_INIT(&on_request_sent_, OnRequestSent, this,
737
766
  grpc_schedule_on_exec_ctx);
738
- for (const auto& p : xds_client()->listener_map_) {
739
- SubscribeLocked(XdsApi::kLdsTypeUrl, std::string(p.first));
740
- }
741
- for (const auto& p : xds_client()->route_config_map_) {
742
- SubscribeLocked(XdsApi::kRdsTypeUrl, std::string(p.first));
743
- }
744
- for (const auto& p : xds_client()->cluster_map_) {
745
- SubscribeLocked(XdsApi::kCdsTypeUrl, std::string(p.first));
746
- }
747
- for (const auto& p : xds_client()->endpoint_map_) {
748
- SubscribeLocked(XdsApi::kEdsTypeUrl, std::string(p.first));
767
+ for (const auto& a : xds_client()->authority_state_map_) {
768
+ const std::string& authority = a.first;
769
+ // Skip authorities that are not using this xDS channel.
770
+ if (a.second.channel_state != chand()) continue;
771
+ for (const auto& l : a.second.listener_map) {
772
+ const std::string& listener_name = l.first;
773
+ SubscribeLocked(XdsApi::kLdsTypeUrl, {authority, listener_name});
774
+ }
775
+ for (const auto& r : a.second.route_config_map) {
776
+ const std::string& route_config_name = r.first;
777
+ SubscribeLocked(XdsApi::kRdsTypeUrl, {authority, route_config_name});
778
+ }
779
+ for (const auto& c : a.second.cluster_map) {
780
+ const std::string& cluster_name = c.first;
781
+ SubscribeLocked(XdsApi::kCdsTypeUrl, {authority, cluster_name});
782
+ }
783
+ for (const auto& e : a.second.endpoint_map) {
784
+ const std::string& endpoint_name = e.first;
785
+ SubscribeLocked(XdsApi::kEdsTypeUrl, {authority, endpoint_name});
786
+ }
749
787
  }
750
788
  // Op: recv initial metadata.
751
789
  op = ops;
@@ -818,11 +856,12 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
818
856
  }
819
857
  auto& state = state_map_[type_url];
820
858
  grpc_slice request_payload_slice;
821
- std::set<absl::string_view> resource_names =
822
- ResourceNamesForRequest(type_url);
859
+ std::map<absl::string_view /*authority*/,
860
+ std::set<absl::string_view /*name*/>>
861
+ resource_map = ResourceNamesForRequest(type_url);
823
862
  request_payload_slice = xds_client()->api_.CreateAdsRequest(
824
- chand()->server_, type_url, resource_names,
825
- xds_client()->resource_version_map_[type_url], state.nonce,
863
+ chand()->server_, type_url, resource_map,
864
+ chand()->resource_type_version_map_[type_url], state.nonce,
826
865
  GRPC_ERROR_REF(state.error), !sent_initial_message_);
827
866
  if (type_url != XdsApi::kLdsTypeUrl && type_url != XdsApi::kRdsTypeUrl &&
828
867
  type_url != XdsApi::kCdsTypeUrl && type_url != XdsApi::kEdsTypeUrl) {
@@ -832,11 +871,10 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
832
871
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
833
872
  gpr_log(GPR_INFO,
834
873
  "[xds_client %p] sending ADS request: type=%s version=%s nonce=%s "
835
- "error=%s resources=%s",
874
+ "error=%s",
836
875
  xds_client(), type_url.c_str(),
837
- xds_client()->resource_version_map_[type_url].c_str(),
838
- state.nonce.c_str(), grpc_error_std_string(state.error).c_str(),
839
- absl::StrJoin(resource_names, " ").c_str());
876
+ chand()->resource_type_version_map_[type_url].c_str(),
877
+ state.nonce.c_str(), grpc_error_std_string(state.error).c_str());
840
878
  }
841
879
  GRPC_ERROR_UNREF(state.error);
842
880
  state.error = GRPC_ERROR_NONE;
@@ -863,19 +901,26 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
863
901
  }
864
902
 
865
903
  void XdsClient::ChannelState::AdsCallState::SubscribeLocked(
866
- const std::string& type_url, const std::string& name) {
867
- auto& state = state_map_[type_url].subscribed_resources[name];
904
+ const std::string& type_url, const XdsApi::ResourceName& resource) {
905
+ auto& state = state_map_[type_url]
906
+ .subscribed_resources[resource.authority][resource.id];
868
907
  if (state == nullptr) {
869
908
  state = MakeOrphanable<ResourceState>(
870
- type_url, name, !xds_client()->resource_version_map_[type_url].empty());
909
+ type_url, resource,
910
+ !chand()->resource_type_version_map_[type_url].empty());
871
911
  SendMessageLocked(type_url);
872
912
  }
873
913
  }
874
914
 
875
915
  void XdsClient::ChannelState::AdsCallState::UnsubscribeLocked(
876
- const std::string& type_url, const std::string& name,
916
+ const std::string& type_url, const XdsApi::ResourceName& resource,
877
917
  bool delay_unsubscription) {
878
- state_map_[type_url].subscribed_resources.erase(name);
918
+ auto& type_state_map = state_map_[type_url];
919
+ auto& authority_map = type_state_map.subscribed_resources[resource.authority];
920
+ authority_map.erase(resource.id);
921
+ if (authority_map.empty()) {
922
+ type_state_map.subscribed_resources.erase(resource.authority);
923
+ }
879
924
  if (!delay_unsubscription) SendMessageLocked(type_url);
880
925
  }
881
926
 
@@ -904,7 +949,8 @@ XdsApi::ResourceMetadata CreateResourceMetadataAcked(
904
949
 
905
950
  void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdateLocked(
906
951
  std::string version, grpc_millis update_time,
907
- XdsApi::LdsUpdateMap lds_update_map) {
952
+ XdsApi::LdsUpdateMap lds_update_map,
953
+ const std::set<XdsApi::ResourceName>& resource_names_failed) {
908
954
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
909
955
  gpr_log(GPR_INFO,
910
956
  "[xds_client %p] LDS update received containing %" PRIuPTR
@@ -914,28 +960,38 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdateLocked(
914
960
  auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
915
961
  std::set<std::string> rds_resource_names_seen;
916
962
  for (auto& p : lds_update_map) {
917
- const std::string& listener_name = p.first;
963
+ const XdsApi::ResourceName& resource = p.first;
918
964
  XdsApi::LdsUpdate& lds_update = p.second.resource;
919
- auto& state = lds_state.subscribed_resources[listener_name];
965
+ auto& state =
966
+ lds_state.subscribed_resources[resource.authority][resource.id];
920
967
  if (state != nullptr) state->Finish();
921
968
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
922
969
  gpr_log(GPR_INFO, "[xds_client %p] LDS resource %s: %s", xds_client(),
923
- listener_name.c_str(), lds_update.ToString().c_str());
970
+ XdsApi::ConstructFullResourceName(
971
+ resource.authority, XdsApi::kLdsTypeUrl, resource.id)
972
+ .c_str(),
973
+ lds_update.ToString().c_str());
924
974
  }
925
975
  // Record the RDS resource names seen.
926
976
  if (!lds_update.http_connection_manager.route_config_name.empty()) {
927
977
  rds_resource_names_seen.insert(
928
978
  lds_update.http_connection_manager.route_config_name);
929
979
  }
980
+ ListenerState& listener_state =
981
+ xds_client()
982
+ ->authority_state_map_[resource.authority]
983
+ .listener_map[resource.id];
930
984
  // Ignore identical update.
931
- ListenerState& listener_state = xds_client()->listener_map_[listener_name];
932
985
  if (listener_state.update.has_value() &&
933
986
  *listener_state.update == lds_update) {
934
987
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
935
988
  gpr_log(GPR_INFO,
936
989
  "[xds_client %p] LDS update for %s identical to current, "
937
990
  "ignoring.",
938
- xds_client(), listener_name.c_str());
991
+ xds_client(),
992
+ XdsApi::ConstructFullResourceName(
993
+ resource.authority, XdsApi::kLdsTypeUrl, resource.id)
994
+ .c_str());
939
995
  }
940
996
  continue;
941
997
  }
@@ -948,23 +1004,46 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdateLocked(
948
1004
  p.first->OnListenerChanged(*listener_state.update);
949
1005
  }
950
1006
  }
1007
+ // For invalid resources in the update, if they are already in the
1008
+ // cache, pretend that they are present in the update, so that we
1009
+ // don't incorrectly consider them deleted below.
1010
+ for (const auto& resource : resource_names_failed) {
1011
+ auto& listener_map =
1012
+ xds_client()->authority_state_map_[resource.authority].listener_map;
1013
+ auto it = listener_map.find(resource.id);
1014
+ if (it != listener_map.end()) {
1015
+ auto& update = it->second.update;
1016
+ if (!update.has_value()) continue;
1017
+ lds_update_map[resource];
1018
+ if (!update->http_connection_manager.route_config_name.empty()) {
1019
+ rds_resource_names_seen.insert(
1020
+ update->http_connection_manager.route_config_name);
1021
+ }
1022
+ }
1023
+ }
951
1024
  // For any subscribed resource that is not present in the update,
952
1025
  // remove it from the cache and notify watchers that it does not exist.
953
- for (const auto& p : lds_state.subscribed_resources) {
954
- const std::string& listener_name = p.first;
955
- if (lds_update_map.find(listener_name) == lds_update_map.end()) {
956
- ListenerState& listener_state =
957
- xds_client()->listener_map_[listener_name];
958
- // If the resource was newly requested but has not yet been received,
959
- // we don't want to generate an error for the watchers, because this LDS
960
- // response may be in reaction to an earlier request that did not yet
961
- // request the new resource, so its absence from the response does not
962
- // necessarily indicate that the resource does not exist.
963
- // For that case, we rely on the request timeout instead.
964
- if (!listener_state.update.has_value()) continue;
965
- listener_state.update.reset();
966
- for (const auto& p : listener_state.watchers) {
967
- p.first->OnResourceDoesNotExist();
1026
+ for (const auto& a : lds_state.subscribed_resources) {
1027
+ const std::string& authority_name = a.first;
1028
+ for (const auto& p : a.second) {
1029
+ const std::string& listener_name = p.first;
1030
+ if (lds_update_map.find({authority_name, listener_name}) ==
1031
+ lds_update_map.end()) {
1032
+ ListenerState& listener_state =
1033
+ xds_client()
1034
+ ->authority_state_map_[authority_name]
1035
+ .listener_map[listener_name];
1036
+ // If the resource was newly requested but has not yet been received,
1037
+ // we don't want to generate an error for the watchers, because this LDS
1038
+ // response may be in reaction to an earlier request that did not yet
1039
+ // request the new resource, so its absence from the response does not
1040
+ // necessarily indicate that the resource does not exist.
1041
+ // For that case, we rely on the request timeout instead.
1042
+ if (!listener_state.update.has_value()) continue;
1043
+ listener_state.update.reset();
1044
+ for (const auto& p : listener_state.watchers) {
1045
+ p.first->OnResourceDoesNotExist();
1046
+ }
968
1047
  }
969
1048
  }
970
1049
  }
@@ -972,15 +1051,21 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdateLocked(
972
1051
  // resources, remove it from the cache and notify watchers that it
973
1052
  // does not exist.
974
1053
  auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
975
- for (const auto& p : rds_state.subscribed_resources) {
976
- const std::string& rds_resource_name = p.first;
977
- if (rds_resource_names_seen.find(rds_resource_name) ==
978
- rds_resource_names_seen.end()) {
979
- RouteConfigState& route_config_state =
980
- xds_client()->route_config_map_[rds_resource_name];
981
- route_config_state.update.reset();
982
- for (const auto& p : route_config_state.watchers) {
983
- p.first->OnResourceDoesNotExist();
1054
+ for (const auto& a : rds_state.subscribed_resources) {
1055
+ const std::string& authority_name = a.first;
1056
+ for (const auto& p : a.second) {
1057
+ const std::string& listener_name = p.first;
1058
+ if (rds_resource_names_seen.find(XdsApi::ConstructFullResourceName(
1059
+ authority_name, XdsApi::kRdsTypeUrl, listener_name)) ==
1060
+ rds_resource_names_seen.end()) {
1061
+ RouteConfigState& route_config_state =
1062
+ xds_client()
1063
+ ->authority_state_map_[authority_name]
1064
+ .route_config_map[listener_name];
1065
+ route_config_state.update.reset();
1066
+ for (const auto& p : route_config_state.watchers) {
1067
+ p.first->OnResourceDoesNotExist();
1068
+ }
984
1069
  }
985
1070
  }
986
1071
  }
@@ -997,16 +1082,19 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdateLocked(
997
1082
  }
998
1083
  auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
999
1084
  for (auto& p : rds_update_map) {
1000
- const std::string& route_config_name = p.first;
1085
+ const XdsApi::ResourceName& resource = p.first;
1001
1086
  XdsApi::RdsUpdate& rds_update = p.second.resource;
1002
- auto& state = rds_state.subscribed_resources[route_config_name];
1087
+ auto& state =
1088
+ rds_state.subscribed_resources[resource.authority][resource.id];
1003
1089
  if (state != nullptr) state->Finish();
1004
1090
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1005
1091
  gpr_log(GPR_INFO, "[xds_client %p] RDS resource:\n%s", xds_client(),
1006
1092
  rds_update.ToString().c_str());
1007
1093
  }
1008
1094
  RouteConfigState& route_config_state =
1009
- xds_client()->route_config_map_[route_config_name];
1095
+ xds_client()
1096
+ ->authority_state_map_[resource.authority]
1097
+ .route_config_map[resource.id];
1010
1098
  // Ignore identical update.
1011
1099
  if (route_config_state.update.has_value() &&
1012
1100
  *route_config_state.update == rds_update) {
@@ -1030,7 +1118,8 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdateLocked(
1030
1118
 
1031
1119
  void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdateLocked(
1032
1120
  std::string version, grpc_millis update_time,
1033
- XdsApi::CdsUpdateMap cds_update_map) {
1121
+ XdsApi::CdsUpdateMap cds_update_map,
1122
+ const std::set<XdsApi::ResourceName>& resource_names_failed) {
1034
1123
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1035
1124
  gpr_log(GPR_INFO,
1036
1125
  "[xds_client %p] CDS update received containing %" PRIuPTR
@@ -1040,20 +1129,28 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdateLocked(
1040
1129
  auto& cds_state = state_map_[XdsApi::kCdsTypeUrl];
1041
1130
  std::set<std::string> eds_resource_names_seen;
1042
1131
  for (auto& p : cds_update_map) {
1043
- const char* cluster_name = p.first.c_str();
1132
+ const XdsApi::ResourceName& resource = p.first;
1044
1133
  XdsApi::CdsUpdate& cds_update = p.second.resource;
1045
- auto& state = cds_state.subscribed_resources[cluster_name];
1134
+ auto& state =
1135
+ cds_state.subscribed_resources[resource.authority][resource.id];
1046
1136
  if (state != nullptr) state->Finish();
1047
1137
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1048
1138
  gpr_log(GPR_INFO, "[xds_client %p] cluster=%s: %s", xds_client(),
1049
- cluster_name, cds_update.ToString().c_str());
1139
+ XdsApi::ConstructFullResourceName(
1140
+ resource.authority, XdsApi::kCdsTypeUrl, resource.id)
1141
+ .c_str(),
1142
+ cds_update.ToString().c_str());
1050
1143
  }
1051
1144
  // Record the EDS resource names seen.
1052
- eds_resource_names_seen.insert(cds_update.eds_service_name.empty()
1053
- ? cluster_name
1054
- : cds_update.eds_service_name);
1145
+ eds_resource_names_seen.insert(
1146
+ cds_update.eds_service_name.empty()
1147
+ ? XdsApi::ConstructFullResourceName(
1148
+ resource.authority, XdsApi::kCdsTypeUrl, resource.id)
1149
+ : cds_update.eds_service_name);
1150
+ ClusterState& cluster_state = xds_client()
1151
+ ->authority_state_map_[resource.authority]
1152
+ .cluster_map[resource.id];
1055
1153
  // Ignore identical update.
1056
- ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
1057
1154
  if (cluster_state.update.has_value() &&
1058
1155
  *cluster_state.update == cds_update) {
1059
1156
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
@@ -1072,22 +1169,46 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdateLocked(
1072
1169
  p.first->OnClusterChanged(cluster_state.update.value());
1073
1170
  }
1074
1171
  }
1172
+ // For invalid resources in the update, if they are already in the
1173
+ // cache, pretend that they are present in the update, so that we
1174
+ // don't incorrectly consider them deleted below.
1175
+ for (const auto& resource : resource_names_failed) {
1176
+ auto& cluster_map =
1177
+ xds_client()->authority_state_map_[resource.authority].cluster_map;
1178
+ auto it = cluster_map.find(resource.id);
1179
+ if (it != cluster_map.end()) {
1180
+ auto& update = it->second.update;
1181
+ if (!update.has_value()) continue;
1182
+ cds_update_map[resource];
1183
+ eds_resource_names_seen.insert(
1184
+ update->eds_service_name.empty()
1185
+ ? XdsApi::ConstructFullResourceName(
1186
+ resource.authority, XdsApi::kCdsTypeUrl, resource.id)
1187
+ : update->eds_service_name);
1188
+ }
1189
+ }
1075
1190
  // For any subscribed resource that is not present in the update,
1076
1191
  // remove it from the cache and notify watchers that it does not exist.
1077
- for (const auto& p : cds_state.subscribed_resources) {
1078
- const std::string& cluster_name = p.first;
1079
- if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
1080
- ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
1081
- // If the resource was newly requested but has not yet been received,
1082
- // we don't want to generate an error for the watchers, because this CDS
1083
- // response may be in reaction to an earlier request that did not yet
1084
- // request the new resource, so its absence from the response does not
1085
- // necessarily indicate that the resource does not exist.
1086
- // For that case, we rely on the request timeout instead.
1087
- if (!cluster_state.update.has_value()) continue;
1088
- cluster_state.update.reset();
1089
- for (const auto& p : cluster_state.watchers) {
1090
- p.first->OnResourceDoesNotExist();
1192
+ for (const auto& a : cds_state.subscribed_resources) {
1193
+ const std::string& authority = a.first;
1194
+ for (const auto& p : a.second) {
1195
+ const std::string& cluster_name = p.first;
1196
+ if (cds_update_map.find({authority, cluster_name}) ==
1197
+ cds_update_map.end()) {
1198
+ ClusterState& cluster_state = xds_client()
1199
+ ->authority_state_map_[authority]
1200
+ .cluster_map[cluster_name];
1201
+ // If the resource was newly requested but has not yet been received,
1202
+ // we don't want to generate an error for the watchers, because this CDS
1203
+ // response may be in reaction to an earlier request that did not yet
1204
+ // request the new resource, so its absence from the response does not
1205
+ // necessarily indicate that the resource does not exist.
1206
+ // For that case, we rely on the request timeout instead.
1207
+ if (!cluster_state.update.has_value()) continue;
1208
+ cluster_state.update.reset();
1209
+ for (const auto& p : cluster_state.watchers) {
1210
+ p.first->OnResourceDoesNotExist();
1211
+ }
1091
1212
  }
1092
1213
  }
1093
1214
  }
@@ -1095,15 +1216,20 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdateLocked(
1095
1216
  // resources, remove it from the cache and notify watchers that it
1096
1217
  // does not exist.
1097
1218
  auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
1098
- for (const auto& p : eds_state.subscribed_resources) {
1099
- const std::string& eds_resource_name = p.first;
1100
- if (eds_resource_names_seen.find(eds_resource_name) ==
1101
- eds_resource_names_seen.end()) {
1102
- EndpointState& endpoint_state =
1103
- xds_client()->endpoint_map_[eds_resource_name];
1104
- endpoint_state.update.reset();
1105
- for (const auto& p : endpoint_state.watchers) {
1106
- p.first->OnResourceDoesNotExist();
1219
+ for (const auto& a : eds_state.subscribed_resources) {
1220
+ const std::string& authority = a.first;
1221
+ for (const auto& p : a.second) {
1222
+ const std::string& eds_resource_name = p.first;
1223
+ if (eds_resource_names_seen.find(XdsApi::ConstructFullResourceName(
1224
+ authority, XdsApi::kEdsTypeUrl, eds_resource_name)) ==
1225
+ eds_resource_names_seen.end()) {
1226
+ EndpointState& endpoint_state = xds_client()
1227
+ ->authority_state_map_[authority]
1228
+ .endpoint_map[eds_resource_name];
1229
+ endpoint_state.update.reset();
1230
+ for (const auto& p : endpoint_state.watchers) {
1231
+ p.first->OnResourceDoesNotExist();
1232
+ }
1107
1233
  }
1108
1234
  }
1109
1235
  }
@@ -1120,16 +1246,22 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdateLocked(
1120
1246
  }
1121
1247
  auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
1122
1248
  for (auto& p : eds_update_map) {
1123
- const char* eds_service_name = p.first.c_str();
1249
+ const XdsApi::ResourceName& resource = p.first;
1124
1250
  XdsApi::EdsUpdate& eds_update = p.second.resource;
1125
- auto& state = eds_state.subscribed_resources[eds_service_name];
1251
+ auto& state =
1252
+ eds_state.subscribed_resources[resource.authority][resource.id];
1126
1253
  if (state != nullptr) state->Finish();
1127
1254
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1128
1255
  gpr_log(GPR_INFO, "[xds_client %p] EDS resource %s: %s", xds_client(),
1129
- eds_service_name, eds_update.ToString().c_str());
1256
+ XdsApi::ConstructFullResourceName(
1257
+ resource.authority, XdsApi::kCdsTypeUrl, resource.id)
1258
+ .c_str(),
1259
+ eds_update.ToString().c_str());
1130
1260
  }
1131
1261
  EndpointState& endpoint_state =
1132
- xds_client()->endpoint_map_[eds_service_name];
1262
+ xds_client()
1263
+ ->authority_state_map_[resource.authority]
1264
+ .endpoint_map[resource.id];
1133
1265
  // Ignore identical update.
1134
1266
  if (endpoint_state.update.has_value() &&
1135
1267
  *endpoint_state.update == eds_update) {
@@ -1167,28 +1299,50 @@ void UpdateResourceMetadataNacked(const std::string& version,
1167
1299
  } // namespace
1168
1300
 
1169
1301
  template <typename StateMap>
1170
- void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateLocked(
1171
- grpc_millis update_time, const XdsApi::AdsParseResult& result,
1302
+ void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateHelperLocked(
1303
+ const std::string& resource_name, grpc_millis update_time,
1304
+ const XdsApi::AdsParseResult& result, const std::string& error_details,
1172
1305
  StateMap* state_map) {
1306
+ auto it = state_map->find(resource_name);
1307
+ if (it == state_map->end()) return;
1308
+ auto& state = it->second;
1309
+ for (const auto& p : state.watchers) {
1310
+ p.first->OnError(GRPC_ERROR_REF(result.parse_error));
1311
+ }
1312
+ UpdateResourceMetadataNacked(result.version, error_details, update_time,
1313
+ &state.meta);
1314
+ }
1315
+
1316
+ void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateLocked(
1317
+ grpc_millis update_time, const XdsApi::AdsParseResult& result) {
1173
1318
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1174
1319
  gpr_log(GPR_INFO,
1175
1320
  "[xds_client %p] %s update NACKed containing %" PRIuPTR
1176
- " resources",
1321
+ " invalid resources",
1177
1322
  xds_client(), result.type_url.c_str(),
1178
1323
  result.resource_names_failed.size());
1179
1324
  }
1180
1325
  std::string details = grpc_error_std_string(result.parse_error);
1181
- for (auto& name : result.resource_names_failed) {
1182
- auto it = state_map->find(name);
1183
- if (it == state_map->end()) continue;
1184
- auto& state = it->second;
1185
- // Notify watchers of error.
1186
- for (const auto& p : state.watchers) {
1187
- p.first->OnError(GRPC_ERROR_REF(result.parse_error));
1326
+ for (auto& resource : result.resource_names_failed) {
1327
+ auto authority_it =
1328
+ xds_client()->authority_state_map_.find(resource.authority);
1329
+ if (authority_it == xds_client()->authority_state_map_.end()) continue;
1330
+ AuthorityState& authority_state = authority_it->second;
1331
+ if (result.type_url == XdsApi::kLdsTypeUrl) {
1332
+ RejectAdsUpdateHelperLocked(resource.id, update_time, result, details,
1333
+ &authority_state.listener_map);
1334
+ } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1335
+ RejectAdsUpdateHelperLocked(resource.id, update_time, result, details,
1336
+ &authority_state.route_config_map);
1337
+ } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1338
+ RejectAdsUpdateHelperLocked(resource.id, update_time, result, details,
1339
+ &authority_state.cluster_map);
1340
+ } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1341
+ RejectAdsUpdateHelperLocked(resource.id, update_time, result, details,
1342
+ &authority_state.endpoint_map);
1343
+ } else {
1344
+ GPR_ASSERT(0);
1188
1345
  }
1189
- // Update resource metadata for CSDS.
1190
- UpdateResourceMetadataNacked(result.version, details, update_time,
1191
- &state.meta);
1192
1346
  }
1193
1347
  }
1194
1348
 
@@ -1268,9 +1422,8 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1268
1422
  // Update nonce.
1269
1423
  auto& state = state_map_[result.type_url];
1270
1424
  state.nonce = std::move(result.nonce);
1271
- // NACK or ACK the response.
1425
+ // If we got an error, we'll NACK the update.
1272
1426
  if (result.parse_error != GRPC_ERROR_NONE) {
1273
- // NACK unacceptable update.
1274
1427
  gpr_log(GPR_ERROR,
1275
1428
  "[xds_client %p] ADS response invalid for resource type %s "
1276
1429
  "version %s, will NACK: nonce=%s error=%s",
@@ -1282,39 +1435,32 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1282
1435
  GRPC_STATUS_UNAVAILABLE);
1283
1436
  GRPC_ERROR_UNREF(state.error);
1284
1437
  state.error = result.parse_error;
1285
- if (result.type_url == XdsApi::kLdsTypeUrl) {
1286
- RejectAdsUpdateLocked(update_time, result,
1287
- &xds_client()->listener_map_);
1288
- } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1289
- RejectAdsUpdateLocked(update_time, result,
1290
- &xds_client()->route_config_map_);
1291
- } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1292
- RejectAdsUpdateLocked(update_time, result, &xds_client()->cluster_map_);
1293
- } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1294
- RejectAdsUpdateLocked(update_time, result,
1295
- &xds_client()->endpoint_map_);
1296
- }
1297
- SendMessageLocked(result.type_url);
1298
- } else {
1438
+ RejectAdsUpdateLocked(update_time, result);
1439
+ }
1440
+ // Process any valid resources.
1441
+ bool have_valid_resources = false;
1442
+ if (result.type_url == XdsApi::kLdsTypeUrl) {
1443
+ have_valid_resources = !result.lds_update_map.empty();
1444
+ AcceptLdsUpdateLocked(result.version, update_time,
1445
+ std::move(result.lds_update_map),
1446
+ result.resource_names_failed);
1447
+ } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1448
+ have_valid_resources = !result.rds_update_map.empty();
1449
+ AcceptRdsUpdateLocked(result.version, update_time,
1450
+ std::move(result.rds_update_map));
1451
+ } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1452
+ have_valid_resources = !result.cds_update_map.empty();
1453
+ AcceptCdsUpdateLocked(result.version, update_time,
1454
+ std::move(result.cds_update_map),
1455
+ result.resource_names_failed);
1456
+ } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1457
+ have_valid_resources = !result.eds_update_map.empty();
1458
+ AcceptEdsUpdateLocked(result.version, update_time,
1459
+ std::move(result.eds_update_map));
1460
+ }
1461
+ if (have_valid_resources) {
1299
1462
  seen_response_ = true;
1300
- // Accept the ADS response according to the type_url.
1301
- if (result.type_url == XdsApi::kLdsTypeUrl) {
1302
- AcceptLdsUpdateLocked(result.version, update_time,
1303
- std::move(result.lds_update_map));
1304
- } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1305
- AcceptRdsUpdateLocked(result.version, update_time,
1306
- std::move(result.rds_update_map));
1307
- } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1308
- AcceptCdsUpdateLocked(result.version, update_time,
1309
- std::move(result.cds_update_map));
1310
- } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1311
- AcceptEdsUpdateLocked(result.version, update_time,
1312
- std::move(result.eds_update_map));
1313
- }
1314
- xds_client()->resource_version_map_[result.type_url] =
1315
- std::move(result.version);
1316
- // ACK the update.
1317
- SendMessageLocked(result.type_url);
1463
+ chand()->resource_type_version_map_[result.type_url] = result.version;
1318
1464
  // Start load reporting if needed.
1319
1465
  auto& lrs_call = chand()->lrs_calld_;
1320
1466
  if (lrs_call != nullptr) {
@@ -1322,6 +1468,8 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1322
1468
  if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
1323
1469
  }
1324
1470
  }
1471
+ // Send ACK or NACK.
1472
+ SendMessageLocked(result.type_url);
1325
1473
  }
1326
1474
  if (xds_client()->shutting_down_) return true;
1327
1475
  // Keep listening for updates.
@@ -1378,19 +1526,23 @@ bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
1378
1526
  return this == chand()->ads_calld_->calld();
1379
1527
  }
1380
1528
 
1381
- std::set<absl::string_view>
1529
+ std::map<absl::string_view /*authority*/, std::set<absl::string_view /*name*/>>
1382
1530
  XdsClient::ChannelState::AdsCallState::ResourceNamesForRequest(
1383
1531
  const std::string& type_url) {
1384
- std::set<absl::string_view> resource_names;
1532
+ std::map<absl::string_view /*authority*/,
1533
+ std::set<absl::string_view /*name*/>>
1534
+ resource_map;
1385
1535
  auto it = state_map_.find(type_url);
1386
1536
  if (it != state_map_.end()) {
1387
- for (auto& p : it->second.subscribed_resources) {
1388
- resource_names.insert(p.first);
1389
- OrphanablePtr<ResourceState>& state = p.second;
1390
- state->Start(Ref(DEBUG_LOCATION, "ResourceState"));
1537
+ for (auto& a : it->second.subscribed_resources) {
1538
+ for (auto& p : a.second) {
1539
+ resource_map[a.first].insert(p.first);
1540
+ OrphanablePtr<ResourceState>& state = p.second;
1541
+ state->Start(Ref(DEBUG_LOCATION, "ResourceState"));
1542
+ }
1391
1543
  }
1392
1544
  }
1393
- return resource_names;
1545
+ return resource_map;
1394
1546
  }
1395
1547
 
1396
1548
  //
@@ -1839,12 +1991,10 @@ grpc_millis GetRequestTimeout(const grpc_channel_args* args) {
1839
1991
  }
1840
1992
 
1841
1993
  grpc_channel_args* ModifyChannelArgs(const grpc_channel_args* args) {
1842
- absl::InlinedVector<grpc_arg, 2> args_to_add = {
1994
+ absl::InlinedVector<grpc_arg, 1> args_to_add = {
1843
1995
  grpc_channel_arg_integer_create(
1844
1996
  const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS),
1845
1997
  5 * 60 * GPR_MS_PER_SEC),
1846
- grpc_channel_arg_integer_create(
1847
- const_cast<char*>(GRPC_ARG_CHANNELZ_IS_INTERNAL_CHANNEL), 1),
1848
1998
  };
1849
1999
  return grpc_channel_args_copy_and_add(args, args_to_add.data(),
1850
2000
  args_to_add.size());
@@ -1868,9 +2018,9 @@ XdsClient::XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
1868
2018
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1869
2019
  gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
1870
2020
  }
1871
- // Create ChannelState object.
1872
- chand_ = MakeOrphanable<ChannelState>(
1873
- WeakRef(DEBUG_LOCATION, "XdsClient+ChannelState"), bootstrap_->server());
2021
+ // Calling grpc_init to ensure gRPC does not shut down until the XdsClient is
2022
+ // destroyed.
2023
+ grpc_init();
1874
2024
  }
1875
2025
 
1876
2026
  XdsClient::~XdsClient() {
@@ -1879,26 +2029,9 @@ XdsClient::~XdsClient() {
1879
2029
  }
1880
2030
  grpc_channel_args_destroy(args_);
1881
2031
  grpc_pollset_set_destroy(interested_parties_);
1882
- }
1883
-
1884
- void XdsClient::AddChannelzLinkage(
1885
- channelz::ChannelNode* parent_channelz_node) {
1886
- MutexLock lock(&mu_);
1887
- channelz::ChannelNode* xds_channelz_node =
1888
- grpc_channel_get_channelz_node(chand_->channel());
1889
- if (xds_channelz_node != nullptr) {
1890
- parent_channelz_node->AddChildChannel(xds_channelz_node->uuid());
1891
- }
1892
- }
1893
-
1894
- void XdsClient::RemoveChannelzLinkage(
1895
- channelz::ChannelNode* parent_channelz_node) {
1896
- MutexLock lock(&mu_);
1897
- channelz::ChannelNode* xds_channelz_node =
1898
- grpc_channel_get_channelz_node(chand_->channel());
1899
- if (xds_channelz_node != nullptr) {
1900
- parent_channelz_node->RemoveChildChannel(xds_channelz_node->uuid());
1901
- }
2032
+ // Calling grpc_shutdown to ensure gRPC does not shut down until the XdsClient
2033
+ // is destroyed.
2034
+ grpc_shutdown();
1902
2035
  }
1903
2036
 
1904
2037
  void XdsClient::Orphan() {
@@ -1912,28 +2045,56 @@ void XdsClient::Orphan() {
1912
2045
  {
1913
2046
  MutexLock lock(&mu_);
1914
2047
  shutting_down_ = true;
1915
- // Orphan ChannelState object.
1916
- chand_.reset();
1917
2048
  // We do not clear cluster_map_ and endpoint_map_ if the xds client was
1918
2049
  // created by the XdsResolver because the maps contain refs for watchers
1919
2050
  // which in turn hold refs to the loadbalancing policies. At this point, it
1920
2051
  // is possible for ADS calls to be in progress. Unreffing the loadbalancing
1921
2052
  // policies before those calls are done would lead to issues such as
1922
2053
  // https://github.com/grpc/grpc/issues/20928.
1923
- if (!listener_map_.empty()) {
1924
- cluster_map_.clear();
1925
- endpoint_map_.clear();
2054
+ for (auto& a : authority_state_map_) {
2055
+ a.second.channel_state.reset();
2056
+ if (!a.second.listener_map.empty()) {
2057
+ a.second.cluster_map.clear();
2058
+ a.second.endpoint_map.clear();
2059
+ }
1926
2060
  }
2061
+ // We clear these invalid resource watchers as cancel never came.
2062
+ invalid_listener_watchers_.clear();
2063
+ invalid_route_config_watchers_.clear();
2064
+ invalid_cluster_watchers_.clear();
2065
+ invalid_endpoint_watchers_.clear();
1927
2066
  }
1928
2067
  }
1929
2068
 
2069
+ RefCountedPtr<XdsClient::ChannelState> XdsClient::GetOrCreateChannelStateLocked(
2070
+ const XdsBootstrap::XdsServer& server) {
2071
+ auto it = xds_server_channel_map_.find(server);
2072
+ if (it != xds_server_channel_map_.end()) {
2073
+ return it->second->Ref(DEBUG_LOCATION, "Authority");
2074
+ }
2075
+ // Channel not found, so create a new one.
2076
+ auto channel_state = MakeRefCounted<ChannelState>(
2077
+ WeakRef(DEBUG_LOCATION, "ChannelState"), server);
2078
+ xds_server_channel_map_[server] = channel_state.get();
2079
+ return channel_state;
2080
+ }
2081
+
1930
2082
  void XdsClient::WatchListenerData(
1931
2083
  absl::string_view listener_name,
1932
2084
  std::unique_ptr<ListenerWatcherInterface> watcher) {
1933
2085
  std::string listener_name_str = std::string(listener_name);
1934
2086
  MutexLock lock(&mu_);
1935
- ListenerState& listener_state = listener_map_[listener_name_str];
1936
2087
  ListenerWatcherInterface* w = watcher.get();
2088
+ auto resource = XdsApi::ParseResourceName(listener_name, XdsApi::IsLds);
2089
+ if (!resource.ok()) {
2090
+ invalid_listener_watchers_[w] = std::move(watcher);
2091
+ grpc_error_handle error = GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrFormat(
2092
+ "Unable to parse resource name for listener %s", listener_name));
2093
+ w->OnError(GRPC_ERROR_REF(error));
2094
+ return;
2095
+ }
2096
+ AuthorityState& authority_state = authority_state_map_[resource->authority];
2097
+ ListenerState& listener_state = authority_state.listener_map[resource->id];
1937
2098
  listener_state.watchers[w] = std::move(watcher);
1938
2099
  // If we've already received an LDS update, notify the new watcher
1939
2100
  // immediately.
@@ -1944,7 +2105,13 @@ void XdsClient::WatchListenerData(
1944
2105
  }
1945
2106
  w->OnListenerChanged(*listener_state.update);
1946
2107
  }
1947
- chand_->SubscribeLocked(XdsApi::kLdsTypeUrl, listener_name_str);
2108
+ // If the authority doesn't yet have a channel, set it, creating it if needed.
2109
+ if (authority_state.channel_state == nullptr) {
2110
+ authority_state.channel_state =
2111
+ GetOrCreateChannelStateLocked(bootstrap_->server());
2112
+ }
2113
+ authority_state.channel_state->SubscribeLocked(XdsApi::kLdsTypeUrl,
2114
+ *resource);
1948
2115
  }
1949
2116
 
1950
2117
  void XdsClient::CancelListenerDataWatch(absl::string_view listener_name,
@@ -1952,16 +2119,22 @@ void XdsClient::CancelListenerDataWatch(absl::string_view listener_name,
1952
2119
  bool delay_unsubscription) {
1953
2120
  MutexLock lock(&mu_);
1954
2121
  if (shutting_down_) return;
1955
- std::string listener_name_str = std::string(listener_name);
1956
- ListenerState& listener_state = listener_map_[listener_name_str];
2122
+ auto resource = XdsApi::ParseResourceName(listener_name, XdsApi::IsLds);
2123
+ if (!resource.ok()) return;
2124
+ auto& authority_state = authority_state_map_[resource->authority];
2125
+ ListenerState& listener_state = authority_state.listener_map[resource->id];
1957
2126
  auto it = listener_state.watchers.find(watcher);
1958
- if (it != listener_state.watchers.end()) {
1959
- listener_state.watchers.erase(it);
1960
- if (listener_state.watchers.empty()) {
1961
- listener_map_.erase(listener_name_str);
1962
- chand_->UnsubscribeLocked(XdsApi::kLdsTypeUrl, listener_name_str,
1963
- delay_unsubscription);
1964
- }
2127
+ if (it == listener_state.watchers.end()) {
2128
+ invalid_listener_watchers_.erase(watcher);
2129
+ return;
2130
+ }
2131
+ listener_state.watchers.erase(it);
2132
+ if (!listener_state.watchers.empty()) return;
2133
+ authority_state.listener_map.erase(resource->id);
2134
+ xds_server_channel_map_[bootstrap_->server()]->UnsubscribeLocked(
2135
+ XdsApi::kLdsTypeUrl, *resource, delay_unsubscription);
2136
+ if (!authority_state.HasSubscribedResources()) {
2137
+ authority_state.channel_state.reset();
1965
2138
  }
1966
2139
  }
1967
2140
 
@@ -1970,9 +2143,19 @@ void XdsClient::WatchRouteConfigData(
1970
2143
  std::unique_ptr<RouteConfigWatcherInterface> watcher) {
1971
2144
  std::string route_config_name_str = std::string(route_config_name);
1972
2145
  MutexLock lock(&mu_);
1973
- RouteConfigState& route_config_state =
1974
- route_config_map_[route_config_name_str];
1975
2146
  RouteConfigWatcherInterface* w = watcher.get();
2147
+ auto resource = XdsApi::ParseResourceName(route_config_name, XdsApi::IsRds);
2148
+ if (!resource.ok()) {
2149
+ invalid_route_config_watchers_[w] = std::move(watcher);
2150
+ grpc_error_handle error = GRPC_ERROR_CREATE_FROM_CPP_STRING(
2151
+ absl::StrFormat("Unable to parse resource name for route config %s",
2152
+ route_config_name));
2153
+ w->OnError(GRPC_ERROR_REF(error));
2154
+ return;
2155
+ }
2156
+ auto& authority_state = authority_state_map_[resource->authority];
2157
+ RouteConfigState& route_config_state =
2158
+ authority_state.route_config_map[resource->id];
1976
2159
  route_config_state.watchers[w] = std::move(watcher);
1977
2160
  // If we've already received an RDS update, notify the new watcher
1978
2161
  // immediately.
@@ -1984,7 +2167,13 @@ void XdsClient::WatchRouteConfigData(
1984
2167
  }
1985
2168
  w->OnRouteConfigChanged(*route_config_state.update);
1986
2169
  }
1987
- chand_->SubscribeLocked(XdsApi::kRdsTypeUrl, route_config_name_str);
2170
+ // If the authority doesn't yet have a channel, set it, creating it if needed.
2171
+ if (authority_state.channel_state == nullptr) {
2172
+ authority_state.channel_state =
2173
+ GetOrCreateChannelStateLocked(bootstrap_->server());
2174
+ }
2175
+ authority_state.channel_state->SubscribeLocked(XdsApi::kRdsTypeUrl,
2176
+ *resource);
1988
2177
  }
1989
2178
 
1990
2179
  void XdsClient::CancelRouteConfigDataWatch(absl::string_view route_config_name,
@@ -1992,17 +2181,23 @@ void XdsClient::CancelRouteConfigDataWatch(absl::string_view route_config_name,
1992
2181
  bool delay_unsubscription) {
1993
2182
  MutexLock lock(&mu_);
1994
2183
  if (shutting_down_) return;
1995
- std::string route_config_name_str = std::string(route_config_name);
2184
+ auto resource = XdsApi::ParseResourceName(route_config_name, XdsApi::IsRds);
2185
+ if (!resource.ok()) return;
2186
+ auto& authority_state = authority_state_map_[resource->authority];
1996
2187
  RouteConfigState& route_config_state =
1997
- route_config_map_[route_config_name_str];
2188
+ authority_state.route_config_map[resource->id];
1998
2189
  auto it = route_config_state.watchers.find(watcher);
1999
- if (it != route_config_state.watchers.end()) {
2000
- route_config_state.watchers.erase(it);
2001
- if (route_config_state.watchers.empty()) {
2002
- route_config_map_.erase(route_config_name_str);
2003
- chand_->UnsubscribeLocked(XdsApi::kRdsTypeUrl, route_config_name_str,
2004
- delay_unsubscription);
2005
- }
2190
+ if (it == route_config_state.watchers.end()) {
2191
+ invalid_route_config_watchers_.erase(watcher);
2192
+ return;
2193
+ }
2194
+ route_config_state.watchers.erase(it);
2195
+ if (!route_config_state.watchers.empty()) return;
2196
+ authority_state.route_config_map.erase(resource->id);
2197
+ xds_server_channel_map_[bootstrap_->server()]->UnsubscribeLocked(
2198
+ XdsApi::kRdsTypeUrl, *resource, delay_unsubscription);
2199
+ if (!authority_state.HasSubscribedResources()) {
2200
+ authority_state.channel_state.reset();
2006
2201
  }
2007
2202
  }
2008
2203
 
@@ -2011,8 +2206,17 @@ void XdsClient::WatchClusterData(
2011
2206
  std::unique_ptr<ClusterWatcherInterface> watcher) {
2012
2207
  std::string cluster_name_str = std::string(cluster_name);
2013
2208
  MutexLock lock(&mu_);
2014
- ClusterState& cluster_state = cluster_map_[cluster_name_str];
2015
2209
  ClusterWatcherInterface* w = watcher.get();
2210
+ auto resource = XdsApi::ParseResourceName(cluster_name, XdsApi::IsCds);
2211
+ if (!resource.ok()) {
2212
+ invalid_cluster_watchers_[w] = std::move(watcher);
2213
+ grpc_error_handle error = GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrFormat(
2214
+ "Unable to parse resource name for cluster %s", cluster_name));
2215
+ w->OnError(GRPC_ERROR_REF(error));
2216
+ return;
2217
+ }
2218
+ auto& authority_state = authority_state_map_[resource->authority];
2219
+ ClusterState& cluster_state = authority_state.cluster_map[resource->id];
2016
2220
  cluster_state.watchers[w] = std::move(watcher);
2017
2221
  // If we've already received a CDS update, notify the new watcher
2018
2222
  // immediately.
@@ -2023,7 +2227,13 @@ void XdsClient::WatchClusterData(
2023
2227
  }
2024
2228
  w->OnClusterChanged(cluster_state.update.value());
2025
2229
  }
2026
- chand_->SubscribeLocked(XdsApi::kCdsTypeUrl, cluster_name_str);
2230
+ // If the authority doesn't yet have a channel, set it, creating it if needed.
2231
+ if (authority_state.channel_state == nullptr) {
2232
+ authority_state.channel_state =
2233
+ GetOrCreateChannelStateLocked(bootstrap_->server());
2234
+ }
2235
+ authority_state.channel_state->SubscribeLocked(XdsApi::kCdsTypeUrl,
2236
+ *resource);
2027
2237
  }
2028
2238
 
2029
2239
  void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
@@ -2031,16 +2241,22 @@ void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
2031
2241
  bool delay_unsubscription) {
2032
2242
  MutexLock lock(&mu_);
2033
2243
  if (shutting_down_) return;
2034
- std::string cluster_name_str = std::string(cluster_name);
2035
- ClusterState& cluster_state = cluster_map_[cluster_name_str];
2244
+ auto resource = XdsApi::ParseResourceName(cluster_name, XdsApi::IsCds);
2245
+ if (!resource.ok()) return;
2246
+ auto& authority_state = authority_state_map_[resource->authority];
2247
+ ClusterState& cluster_state = authority_state.cluster_map[resource->id];
2036
2248
  auto it = cluster_state.watchers.find(watcher);
2037
- if (it != cluster_state.watchers.end()) {
2038
- cluster_state.watchers.erase(it);
2039
- if (cluster_state.watchers.empty()) {
2040
- cluster_map_.erase(cluster_name_str);
2041
- chand_->UnsubscribeLocked(XdsApi::kCdsTypeUrl, cluster_name_str,
2042
- delay_unsubscription);
2043
- }
2249
+ if (it == cluster_state.watchers.end()) {
2250
+ invalid_cluster_watchers_.erase(watcher);
2251
+ return;
2252
+ }
2253
+ cluster_state.watchers.erase(it);
2254
+ if (!cluster_state.watchers.empty()) return;
2255
+ authority_state.cluster_map.erase(resource->id);
2256
+ xds_server_channel_map_[bootstrap_->server()]->UnsubscribeLocked(
2257
+ XdsApi::kCdsTypeUrl, *resource, delay_unsubscription);
2258
+ if (!authority_state.HasSubscribedResources()) {
2259
+ authority_state.channel_state.reset();
2044
2260
  }
2045
2261
  }
2046
2262
 
@@ -2049,8 +2265,18 @@ void XdsClient::WatchEndpointData(
2049
2265
  std::unique_ptr<EndpointWatcherInterface> watcher) {
2050
2266
  std::string eds_service_name_str = std::string(eds_service_name);
2051
2267
  MutexLock lock(&mu_);
2052
- EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
2053
2268
  EndpointWatcherInterface* w = watcher.get();
2269
+ auto resource = XdsApi::ParseResourceName(eds_service_name, XdsApi::IsEds);
2270
+ if (!resource.ok()) {
2271
+ invalid_endpoint_watchers_[w] = std::move(watcher);
2272
+ grpc_error_handle error = GRPC_ERROR_CREATE_FROM_CPP_STRING(
2273
+ absl::StrFormat("Unable to parse resource name for endpoint service %s",
2274
+ eds_service_name));
2275
+ w->OnError(GRPC_ERROR_REF(error));
2276
+ return;
2277
+ }
2278
+ auto& authority_state = authority_state_map_[resource->authority];
2279
+ EndpointState& endpoint_state = authority_state.endpoint_map[resource->id];
2054
2280
  endpoint_state.watchers[w] = std::move(watcher);
2055
2281
  // If we've already received an EDS update, notify the new watcher
2056
2282
  // immediately.
@@ -2061,7 +2287,13 @@ void XdsClient::WatchEndpointData(
2061
2287
  }
2062
2288
  w->OnEndpointChanged(endpoint_state.update.value());
2063
2289
  }
2064
- chand_->SubscribeLocked(XdsApi::kEdsTypeUrl, eds_service_name_str);
2290
+ // If the authority doesn't yet have a channel, set it, creating it if needed.
2291
+ if (authority_state.channel_state == nullptr) {
2292
+ authority_state.channel_state =
2293
+ GetOrCreateChannelStateLocked(bootstrap_->server());
2294
+ }
2295
+ authority_state.channel_state->SubscribeLocked(XdsApi::kEdsTypeUrl,
2296
+ *resource);
2065
2297
  }
2066
2298
 
2067
2299
  void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
@@ -2069,16 +2301,22 @@ void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
2069
2301
  bool delay_unsubscription) {
2070
2302
  MutexLock lock(&mu_);
2071
2303
  if (shutting_down_) return;
2072
- std::string eds_service_name_str = std::string(eds_service_name);
2073
- EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
2304
+ auto resource = XdsApi::ParseResourceName(eds_service_name, XdsApi::IsEds);
2305
+ if (!resource.ok()) return;
2306
+ auto& authority_state = authority_state_map_[resource->authority];
2307
+ EndpointState& endpoint_state = authority_state.endpoint_map[resource->id];
2074
2308
  auto it = endpoint_state.watchers.find(watcher);
2075
- if (it != endpoint_state.watchers.end()) {
2076
- endpoint_state.watchers.erase(it);
2077
- if (endpoint_state.watchers.empty()) {
2078
- endpoint_map_.erase(eds_service_name_str);
2079
- chand_->UnsubscribeLocked(XdsApi::kEdsTypeUrl, eds_service_name_str,
2080
- delay_unsubscription);
2081
- }
2309
+ if (it == endpoint_state.watchers.end()) {
2310
+ invalid_endpoint_watchers_.erase(watcher);
2311
+ return;
2312
+ }
2313
+ endpoint_state.watchers.erase(it);
2314
+ if (!endpoint_state.watchers.empty()) return;
2315
+ authority_state.endpoint_map.erase(resource->id);
2316
+ xds_server_channel_map_[bootstrap_->server()]->UnsubscribeLocked(
2317
+ XdsApi::kEdsTypeUrl, *resource, delay_unsubscription);
2318
+ if (!authority_state.HasSubscribedResources()) {
2319
+ authority_state.channel_state.reset();
2082
2320
  }
2083
2321
  }
2084
2322
 
@@ -2112,7 +2350,12 @@ RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
2112
2350
  it->first.second /*eds_service_name*/);
2113
2351
  load_report_state.drop_stats = cluster_drop_stats.get();
2114
2352
  }
2115
- chand_->MaybeStartLrsCall();
2353
+ auto resource = XdsApi::ParseResourceName(cluster_name, XdsApi::IsCds);
2354
+ GPR_ASSERT(resource.ok());
2355
+ auto a = authority_state_map_.find(resource->authority);
2356
+ if (a != authority_state_map_.end()) {
2357
+ a->second.channel_state->MaybeStartLrsCall();
2358
+ }
2116
2359
  return cluster_drop_stats;
2117
2360
  }
2118
2361
 
@@ -2169,7 +2412,12 @@ RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
2169
2412
  std::move(locality));
2170
2413
  locality_state.locality_stats = cluster_locality_stats.get();
2171
2414
  }
2172
- chand_->MaybeStartLrsCall();
2415
+ auto resource = XdsApi::ParseResourceName(cluster_name, XdsApi::IsCds);
2416
+ GPR_ASSERT(resource.ok());
2417
+ auto a = authority_state_map_.find(resource->authority);
2418
+ if (a != authority_state_map_.end()) {
2419
+ a->second.channel_state->MaybeStartLrsCall();
2420
+ }
2173
2421
  return cluster_locality_stats;
2174
2422
  }
2175
2423
 
@@ -2199,34 +2447,36 @@ void XdsClient::RemoveClusterLocalityStats(
2199
2447
 
2200
2448
  void XdsClient::ResetBackoff() {
2201
2449
  MutexLock lock(&mu_);
2202
- if (chand_ != nullptr) {
2203
- grpc_channel_reset_connect_backoff(chand_->channel());
2450
+ for (auto& p : xds_server_channel_map_) {
2451
+ grpc_channel_reset_connect_backoff(p.second->channel());
2204
2452
  }
2205
2453
  }
2206
2454
 
2207
2455
  void XdsClient::NotifyOnErrorLocked(grpc_error_handle error) {
2208
- for (const auto& p : listener_map_) {
2209
- const ListenerState& listener_state = p.second;
2210
- for (const auto& p : listener_state.watchers) {
2211
- p.first->OnError(GRPC_ERROR_REF(error));
2456
+ for (const auto& a : authority_state_map_) {
2457
+ for (const auto& p : a.second.listener_map) {
2458
+ const ListenerState& listener_state = p.second;
2459
+ for (const auto& p : listener_state.watchers) {
2460
+ p.first->OnError(GRPC_ERROR_REF(error));
2461
+ }
2212
2462
  }
2213
- }
2214
- for (const auto& p : route_config_map_) {
2215
- const RouteConfigState& route_config_state = p.second;
2216
- for (const auto& p : route_config_state.watchers) {
2217
- p.first->OnError(GRPC_ERROR_REF(error));
2463
+ for (const auto& p : a.second.route_config_map) {
2464
+ const RouteConfigState& route_config_state = p.second;
2465
+ for (const auto& p : route_config_state.watchers) {
2466
+ p.first->OnError(GRPC_ERROR_REF(error));
2467
+ }
2218
2468
  }
2219
- }
2220
- for (const auto& p : cluster_map_) {
2221
- const ClusterState& cluster_state = p.second;
2222
- for (const auto& p : cluster_state.watchers) {
2223
- p.first->OnError(GRPC_ERROR_REF(error));
2469
+ for (const auto& p : a.second.cluster_map) {
2470
+ const ClusterState& cluster_state = p.second;
2471
+ for (const auto& p : cluster_state.watchers) {
2472
+ p.first->OnError(GRPC_ERROR_REF(error));
2473
+ }
2224
2474
  }
2225
- }
2226
- for (const auto& p : endpoint_map_) {
2227
- const EndpointState& endpoint_state = p.second;
2228
- for (const auto& p : endpoint_state.watchers) {
2229
- p.first->OnError(GRPC_ERROR_REF(error));
2475
+ for (const auto& p : a.second.endpoint_map) {
2476
+ const EndpointState& endpoint_state = p.second;
2477
+ for (const auto& p : endpoint_state.watchers) {
2478
+ p.first->OnError(GRPC_ERROR_REF(error));
2479
+ }
2230
2480
  }
2231
2481
  }
2232
2482
  GRPC_ERROR_UNREF(error);
@@ -2316,34 +2566,36 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshotLocked(
2316
2566
  std::string XdsClient::DumpClientConfigBinary() {
2317
2567
  MutexLock lock(&mu_);
2318
2568
  XdsApi::ResourceTypeMetadataMap resource_type_metadata_map;
2319
- // Update per-xds-type version if available, this version corresponding to the
2320
- // last successful ADS update version.
2321
- for (auto& p : resource_version_map_) {
2322
- resource_type_metadata_map[p.first].version = p.second;
2323
- }
2324
- // Collect resource metadata from listeners
2325
- auto& lds_map =
2326
- resource_type_metadata_map[XdsApi::kLdsTypeUrl].resource_metadata_map;
2327
- for (auto& p : listener_map_) {
2328
- lds_map[p.first] = &p.second.meta;
2329
- }
2330
- // Collect resource metadata from route configs
2331
- auto& rds_map =
2332
- resource_type_metadata_map[XdsApi::kRdsTypeUrl].resource_metadata_map;
2333
- for (auto& p : route_config_map_) {
2334
- rds_map[p.first] = &p.second.meta;
2335
- }
2336
- // Collect resource metadata from clusters
2337
- auto& cds_map =
2338
- resource_type_metadata_map[XdsApi::kCdsTypeUrl].resource_metadata_map;
2339
- for (auto& p : cluster_map_) {
2340
- cds_map[p.first] = &p.second.meta;
2341
- }
2342
- // Collect resource metadata from endpoints
2343
- auto& eds_map =
2344
- resource_type_metadata_map[XdsApi::kEdsTypeUrl].resource_metadata_map;
2345
- for (auto& p : endpoint_map_) {
2346
- eds_map[p.first] = &p.second.meta;
2569
+ auto& lds_map = resource_type_metadata_map[XdsApi::kLdsTypeUrl];
2570
+ auto& rds_map = resource_type_metadata_map[XdsApi::kRdsTypeUrl];
2571
+ auto& cds_map = resource_type_metadata_map[XdsApi::kCdsTypeUrl];
2572
+ auto& eds_map = resource_type_metadata_map[XdsApi::kEdsTypeUrl];
2573
+ for (auto& a : authority_state_map_) {
2574
+ const std::string& authority = a.first;
2575
+ // Collect resource metadata from listeners
2576
+ for (auto& p : a.second.listener_map) {
2577
+ const std::string& listener_name = p.first;
2578
+ lds_map[XdsApi::ConstructFullResourceName(
2579
+ authority, XdsApi::kLdsTypeUrl, listener_name)] = &p.second.meta;
2580
+ }
2581
+ // Collect resource metadata from route configs
2582
+ for (auto& p : a.second.route_config_map) {
2583
+ const std::string& route_config_name = p.first;
2584
+ rds_map[XdsApi::ConstructFullResourceName(
2585
+ authority, XdsApi::kRdsTypeUrl, route_config_name)] = &p.second.meta;
2586
+ }
2587
+ // Collect resource metadata from clusters
2588
+ for (auto& p : a.second.cluster_map) {
2589
+ const std::string& cluster_name = p.first;
2590
+ cds_map[XdsApi::ConstructFullResourceName(authority, XdsApi::kCdsTypeUrl,
2591
+ cluster_name)] = &p.second.meta;
2592
+ }
2593
+ // Collect resource metadata from endpoints
2594
+ for (auto& p : a.second.endpoint_map) {
2595
+ const std::string& endpoint_name = p.first;
2596
+ eds_map[XdsApi::ConstructFullResourceName(
2597
+ authority, XdsApi::kEdsTypeUrl, endpoint_name)] = &p.second.meta;
2598
+ }
2347
2599
  }
2348
2600
  // Assemble config dump messages
2349
2601
  return api_.AssembleClientConfig(resource_type_metadata_map);
@@ -2501,7 +2753,7 @@ void XdsClientArgDestroy(void* p) {
2501
2753
  xds_client->Unref(DEBUG_LOCATION, "channel arg");
2502
2754
  }
2503
2755
 
2504
- int XdsClientArgCmp(void* p, void* q) { return GPR_ICMP(p, q); }
2756
+ int XdsClientArgCmp(void* p, void* q) { return QsortCompare(p, q); }
2505
2757
 
2506
2758
  const grpc_arg_pointer_vtable kXdsClientArgVtable = {
2507
2759
  XdsClientArgCopy, XdsClientArgDestroy, XdsClientArgCmp};