grpc 1.31.0.pre1 → 1.33.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 (614) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +693 -16022
  3. data/include/grpc/grpc.h +0 -5
  4. data/include/grpc/grpc_security.h +47 -14
  5. data/include/grpc/impl/codegen/README.md +22 -0
  6. data/include/grpc/impl/codegen/grpc_types.h +0 -5
  7. data/include/grpc/impl/codegen/port_platform.h +6 -1
  8. data/src/core/ext/filters/client_channel/backup_poller.cc +3 -2
  9. data/src/core/ext/filters/client_channel/client_channel.cc +264 -186
  10. data/src/core/ext/filters/client_channel/client_channel.h +1 -1
  11. data/src/core/ext/filters/client_channel/client_channel_channelz.h +0 -3
  12. data/src/core/ext/filters/client_channel/config_selector.cc +0 -4
  13. data/src/core/ext/filters/client_channel/config_selector.h +34 -5
  14. data/src/core/ext/filters/client_channel/health/health_check_client.cc +6 -1
  15. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -3
  16. data/src/core/ext/filters/client_channel/lb_policy.h +3 -1
  17. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +48 -35
  18. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
  19. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +9 -6
  20. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +126 -119
  21. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -13
  22. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +0 -3
  23. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -37
  24. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +21 -15
  25. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +32 -13
  26. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +8 -7
  27. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +9 -32
  28. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +26 -16
  29. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +207 -129
  30. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +453 -255
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/eds_drop.cc +571 -0
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +727 -0
  33. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +8 -1
  34. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
  35. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +3 -3
  36. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +1 -1
  37. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  38. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +1 -1
  39. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -1
  40. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +602 -58
  41. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +28 -0
  42. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +8 -39
  43. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +4 -3
  44. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +49 -47
  45. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +5 -9
  46. data/src/core/ext/filters/client_channel/server_address.cc +120 -7
  47. data/src/core/ext/filters/client_channel/server_address.h +48 -21
  48. data/src/core/ext/filters/client_channel/service_config.cc +16 -13
  49. data/src/core/ext/filters/client_channel/service_config.h +7 -4
  50. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +2 -2
  51. data/src/core/ext/filters/client_channel/service_config_parser.cc +8 -6
  52. data/src/core/ext/filters/client_channel/service_config_parser.h +8 -5
  53. data/src/core/ext/filters/client_channel/subchannel.cc +64 -23
  54. data/src/core/ext/filters/client_channel/subchannel.h +16 -4
  55. data/src/core/ext/filters/client_channel/subchannel_interface.h +44 -0
  56. data/src/core/ext/filters/max_age/max_age_filter.cc +2 -1
  57. data/src/core/ext/filters/message_size/message_size_filter.cc +2 -1
  58. data/src/core/ext/filters/message_size/message_size_filter.h +2 -1
  59. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +87 -31
  60. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +18 -1
  61. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +10 -35
  62. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +19 -25
  63. data/src/core/ext/transport/chttp2/server/chttp2_server.h +2 -1
  64. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +2 -2
  65. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +6 -6
  66. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +3 -2
  67. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +256 -287
  68. data/src/core/ext/transport/chttp2/transport/flow_control.cc +11 -3
  69. data/src/core/ext/transport/chttp2/transport/flow_control.h +10 -0
  70. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -2
  71. data/src/core/ext/transport/chttp2/transport/internal.h +10 -1
  72. data/src/core/ext/transport/chttp2/transport/parsing.cc +17 -30
  73. data/src/core/ext/transport/chttp2/transport/writing.cc +6 -5
  74. data/src/core/ext/transport/inproc/inproc_transport.cc +12 -12
  75. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +244 -0
  76. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +766 -0
  77. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +74 -0
  78. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +226 -0
  79. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +458 -0
  80. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1635 -0
  81. data/src/core/ext/upb-generated/envoy/{api/v2/cluster → config/cluster/v3}/filter.upb.c +8 -8
  82. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +69 -0
  83. data/src/core/ext/upb-generated/envoy/{api/v2/cluster → config/cluster/v3}/outlier_detection.upb.c +8 -8
  84. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +323 -0
  85. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +124 -0
  86. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +379 -0
  87. data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/backoff.upb.c +8 -8
  88. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +79 -0
  89. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +310 -0
  90. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +869 -0
  91. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +103 -0
  92. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +351 -0
  93. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +34 -0
  94. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +71 -0
  95. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +53 -0
  96. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +133 -0
  97. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +241 -0
  98. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +752 -0
  99. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +170 -0
  100. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +684 -0
  101. data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/http_uri.upb.c +8 -8
  102. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +80 -0
  103. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +176 -0
  104. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +645 -0
  105. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +28 -0
  106. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +58 -0
  107. data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/socket_option.upb.c +6 -6
  108. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +88 -0
  109. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +36 -0
  110. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +85 -0
  111. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +91 -0
  112. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +220 -0
  113. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +91 -0
  114. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +273 -0
  115. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +112 -0
  116. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +332 -0
  117. data/src/core/ext/upb-generated/envoy/config/listener/{v2 → v3}/api_listener.upb.c +8 -8
  118. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +65 -0
  119. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +128 -0
  120. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +467 -0
  121. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +155 -0
  122. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +539 -0
  123. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +41 -0
  124. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +94 -0
  125. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +178 -0
  126. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +616 -0
  127. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +63 -0
  128. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +204 -0
  129. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +900 -0
  130. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +3290 -0
  131. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +60 -0
  132. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +139 -0
  133. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +50 -0
  134. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +108 -0
  135. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +364 -0
  136. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1336 -0
  137. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +20 -0
  138. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +34 -0
  139. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +110 -0
  140. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +387 -0
  141. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +76 -0
  142. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +214 -0
  143. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +147 -0
  144. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +570 -0
  145. data/src/core/ext/upb-generated/envoy/{api/v2 → service/cluster/v3}/cds.upb.c +5 -6
  146. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +49 -0
  147. data/src/core/ext/upb-generated/envoy/service/discovery/{v2 → v3}/ads.upb.c +5 -4
  148. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +49 -0
  149. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +139 -0
  150. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +449 -0
  151. data/src/core/ext/upb-generated/envoy/{api/v2 → service/endpoint/v3}/eds.upb.c +5 -6
  152. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +49 -0
  153. data/src/core/ext/upb-generated/envoy/{api/v2 → service/listener/v3}/lds.upb.c +5 -6
  154. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +49 -0
  155. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +55 -0
  156. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +136 -0
  157. data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/rds.upb.c +5 -6
  158. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +49 -0
  159. data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/srds.upb.c +5 -6
  160. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +49 -0
  161. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +47 -0
  162. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +114 -0
  163. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +35 -0
  164. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +77 -0
  165. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +34 -0
  166. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +71 -0
  167. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +64 -0
  168. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +145 -0
  169. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +54 -0
  170. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +133 -0
  171. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +63 -0
  172. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +188 -0
  173. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +88 -0
  174. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +258 -0
  175. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +90 -0
  176. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +250 -0
  177. data/src/core/ext/upb-generated/envoy/type/{http.upb.c → v3/http.upb.c} +2 -2
  178. data/src/core/ext/upb-generated/envoy/type/{http.upb.h → v3/http.upb.h} +8 -8
  179. data/src/core/ext/upb-generated/envoy/type/{percent.upb.c → v3/percent.upb.c} +9 -8
  180. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +86 -0
  181. data/src/core/ext/upb-generated/envoy/type/{range.upb.c → v3/range.upb.c} +12 -11
  182. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +111 -0
  183. data/src/core/ext/upb-generated/envoy/type/{semantic_version.upb.c → v3/semantic_version.upb.c} +6 -5
  184. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +61 -0
  185. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +242 -0
  186. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +753 -0
  187. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +234 -0
  188. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +759 -0
  189. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +36 -36
  190. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +1 -1
  191. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +31 -0
  192. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +57 -0
  193. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +27 -0
  194. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +53 -0
  195. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.c +28 -0
  196. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +53 -0
  197. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +52 -0
  198. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +129 -0
  199. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +42 -0
  200. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +77 -0
  201. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +36 -0
  202. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +85 -0
  203. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +54 -0
  204. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +160 -0
  205. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +36 -0
  206. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +84 -0
  207. data/src/core/ext/upb-generated/validate/validate.upb.c +11 -11
  208. data/src/core/ext/upb-generated/validate/validate.upb.h +1 -1
  209. data/src/core/ext/xds/certificate_provider_factory.h +59 -0
  210. data/src/core/ext/xds/certificate_provider_registry.cc +103 -0
  211. data/src/core/ext/xds/certificate_provider_registry.h +57 -0
  212. data/src/core/ext/xds/certificate_provider_store.h +50 -0
  213. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.cc +377 -0
  214. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h +102 -0
  215. data/src/core/ext/xds/xds_api.cc +2596 -0
  216. data/src/core/ext/xds/xds_api.h +397 -0
  217. data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.cc +44 -2
  218. data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.h +8 -3
  219. data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_args.h +9 -6
  220. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.cc +541 -785
  221. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.h +114 -93
  222. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.cc +20 -14
  223. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.h +36 -8
  224. data/src/core/lib/channel/channel_args.h +0 -1
  225. data/src/core/lib/channel/channelz.cc +24 -60
  226. data/src/core/lib/channel/channelz.h +12 -20
  227. data/src/core/lib/channel/channelz_registry.cc +15 -12
  228. data/src/core/lib/channel/channelz_registry.h +3 -0
  229. data/src/core/lib/gpr/sync_posix.cc +2 -8
  230. data/src/core/lib/gpr/time_precise.cc +2 -0
  231. data/src/core/lib/gpr/time_precise.h +6 -2
  232. data/src/core/lib/gprpp/dual_ref_counted.h +336 -0
  233. data/src/core/lib/gprpp/ref_counted.h +51 -22
  234. data/src/core/lib/gprpp/ref_counted_ptr.h +153 -0
  235. data/src/core/lib/iomgr/endpoint.cc +5 -1
  236. data/src/core/lib/iomgr/endpoint.h +7 -3
  237. data/src/core/lib/iomgr/endpoint_cfstream.cc +36 -11
  238. data/src/core/lib/iomgr/ev_posix.cc +0 -2
  239. data/src/core/lib/iomgr/exec_ctx.h +10 -8
  240. data/src/core/lib/iomgr/iomgr.cc +0 -10
  241. data/src/core/lib/iomgr/iomgr.h +0 -10
  242. data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.cc +1 -1
  243. data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.h +3 -3
  244. data/src/core/lib/iomgr/sockaddr_utils.cc +2 -1
  245. data/src/core/lib/iomgr/sockaddr_utils.h +2 -1
  246. data/src/core/lib/iomgr/tcp_custom.cc +32 -16
  247. data/src/core/lib/iomgr/tcp_posix.cc +31 -13
  248. data/src/core/lib/iomgr/tcp_windows.cc +26 -10
  249. data/src/core/lib/json/json_util.cc +58 -0
  250. data/src/core/lib/json/json_util.h +37 -0
  251. data/src/core/lib/security/authorization/authorization_engine.cc +177 -0
  252. data/src/core/lib/security/authorization/authorization_engine.h +84 -0
  253. data/src/core/lib/security/authorization/evaluate_args.cc +153 -0
  254. data/src/core/lib/security/authorization/evaluate_args.h +59 -0
  255. data/src/core/lib/security/authorization/mock_cel/activation.h +57 -0
  256. data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +42 -0
  257. data/src/core/lib/security/authorization/mock_cel/cel_expression.h +68 -0
  258. data/src/core/lib/security/authorization/mock_cel/cel_value.h +93 -0
  259. data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +67 -0
  260. data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +56 -0
  261. data/src/core/lib/security/authorization/mock_cel/statusor.h +50 -0
  262. data/src/core/lib/security/certificate_provider.h +60 -0
  263. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +56 -38
  264. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +321 -0
  265. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +214 -0
  266. data/src/core/lib/security/credentials/xds/xds_credentials.cc +45 -0
  267. data/src/core/lib/security/credentials/xds/xds_credentials.h +51 -0
  268. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +7 -12
  269. data/src/core/lib/security/security_connector/ssl_utils.h +5 -0
  270. data/src/core/lib/security/transport/secure_endpoint.cc +7 -1
  271. data/src/core/lib/surface/call.cc +12 -12
  272. data/src/core/lib/surface/call.h +2 -1
  273. data/src/core/lib/surface/channel.cc +37 -51
  274. data/src/core/lib/surface/channel.h +18 -3
  275. data/src/core/lib/surface/completion_queue.cc +10 -272
  276. data/src/core/lib/surface/completion_queue.h +0 -8
  277. data/src/core/lib/surface/init.cc +27 -12
  278. data/src/core/lib/surface/server.cc +1066 -1244
  279. data/src/core/lib/surface/server.h +363 -87
  280. data/src/core/lib/surface/version.cc +2 -2
  281. data/src/core/lib/transport/authority_override.cc +38 -0
  282. data/src/core/lib/transport/authority_override.h +32 -0
  283. data/src/core/lib/transport/bdp_estimator.h +2 -1
  284. data/src/core/lib/transport/connectivity_state.cc +18 -13
  285. data/src/core/lib/transport/connectivity_state.h +20 -8
  286. data/src/core/lib/transport/error_utils.cc +13 -0
  287. data/src/core/lib/transport/error_utils.h +6 -0
  288. data/src/core/lib/transport/metadata.cc +11 -1
  289. data/src/core/lib/transport/static_metadata.cc +295 -276
  290. data/src/core/lib/transport/static_metadata.h +80 -73
  291. data/src/core/lib/transport/transport.h +7 -0
  292. data/src/core/lib/uri/uri_parser.cc +23 -21
  293. data/src/core/lib/uri/uri_parser.h +3 -1
  294. data/src/core/plugin_registry/grpc_plugin_registry.cc +35 -20
  295. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +22 -0
  296. data/src/core/tsi/ssl_transport_security.cc +2 -2
  297. data/src/ruby/bin/math_services_pb.rb +4 -4
  298. data/src/ruby/ext/grpc/rb_channel_credentials.c +9 -0
  299. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -4
  300. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +7 -7
  301. data/src/ruby/lib/grpc/generic/client_stub.rb +1 -1
  302. data/src/ruby/lib/grpc/version.rb +1 -1
  303. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +2 -2
  304. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +5 -0
  305. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +28 -12
  306. data/src/ruby/spec/channel_credentials_spec.rb +10 -0
  307. data/src/ruby/spec/generic/active_call_spec.rb +19 -8
  308. data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
  309. data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
  310. data/src/ruby/spec/pb/codegen/package_option_spec.rb +20 -0
  311. data/src/ruby/spec/user_agent_spec.rb +74 -0
  312. data/third_party/abseil-cpp/absl/algorithm/container.h +1727 -0
  313. data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +161 -0
  314. data/third_party/abseil-cpp/absl/base/internal/exponential_biased.cc +93 -0
  315. data/third_party/abseil-cpp/absl/base/internal/exponential_biased.h +130 -0
  316. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +620 -0
  317. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +126 -0
  318. data/third_party/abseil-cpp/absl/container/fixed_array.h +515 -0
  319. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +503 -0
  320. data/third_party/abseil-cpp/absl/container/internal/common.h +202 -0
  321. data/third_party/abseil-cpp/absl/container/internal/container_memory.h +440 -0
  322. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +146 -0
  323. data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +191 -0
  324. data/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h +85 -0
  325. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +269 -0
  326. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +297 -0
  327. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +30 -0
  328. data/third_party/abseil-cpp/absl/container/internal/have_sse.h +49 -0
  329. data/third_party/abseil-cpp/absl/container/internal/layout.h +741 -0
  330. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +48 -0
  331. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1882 -0
  332. data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +138 -0
  333. data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h +32 -0
  334. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +1895 -0
  335. data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +71 -0
  336. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +382 -0
  337. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +134 -0
  338. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +192 -0
  339. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +125 -0
  340. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +70 -0
  341. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +99 -0
  342. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +248 -0
  343. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +24 -0
  344. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +85 -0
  345. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +346 -0
  346. data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +128 -0
  347. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +194 -0
  348. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.h +158 -0
  349. data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +140 -0
  350. data/third_party/abseil-cpp/absl/debugging/stacktrace.h +231 -0
  351. data/third_party/abseil-cpp/absl/debugging/symbolize.cc +25 -0
  352. data/third_party/abseil-cpp/absl/debugging/symbolize.h +99 -0
  353. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +1480 -0
  354. data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +40 -0
  355. data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +81 -0
  356. data/third_party/abseil-cpp/absl/functional/function_ref.h +139 -0
  357. data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +106 -0
  358. data/third_party/abseil-cpp/absl/hash/hash.h +324 -0
  359. data/third_party/abseil-cpp/absl/hash/internal/city.cc +346 -0
  360. data/third_party/abseil-cpp/absl/hash/internal/city.h +96 -0
  361. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +55 -0
  362. data/third_party/abseil-cpp/absl/hash/internal/hash.h +988 -0
  363. data/third_party/abseil-cpp/absl/status/status.cc +447 -0
  364. data/third_party/abseil-cpp/absl/status/status.h +428 -0
  365. data/third_party/abseil-cpp/absl/status/status_payload_printer.cc +43 -0
  366. data/third_party/abseil-cpp/absl/status/status_payload_printer.h +51 -0
  367. data/third_party/abseil-cpp/absl/strings/cord.cc +2019 -0
  368. data/third_party/abseil-cpp/absl/strings/cord.h +1121 -0
  369. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +151 -0
  370. data/third_party/abseil-cpp/absl/synchronization/barrier.cc +52 -0
  371. data/third_party/abseil-cpp/absl/synchronization/barrier.h +79 -0
  372. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +57 -0
  373. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +99 -0
  374. data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +140 -0
  375. data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h +60 -0
  376. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +697 -0
  377. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h +141 -0
  378. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +155 -0
  379. data/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc +261 -0
  380. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +106 -0
  381. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +115 -0
  382. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +484 -0
  383. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +159 -0
  384. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +2728 -0
  385. data/third_party/abseil-cpp/absl/synchronization/mutex.h +1056 -0
  386. data/third_party/abseil-cpp/absl/synchronization/notification.cc +78 -0
  387. data/third_party/abseil-cpp/absl/synchronization/notification.h +123 -0
  388. data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +64 -0
  389. data/third_party/abseil-cpp/absl/types/bad_variant_access.h +82 -0
  390. data/third_party/abseil-cpp/absl/types/internal/variant.h +1646 -0
  391. data/third_party/abseil-cpp/absl/types/variant.h +861 -0
  392. data/third_party/boringssl-with-bazel/err_data.c +475 -467
  393. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +0 -6
  394. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +9 -43
  395. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa_asn1.c +55 -4
  396. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +34 -0
  397. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +4 -0
  398. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +16 -0
  399. data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.c +6 -2
  400. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
  401. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +4 -0
  402. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +30 -10
  403. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +10 -15
  404. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +543 -0
  405. data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +237 -0
  406. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +44 -2
  407. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +221 -49
  408. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +64 -20
  409. data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +3 -3
  410. data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +0 -8
  411. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +3 -3
  412. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +1 -1
  413. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +7 -2
  414. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +21 -18
  415. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -1
  416. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +24 -3
  417. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +3 -3
  418. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_txt.c +67 -67
  419. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +3 -3
  420. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +29 -35
  421. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +13 -2
  422. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +9 -8
  423. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +10 -10
  424. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +2 -2
  425. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +28 -40
  426. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +20 -0
  427. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
  428. data/third_party/boringssl-with-bazel/src/crypto/x509v3/ext_dat.h +1 -4
  429. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +7 -3
  430. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +2 -2
  431. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +1 -1
  432. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +55 -8
  433. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +1 -1
  434. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +52 -0
  435. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +0 -1
  436. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -2
  437. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +6 -0
  438. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +1 -1
  439. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +12 -0
  440. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +9 -0
  441. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +4 -1
  442. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +48 -9
  443. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +2 -3
  444. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +26 -6
  445. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +199 -78
  446. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +52 -43
  447. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +18 -18
  448. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -3
  449. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  450. data/third_party/boringssl-with-bazel/src/ssl/internal.h +13 -9
  451. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +3 -6
  452. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +8 -9
  453. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +10 -0
  454. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +34 -9
  455. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -2
  456. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +4 -8
  457. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +7 -2
  458. data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +5 -3
  459. data/third_party/re2/re2/bitmap256.h +117 -0
  460. data/third_party/re2/re2/bitstate.cc +385 -0
  461. data/third_party/re2/re2/compile.cc +1279 -0
  462. data/third_party/re2/re2/dfa.cc +2130 -0
  463. data/third_party/re2/re2/filtered_re2.cc +121 -0
  464. data/third_party/re2/re2/filtered_re2.h +109 -0
  465. data/third_party/re2/re2/mimics_pcre.cc +197 -0
  466. data/third_party/re2/re2/nfa.cc +713 -0
  467. data/third_party/re2/re2/onepass.cc +623 -0
  468. data/third_party/re2/re2/parse.cc +2464 -0
  469. data/third_party/re2/re2/perl_groups.cc +119 -0
  470. data/third_party/re2/re2/pod_array.h +55 -0
  471. data/third_party/re2/re2/prefilter.cc +710 -0
  472. data/third_party/re2/re2/prefilter.h +108 -0
  473. data/third_party/re2/re2/prefilter_tree.cc +407 -0
  474. data/third_party/re2/re2/prefilter_tree.h +139 -0
  475. data/third_party/re2/re2/prog.cc +988 -0
  476. data/third_party/re2/re2/prog.h +436 -0
  477. data/third_party/re2/re2/re2.cc +1362 -0
  478. data/third_party/re2/re2/re2.h +1002 -0
  479. data/third_party/re2/re2/regexp.cc +980 -0
  480. data/third_party/re2/re2/regexp.h +659 -0
  481. data/third_party/re2/re2/set.cc +154 -0
  482. data/third_party/re2/re2/set.h +80 -0
  483. data/third_party/re2/re2/simplify.cc +657 -0
  484. data/third_party/re2/re2/sparse_array.h +392 -0
  485. data/third_party/re2/re2/sparse_set.h +264 -0
  486. data/third_party/re2/re2/stringpiece.cc +65 -0
  487. data/third_party/re2/re2/stringpiece.h +210 -0
  488. data/third_party/re2/re2/tostring.cc +351 -0
  489. data/third_party/re2/re2/unicode_casefold.cc +582 -0
  490. data/third_party/re2/re2/unicode_casefold.h +78 -0
  491. data/third_party/re2/re2/unicode_groups.cc +6269 -0
  492. data/third_party/re2/re2/unicode_groups.h +67 -0
  493. data/third_party/re2/re2/walker-inl.h +246 -0
  494. data/third_party/re2/util/benchmark.h +156 -0
  495. data/third_party/re2/util/flags.h +26 -0
  496. data/third_party/re2/util/logging.h +109 -0
  497. data/third_party/re2/util/malloc_counter.h +19 -0
  498. data/third_party/re2/util/mix.h +41 -0
  499. data/third_party/re2/util/mutex.h +148 -0
  500. data/third_party/re2/util/pcre.cc +1025 -0
  501. data/third_party/re2/util/pcre.h +681 -0
  502. data/third_party/re2/util/rune.cc +260 -0
  503. data/third_party/re2/util/strutil.cc +149 -0
  504. data/third_party/re2/util/strutil.h +21 -0
  505. data/third_party/re2/util/test.h +50 -0
  506. data/third_party/re2/util/utf.h +44 -0
  507. data/third_party/re2/util/util.h +42 -0
  508. data/third_party/upb/upb/decode.c +64 -15
  509. data/third_party/upb/upb/encode.c +2 -2
  510. data/third_party/upb/upb/msg.h +2 -2
  511. data/third_party/upb/upb/port_def.inc +1 -1
  512. data/third_party/upb/upb/table.c +0 -11
  513. data/third_party/upb/upb/table.int.h +0 -9
  514. data/third_party/upb/upb/upb.c +16 -14
  515. data/third_party/upb/upb/upb.h +26 -0
  516. data/third_party/upb/upb/upb.hpp +2 -0
  517. metadata +340 -153
  518. data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +0 -528
  519. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +0 -1142
  520. data/src/core/ext/filters/client_channel/xds/xds_api.cc +0 -2110
  521. data/src/core/ext/filters/client_channel/xds/xds_api.h +0 -345
  522. data/src/core/ext/filters/client_channel/xds/xds_channel.h +0 -46
  523. data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +0 -106
  524. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -21
  525. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -34
  526. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +0 -114
  527. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +0 -429
  528. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +0 -72
  529. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +0 -198
  530. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +0 -105
  531. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +0 -388
  532. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +0 -52
  533. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +0 -403
  534. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +0 -1453
  535. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -74
  536. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +0 -226
  537. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +0 -69
  538. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +0 -323
  539. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -112
  540. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +0 -334
  541. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +0 -79
  542. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +0 -313
  543. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +0 -891
  544. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +0 -96
  545. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +0 -328
  546. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +0 -34
  547. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +0 -71
  548. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +0 -197
  549. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +0 -649
  550. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +0 -172
  551. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +0 -693
  552. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +0 -80
  553. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +0 -152
  554. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +0 -536
  555. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +0 -88
  556. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -129
  557. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +0 -386
  558. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +0 -52
  559. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +0 -92
  560. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +0 -224
  561. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -18
  562. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -32
  563. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +0 -91
  564. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +0 -273
  565. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -112
  566. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +0 -332
  567. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +0 -52
  568. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +0 -109
  569. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +0 -415
  570. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +0 -18
  571. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -32
  572. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +0 -145
  573. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +0 -538
  574. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +0 -43
  575. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +0 -111
  576. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +0 -52
  577. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +0 -63
  578. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +0 -204
  579. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +0 -18
  580. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -32
  581. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +0 -815
  582. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +0 -2984
  583. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +0 -59
  584. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +0 -135
  585. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +0 -52
  586. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +0 -228
  587. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +0 -732
  588. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +0 -316
  589. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +0 -1167
  590. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +0 -65
  591. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +0 -51
  592. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +0 -125
  593. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +0 -49
  594. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +0 -54
  595. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +0 -136
  596. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +0 -63
  597. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +0 -145
  598. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +0 -53
  599. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +0 -133
  600. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +0 -88
  601. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +0 -258
  602. data/src/core/ext/upb-generated/envoy/type/percent.upb.h +0 -86
  603. data/src/core/ext/upb-generated/envoy/type/range.upb.h +0 -111
  604. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +0 -61
  605. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +0 -89
  606. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +0 -250
  607. data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +0 -17
  608. data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -29
  609. data/src/core/lib/security/transport/target_authority_table.cc +0 -75
  610. data/src/core/lib/security/transport/target_authority_table.h +0 -40
  611. data/src/core/lib/slice/slice_hash_table.h +0 -199
  612. data/src/core/lib/slice/slice_weak_hash_table.h +0 -102
  613. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pku.c +0 -110
  614. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_sxnet.c +0 -274
@@ -219,11 +219,6 @@ GRPCAPI grpc_call* grpc_channel_create_call(
219
219
  grpc_completion_queue* completion_queue, grpc_slice method,
220
220
  const grpc_slice* host, gpr_timespec deadline, void* reserved);
221
221
 
222
- /** Ping the channels peer (load balanced channels will select one sub-channel
223
- to ping); if the channel is not connected, posts a failed. */
224
- GRPCAPI void grpc_channel_ping(grpc_channel* channel, grpc_completion_queue* cq,
225
- void* tag, void* reserved);
226
-
227
222
  /** Pre-register a method/host pair on a channel.
228
223
  method and host are not owned and must remain alive while the channel is
229
224
  alive. */
@@ -119,6 +119,18 @@ GRPCAPI void grpc_ssl_session_cache_destroy(grpc_ssl_session_cache* cache);
119
119
  GRPCAPI grpc_arg
120
120
  grpc_ssl_session_cache_create_channel_arg(grpc_ssl_session_cache* cache);
121
121
 
122
+ /** --- grpc_call_credentials object.
123
+
124
+ A call credentials object represents a way to authenticate on a particular
125
+ call. These credentials can be composed with a channel credentials object
126
+ so that they are sent with every call on this channel. */
127
+
128
+ typedef struct grpc_call_credentials grpc_call_credentials;
129
+
130
+ /** Releases a call credentials object.
131
+ The creator of the credentials object is responsible for its release. */
132
+ GRPCAPI void grpc_call_credentials_release(grpc_call_credentials* creds);
133
+
122
134
  /** --- grpc_channel_credentials object. ---
123
135
 
124
136
  A channel credentials object represents a way to authenticate a client on a
@@ -133,8 +145,23 @@ GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials* creds);
133
145
  /** Creates default credentials to connect to a google gRPC service.
134
146
  WARNING: Do NOT use this credentials to connect to a non-google service as
135
147
  this could result in an oauth2 token leak. The security level of the
136
- resulting connection is GRPC_PRIVACY_AND_INTEGRITY. */
137
- GRPCAPI grpc_channel_credentials* grpc_google_default_credentials_create(void);
148
+ resulting connection is GRPC_PRIVACY_AND_INTEGRITY.
149
+
150
+ If specified, the supplied call credentials object will be attached to the
151
+ returned channel credentials object. The call_credentials object must remain
152
+ valid throughout the lifetime of the returned grpc_channel_credentials
153
+ object. It is expected that the call credentials object was generated
154
+ according to the Application Default Credentials mechanism and asserts the
155
+ identity of the default service account of the machine. Supplying any other
156
+ sort of call credential will result in undefined behavior, up to and
157
+ including the sudden and unexpected failure of RPCs.
158
+
159
+ If nullptr is supplied, the returned channel credentials object will use a
160
+ call credentials object based on the Application Default Credentials
161
+ mechanism.
162
+ */
163
+ GRPCAPI grpc_channel_credentials* grpc_google_default_credentials_create(
164
+ grpc_call_credentials* call_credentials);
138
165
 
139
166
  /** Callback for getting the SSL roots override from the application.
140
167
  In case of success, *pem_roots_certs must be set to a NULL terminated string
@@ -272,24 +299,14 @@ GRPCAPI grpc_channel_credentials* grpc_ssl_credentials_create_ex(
272
299
  const char* pem_root_certs, grpc_ssl_pem_key_cert_pair* pem_key_cert_pair,
273
300
  const grpc_ssl_verify_peer_options* verify_options, void* reserved);
274
301
 
275
- /** --- grpc_call_credentials object.
276
-
277
- A call credentials object represents a way to authenticate on a particular
278
- call. These credentials can be composed with a channel credentials object
279
- so that they are sent with every call on this channel. */
280
-
281
- typedef struct grpc_call_credentials grpc_call_credentials;
282
-
283
- /** Releases a call credentials object.
284
- The creator of the credentials object is responsible for its release. */
285
- GRPCAPI void grpc_call_credentials_release(grpc_call_credentials* creds);
286
-
287
302
  /** Creates a composite channel credentials object. The security level of
288
303
  * resulting connection is determined by channel_creds. */
289
304
  GRPCAPI grpc_channel_credentials* grpc_composite_channel_credentials_create(
290
305
  grpc_channel_credentials* channel_creds, grpc_call_credentials* call_creds,
291
306
  void* reserved);
292
307
 
308
+ /** --- composite credentials. */
309
+
293
310
  /** Creates a composite call credentials object. */
294
311
  GRPCAPI grpc_call_credentials* grpc_composite_call_credentials_create(
295
312
  grpc_call_credentials* creds1, grpc_call_credentials* creds2,
@@ -1012,6 +1029,22 @@ grpc_channel_credentials* grpc_tls_credentials_create(
1012
1029
  grpc_server_credentials* grpc_tls_server_credentials_create(
1013
1030
  grpc_tls_credentials_options* options);
1014
1031
 
1032
+ /**
1033
+ * EXPERIMENTAL API - Subject to change
1034
+ *
1035
+ * This method creates an XDS channel credentials object.
1036
+ *
1037
+ * Creating a channel with credentials of this type indicates that an xDS
1038
+ * channel should get credentials configuration from the xDS control plane.
1039
+ *
1040
+ * \a fallback_credentials are used if the channel target does not have the
1041
+ * 'xds:///' scheme or if the xDS control plane does not provide information on
1042
+ * how to fetch credentials dynamically. Does NOT take ownership of the \a
1043
+ * fallback_credentials. (Internally takes a ref to the object.)
1044
+ */
1045
+ GRPCAPI grpc_channel_credentials* grpc_xds_credentials_create(
1046
+ grpc_channel_credentials* fallback_credentials);
1047
+
1015
1048
  #ifdef __cplusplus
1016
1049
  }
1017
1050
  #endif
@@ -0,0 +1,22 @@
1
+ # Welcome to `include/grpc/impl/codegen`
2
+
3
+ ## Why is this directory here?
4
+
5
+ This directory exists so that generated C++ code can include selected files upon
6
+ which it depends without having to depend on the entire gRPC C++ library. This
7
+ directory thus exists to support `include/grpcpp/impl/codegen`. This constraint
8
+ is particularly relevant for users of bazel, particularly if they use the
9
+ multi-lingual `proto_library` target type. Generated code that uses this target
10
+ only depends on the gRPC C++ targets associated with these header files, not the
11
+ entire gRPC C++ codebase since that would make the build time of these types of
12
+ targets excessively large (particularly when they are not even C++ specific).
13
+
14
+ ## What should user code do?
15
+
16
+ User code should *not* include anything from this directory. Only generated code
17
+ and gRPC library code should include contents from this directory. C++ user code
18
+ should instead include contents from the main `grpcpp` directory or its
19
+ accessible subcomponents like `grpcpp/support`. It is possible that we may
20
+ remove this directory altogether if the motivations for its existence are no
21
+ longer strong enough (e.g., if the gRPC C++ library no longer has a need for an
22
+ `impl/codegen` directory of its own).
@@ -355,11 +355,6 @@ typedef struct {
355
355
  over to the next priority. Default value is 10 seconds. */
356
356
  #define GRPC_ARG_PRIORITY_FAILOVER_TIMEOUT_MS \
357
357
  "grpc.priority_failover_timeout_ms"
358
- /* Timeout in milliseconds to wait for a resource to be returned from
359
- * the xds server before assuming that it does not exist.
360
- * The default is 15 seconds. */
361
- #define GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS \
362
- "grpc.xds_resource_does_not_exist_timeout_ms"
363
358
  /** If non-zero, grpc server's cronet compression workaround will be enabled */
364
359
  #define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \
365
360
  "grpc.workaround.cronet_compression"
@@ -31,8 +31,13 @@
31
31
  * Defines GPR_ABSEIL_SYNC to use synchronization features from Abseil
32
32
  */
33
33
  #ifndef GPR_ABSEIL_SYNC
34
- /* #define GPR_ABSEIL_SYNC 1 */
34
+ #if defined(__APPLE__)
35
+ // This is disabled on Apple platforms because macos/grpc_basictests_c_cpp
36
+ // fails with this. https://github.com/grpc/grpc/issues/23661
37
+ #else
38
+ #define GPR_ABSEIL_SYNC 1
35
39
  #endif
40
+ #endif // GPR_ABSEIL_SYNC
36
41
 
37
42
  /* Get windows.h included everywhere (we need it) */
38
43
  #if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
@@ -106,6 +106,7 @@ static void g_poller_unref() {
106
106
  grpc_schedule_on_exec_ctx));
107
107
  gpr_mu_unlock(p->pollset_mu);
108
108
  grpc_timer_cancel(&p->polling_timer);
109
+ backup_poller_shutdown_unref(p);
109
110
  } else {
110
111
  gpr_mu_unlock(&g_poller_mu);
111
112
  }
@@ -143,8 +144,8 @@ static void g_poller_init_locked() {
143
144
  g_poller->shutting_down = false;
144
145
  grpc_pollset_init(g_poller->pollset, &g_poller->pollset_mu);
145
146
  gpr_ref_init(&g_poller->refs, 0);
146
- // one for timer cancellation, one for pollset shutdown
147
- gpr_ref_init(&g_poller->shutdown_refs, 2);
147
+ // one for timer cancellation, one for pollset shutdown, one for g_poller
148
+ gpr_ref_init(&g_poller->shutdown_refs, 3);
148
149
  GRPC_CLOSURE_INIT(&g_poller->run_poller_closure, run_poller, g_poller,
149
150
  grpc_schedule_on_exec_ctx);
150
151
  grpc_timer_init(&g_poller->polling_timer,
@@ -28,6 +28,8 @@
28
28
 
29
29
  #include <set>
30
30
 
31
+ #include "absl/strings/numbers.h"
32
+ #include "absl/strings/str_cat.h"
31
33
  #include "absl/strings/string_view.h"
32
34
 
33
35
  #include <grpc/support/alloc.h>
@@ -214,7 +216,8 @@ class ChannelData {
214
216
  grpc_closure* on_complete,
215
217
  bool cancel);
216
218
 
217
- void Notify(grpc_connectivity_state state) override;
219
+ void Notify(grpc_connectivity_state state,
220
+ const absl::Status& /* status */) override;
218
221
 
219
222
  void Cancel();
220
223
 
@@ -238,17 +241,15 @@ class ChannelData {
238
241
  public:
239
242
  explicit ChannelConfigHelper(ChannelData* chand) : chand_(chand) {}
240
243
 
241
- ApplyServiceConfigResult ApplyServiceConfig(
244
+ ChooseServiceConfigResult ChooseServiceConfig(
242
245
  const Resolver::Result& result) override;
243
246
 
244
- void ApplyConfigSelector(
245
- bool service_config_changed,
246
- RefCountedPtr<ConfigSelector> config_selector) override;
247
+ void StartUsingServiceConfigForCalls() override;
247
248
 
248
249
  void ResolverTransientFailure(grpc_error* error) override;
249
250
 
250
251
  private:
251
- static void ProcessLbPolicy(
252
+ static void ChooseLbPolicy(
252
253
  const Resolver::Result& resolver_result,
253
254
  const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
254
255
  RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config);
@@ -260,12 +261,17 @@ class ChannelData {
260
261
  ~ChannelData();
261
262
 
262
263
  void UpdateStateAndPickerLocked(
263
- grpc_connectivity_state state, const char* reason,
264
+ grpc_connectivity_state state, const absl::Status& status,
265
+ const char* reason,
264
266
  std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker);
265
267
 
266
- void UpdateServiceConfigInDataPlaneLocked(
267
- bool service_config_changed,
268
- RefCountedPtr<ConfigSelector> config_selector);
268
+ void UpdateServiceConfigInControlPlaneLocked(
269
+ RefCountedPtr<ServiceConfig> service_config,
270
+ RefCountedPtr<ConfigSelector> config_selector,
271
+ const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
272
+ const char* lb_policy_name);
273
+
274
+ void UpdateServiceConfigInDataPlaneLocked();
269
275
 
270
276
  void CreateResolvingLoadBalancingPolicyLocked();
271
277
 
@@ -316,7 +322,6 @@ class ChannelData {
316
322
  grpc_core::UniquePtr<char> health_check_service_name_;
317
323
  RefCountedPtr<ServiceConfig> saved_service_config_;
318
324
  RefCountedPtr<ConfigSelector> saved_config_selector_;
319
- bool received_first_resolver_result_ = false;
320
325
  // The number of SubchannelWrapper instances referencing a given Subchannel.
321
326
  std::map<Subchannel*, int> subchannel_refcount_map_;
322
327
  // The set of SubchannelWrappers that currently exist.
@@ -328,6 +333,7 @@ class ChannelData {
328
333
  // applied in the data plane mutex when the picker is updated.
329
334
  std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>>
330
335
  pending_subchannel_updates_;
336
+ int keepalive_time_ = -1;
331
337
 
332
338
  //
333
339
  // Fields accessed from both data plane mutex and control plane
@@ -876,6 +882,9 @@ class CallData {
876
882
  // ChannelData::SubchannelWrapper
877
883
  //
878
884
 
885
+ using ServerAddressAttributeMap =
886
+ std::map<const char*, std::unique_ptr<ServerAddress::AttributeInterface>>;
887
+
879
888
  // This class is a wrapper for Subchannel that hides details of the
880
889
  // channel's implementation (such as the health check service name and
881
890
  // connected subchannel) from the LB policy API.
@@ -887,11 +896,13 @@ class CallData {
887
896
  class ChannelData::SubchannelWrapper : public SubchannelInterface {
888
897
  public:
889
898
  SubchannelWrapper(ChannelData* chand, Subchannel* subchannel,
890
- grpc_core::UniquePtr<char> health_check_service_name)
899
+ grpc_core::UniquePtr<char> health_check_service_name,
900
+ ServerAddressAttributeMap attributes)
891
901
  : SubchannelInterface(&grpc_client_channel_routing_trace),
892
902
  chand_(chand),
893
903
  subchannel_(subchannel),
894
- health_check_service_name_(std::move(health_check_service_name)) {
904
+ health_check_service_name_(std::move(health_check_service_name)),
905
+ attributes_(std::move(attributes)) {
895
906
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
896
907
  gpr_log(GPR_INFO,
897
908
  "chand=%p: creating subchannel wrapper %p for subchannel %p",
@@ -973,6 +984,17 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
973
984
  return subchannel_->channel_args();
974
985
  }
975
986
 
987
+ const ServerAddress::AttributeInterface* GetAttribute(
988
+ const char* key) const override {
989
+ auto it = attributes_.find(key);
990
+ if (it == attributes_.end()) return nullptr;
991
+ return it->second.get();
992
+ }
993
+
994
+ void ThrottleKeepaliveTime(int new_keepalive_time) {
995
+ subchannel_->ThrottleKeepaliveTime(new_keepalive_time);
996
+ }
997
+
976
998
  void UpdateHealthCheckServiceName(
977
999
  grpc_core::UniquePtr<char> health_check_service_name) {
978
1000
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
@@ -1099,6 +1121,32 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
1099
1121
  watcher_.get());
1100
1122
  }
1101
1123
  ConnectivityStateChange state_change = PopConnectivityStateChange();
1124
+ absl::optional<absl::Cord> keepalive_throttling =
1125
+ state_change.status.GetPayload(grpc_core::kKeepaliveThrottlingKey);
1126
+ if (keepalive_throttling.has_value()) {
1127
+ int new_keepalive_time = -1;
1128
+ if (absl::SimpleAtoi(std::string(keepalive_throttling.value()),
1129
+ &new_keepalive_time)) {
1130
+ if (new_keepalive_time > parent_->chand_->keepalive_time_) {
1131
+ parent_->chand_->keepalive_time_ = new_keepalive_time;
1132
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1133
+ gpr_log(GPR_INFO, "chand=%p: throttling keepalive time to %d",
1134
+ parent_->chand_, parent_->chand_->keepalive_time_);
1135
+ }
1136
+ // Propagate the new keepalive time to all subchannels. This is so
1137
+ // that new transports created by any subchannel (and not just the
1138
+ // subchannel that received the GOAWAY), use the new keepalive time.
1139
+ for (auto* subchannel_wrapper :
1140
+ parent_->chand_->subchannel_wrappers_) {
1141
+ subchannel_wrapper->ThrottleKeepaliveTime(new_keepalive_time);
1142
+ }
1143
+ }
1144
+ } else {
1145
+ gpr_log(GPR_ERROR, "chand=%p: Illegal keepalive throttling value %s",
1146
+ parent_->chand_,
1147
+ std::string(keepalive_throttling.value()).c_str());
1148
+ }
1149
+ }
1102
1150
  // Ignore update if the parent WatcherWrapper has been replaced
1103
1151
  // since this callback was scheduled.
1104
1152
  if (watcher_ != nullptr) {
@@ -1140,6 +1188,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
1140
1188
  ChannelData* chand_;
1141
1189
  Subchannel* subchannel_;
1142
1190
  grpc_core::UniquePtr<char> health_check_service_name_;
1191
+ ServerAddressAttributeMap attributes_;
1143
1192
  // Maps from the address of the watcher passed to us by the LB policy
1144
1193
  // to the address of the WrapperWatcher that we passed to the underlying
1145
1194
  // subchannel. This is needed so that when the LB policy calls
@@ -1212,7 +1261,7 @@ void ChannelData::ExternalConnectivityWatcher::
1212
1261
  }
1213
1262
 
1214
1263
  void ChannelData::ExternalConnectivityWatcher::Notify(
1215
- grpc_connectivity_state state) {
1264
+ grpc_connectivity_state state, const absl::Status& /* status */) {
1216
1265
  bool done = false;
1217
1266
  if (!done_.CompareExchangeStrong(&done, true, MemoryOrder::RELAXED,
1218
1267
  MemoryOrder::RELAXED)) {
@@ -1314,6 +1363,18 @@ class ChannelData::ConnectivityWatcherRemover {
1314
1363
  // ChannelData::ClientChannelControlHelper
1315
1364
  //
1316
1365
 
1366
+ } // namespace
1367
+
1368
+ // Allows accessing the attributes from a ServerAddress.
1369
+ class ChannelServerAddressPeer {
1370
+ public:
1371
+ static ServerAddressAttributeMap GetAttributes(ServerAddress* address) {
1372
+ return std::move(address->attributes_);
1373
+ }
1374
+ };
1375
+
1376
+ namespace {
1377
+
1317
1378
  class ChannelData::ClientChannelControlHelper
1318
1379
  : public LoadBalancingPolicy::ChannelControlHelper {
1319
1380
  public:
@@ -1327,7 +1388,8 @@ class ChannelData::ClientChannelControlHelper
1327
1388
  }
1328
1389
 
1329
1390
  RefCountedPtr<SubchannelInterface> CreateSubchannel(
1330
- const grpc_channel_args& args) override {
1391
+ ServerAddress address, const grpc_channel_args& args) override {
1392
+ // Determine health check service name.
1331
1393
  bool inhibit_health_checking = grpc_channel_arg_get_bool(
1332
1394
  grpc_channel_args_find(&args, GRPC_ARG_INHIBIT_HEALTH_CHECKING), false);
1333
1395
  grpc_core::UniquePtr<char> health_check_service_name;
@@ -1335,36 +1397,55 @@ class ChannelData::ClientChannelControlHelper
1335
1397
  health_check_service_name.reset(
1336
1398
  gpr_strdup(chand_->health_check_service_name_.get()));
1337
1399
  }
1400
+ // Remove channel args that should not affect subchannel uniqueness.
1338
1401
  static const char* args_to_remove[] = {
1339
1402
  GRPC_ARG_INHIBIT_HEALTH_CHECKING,
1340
1403
  GRPC_ARG_CHANNELZ_CHANNEL_NODE,
1341
1404
  };
1342
- grpc_arg arg = SubchannelPoolInterface::CreateChannelArg(
1343
- chand_->subchannel_pool_.get());
1405
+ // Add channel args needed for the subchannel.
1406
+ absl::InlinedVector<grpc_arg, 3> args_to_add = {
1407
+ Subchannel::CreateSubchannelAddressArg(&address.address()),
1408
+ SubchannelPoolInterface::CreateChannelArg(
1409
+ chand_->subchannel_pool_.get()),
1410
+ };
1411
+ if (address.args() != nullptr) {
1412
+ for (size_t j = 0; j < address.args()->num_args; ++j) {
1413
+ args_to_add.emplace_back(address.args()->args[j]);
1414
+ }
1415
+ }
1344
1416
  grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(
1345
- &args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), &arg, 1);
1417
+ &args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove),
1418
+ args_to_add.data(), args_to_add.size());
1419
+ gpr_free(args_to_add[0].value.string);
1420
+ // Create subchannel.
1346
1421
  Subchannel* subchannel =
1347
1422
  chand_->client_channel_factory_->CreateSubchannel(new_args);
1348
1423
  grpc_channel_args_destroy(new_args);
1349
1424
  if (subchannel == nullptr) return nullptr;
1425
+ // Make sure the subchannel has updated keepalive time.
1426
+ subchannel->ThrottleKeepaliveTime(chand_->keepalive_time_);
1427
+ // Create and return wrapper for the subchannel.
1350
1428
  return MakeRefCounted<SubchannelWrapper>(
1351
- chand_, subchannel, std::move(health_check_service_name));
1429
+ chand_, subchannel, std::move(health_check_service_name),
1430
+ ChannelServerAddressPeer::GetAttributes(&address));
1352
1431
  }
1353
1432
 
1354
1433
  void UpdateState(
1355
- grpc_connectivity_state state,
1434
+ grpc_connectivity_state state, const absl::Status& status,
1356
1435
  std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) override {
1357
1436
  grpc_error* disconnect_error = chand_->disconnect_error();
1358
1437
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1359
1438
  const char* extra = disconnect_error == GRPC_ERROR_NONE
1360
1439
  ? ""
1361
1440
  : " (ignoring -- channel shutting down)";
1362
- gpr_log(GPR_INFO, "chand=%p: update: state=%s picker=%p%s", chand_,
1363
- ConnectivityStateName(state), picker.get(), extra);
1441
+ gpr_log(GPR_INFO, "chand=%p: update: state=%s status=(%s) picker=%p%s",
1442
+ chand_, ConnectivityStateName(state), status.ToString().c_str(),
1443
+ picker.get(), extra);
1364
1444
  }
1365
1445
  // Do update only if not shutting down.
1366
1446
  if (disconnect_error == GRPC_ERROR_NONE) {
1367
- chand_->UpdateStateAndPickerLocked(state, "helper", std::move(picker));
1447
+ chand_->UpdateStateAndPickerLocked(state, status, "helper",
1448
+ std::move(picker));
1368
1449
  }
1369
1450
  }
1370
1451
 
@@ -1395,19 +1476,19 @@ class ChannelData::ClientChannelControlHelper
1395
1476
  // ChannelData::ChannelConfigHelper
1396
1477
  //
1397
1478
 
1398
- // Synchronous callback from ResolvingLoadBalancingPolicy to process a
1399
- // resolver result update.
1400
- ChannelData::ChannelConfigHelper::ApplyServiceConfigResult
1401
- ChannelData::ChannelConfigHelper::ApplyServiceConfig(
1479
+ ChannelData::ChannelConfigHelper::ChooseServiceConfigResult
1480
+ ChannelData::ChannelConfigHelper::ChooseServiceConfig(
1402
1481
  const Resolver::Result& result) {
1403
- ApplyServiceConfigResult service_config_result;
1482
+ ChooseServiceConfigResult service_config_result;
1404
1483
  RefCountedPtr<ServiceConfig> service_config;
1405
- // If resolver did not return a service config or returned an invalid service
1406
- // config, we need a fallback service config.
1484
+ RefCountedPtr<ConfigSelector> config_selector;
1407
1485
  if (result.service_config_error != GRPC_ERROR_NONE) {
1408
- // If the service config was invalid, then fallback to the saved service
1409
- // config. If there is no saved config either, use the default service
1410
- // config.
1486
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1487
+ gpr_log(GPR_INFO, "chand=%p: resolver returned service config error: %s",
1488
+ chand_, grpc_error_string(result.service_config_error));
1489
+ }
1490
+ // If the service config was invalid, then fallback to the
1491
+ // previously returned service config.
1411
1492
  if (chand_->saved_service_config_ != nullptr) {
1412
1493
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1413
1494
  gpr_log(GPR_INFO,
@@ -1416,99 +1497,60 @@ ChannelData::ChannelConfigHelper::ApplyServiceConfig(
1416
1497
  chand_);
1417
1498
  }
1418
1499
  service_config = chand_->saved_service_config_;
1419
- } else if (chand_->default_service_config_ != nullptr) {
1420
- if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1421
- gpr_log(GPR_INFO,
1422
- "chand=%p: resolver returned invalid service config. Using "
1423
- "default service config provided by client API.",
1424
- chand_);
1425
- }
1426
- service_config = chand_->default_service_config_;
1500
+ config_selector = chand_->saved_config_selector_;
1501
+ } else {
1502
+ // No previously returned config, so put the channel into
1503
+ // TRANSIENT_FAILURE.
1504
+ service_config_result.no_valid_service_config = true;
1505
+ return service_config_result;
1427
1506
  }
1428
1507
  } else if (result.service_config == nullptr) {
1429
- if (chand_->default_service_config_ != nullptr) {
1430
- if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1431
- gpr_log(GPR_INFO,
1432
- "chand=%p: resolver returned no service config. Using default "
1433
- "service config provided by client API.",
1434
- chand_);
1435
- }
1436
- service_config = chand_->default_service_config_;
1508
+ // Resolver did not return any service config.
1509
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1510
+ gpr_log(GPR_INFO,
1511
+ "chand=%p: resolver returned no service config. Using default "
1512
+ "service config for channel.",
1513
+ chand_);
1437
1514
  }
1515
+ service_config = chand_->default_service_config_;
1438
1516
  } else {
1517
+ // Use ServiceConfig and ConfigSelector returned by resolver.
1439
1518
  service_config = result.service_config;
1519
+ config_selector = ConfigSelector::GetFromChannelArgs(*result.args);
1440
1520
  }
1441
- service_config_result.service_config_error =
1442
- GRPC_ERROR_REF(result.service_config_error);
1443
- if (service_config == nullptr &&
1444
- result.service_config_error != GRPC_ERROR_NONE) {
1445
- service_config_result.no_valid_service_config = true;
1446
- return service_config_result;
1447
- }
1448
- // Process service config.
1449
- grpc_core::UniquePtr<char> service_config_json;
1521
+ GPR_ASSERT(service_config != nullptr);
1522
+ // Extract global config for client channel.
1450
1523
  const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
1451
- nullptr;
1452
- if (service_config != nullptr) {
1453
- parsed_service_config =
1454
- static_cast<const internal::ClientChannelGlobalParsedConfig*>(
1455
- service_config->GetGlobalParsedConfig(
1456
- internal::ClientChannelServiceConfigParser::ParserIndex()));
1457
- }
1458
- // Check if the config has changed.
1524
+ static_cast<const internal::ClientChannelGlobalParsedConfig*>(
1525
+ service_config->GetGlobalParsedConfig(
1526
+ internal::ClientChannelServiceConfigParser::ParserIndex()));
1527
+ // Find LB policy config.
1528
+ ChooseLbPolicy(result, parsed_service_config,
1529
+ &service_config_result.lb_policy_config);
1530
+ // Check if the ServiceConfig has changed.
1531
+ const bool service_config_changed =
1532
+ chand_->saved_service_config_ == nullptr ||
1533
+ service_config->json_string() !=
1534
+ chand_->saved_service_config_->json_string();
1535
+ // Check if the ConfigSelector has changed.
1536
+ const bool config_selector_changed = !ConfigSelector::Equals(
1537
+ chand_->saved_config_selector_.get(), config_selector.get());
1538
+ // Indicate a change if either the ServiceConfig or ConfigSelector have
1539
+ // changed.
1459
1540
  service_config_result.service_config_changed =
1460
- ((service_config == nullptr) !=
1461
- (chand_->saved_service_config_ == nullptr)) ||
1462
- (service_config != nullptr &&
1463
- service_config->json_string() !=
1464
- chand_->saved_service_config_->json_string());
1541
+ service_config_changed || config_selector_changed;
1542
+ // If it has, apply the global parameters now.
1465
1543
  if (service_config_result.service_config_changed) {
1466
- service_config_json.reset(gpr_strdup(
1467
- service_config != nullptr ? service_config->json_string().c_str()
1468
- : ""));
1469
- if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1470
- gpr_log(GPR_INFO,
1471
- "chand=%p: resolver returned updated service config: \"%s\"",
1472
- chand_, service_config_json.get());
1473
- }
1474
- // Save health check service name.
1475
- if (service_config != nullptr) {
1476
- chand_->health_check_service_name_.reset(
1477
- gpr_strdup(parsed_service_config->health_check_service_name()));
1478
- } else {
1479
- chand_->health_check_service_name_.reset();
1480
- }
1481
- // Update health check service name used by existing subchannel wrappers.
1482
- for (auto* subchannel_wrapper : chand_->subchannel_wrappers_) {
1483
- subchannel_wrapper->UpdateHealthCheckServiceName(
1484
- grpc_core::UniquePtr<char>(
1485
- gpr_strdup(chand_->health_check_service_name_.get())));
1486
- }
1487
- // Save service config.
1488
- chand_->saved_service_config_ = std::move(service_config);
1489
- }
1490
- // Find LB policy config.
1491
- ProcessLbPolicy(result, parsed_service_config,
1492
- &service_config_result.lb_policy_config);
1493
- grpc_core::UniquePtr<char> lb_policy_name(
1494
- gpr_strdup((service_config_result.lb_policy_config)->name()));
1495
- // Swap out the data used by GetChannelInfo().
1496
- {
1497
- MutexLock lock(&chand_->info_mu_);
1498
- chand_->info_lb_policy_name_ = std::move(lb_policy_name);
1499
- if (service_config_json != nullptr) {
1500
- chand_->info_service_config_json_ = std::move(service_config_json);
1501
- }
1544
+ chand_->UpdateServiceConfigInControlPlaneLocked(
1545
+ std::move(service_config), std::move(config_selector),
1546
+ parsed_service_config, service_config_result.lb_policy_config->name());
1502
1547
  }
1503
1548
  // Return results.
1504
1549
  return service_config_result;
1505
1550
  }
1506
1551
 
1507
- void ChannelData::ChannelConfigHelper::ApplyConfigSelector(
1508
- bool service_config_changed,
1509
- RefCountedPtr<ConfigSelector> config_selector) {
1510
- chand_->UpdateServiceConfigInDataPlaneLocked(service_config_changed,
1511
- std::move(config_selector));
1552
+ void ChannelData::ChannelConfigHelper::StartUsingServiceConfigForCalls() {
1553
+ chand_->UpdateServiceConfigInDataPlaneLocked();
1512
1554
  }
1513
1555
 
1514
1556
  void ChannelData::ChannelConfigHelper::ResolverTransientFailure(
@@ -1518,21 +1560,19 @@ void ChannelData::ChannelConfigHelper::ResolverTransientFailure(
1518
1560
  chand_->resolver_transient_failure_error_ = error;
1519
1561
  }
1520
1562
 
1521
- void ChannelData::ChannelConfigHelper::ProcessLbPolicy(
1563
+ void ChannelData::ChannelConfigHelper::ChooseLbPolicy(
1522
1564
  const Resolver::Result& resolver_result,
1523
1565
  const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
1524
1566
  RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config) {
1525
1567
  // Prefer the LB policy config found in the service config.
1526
- if (parsed_service_config != nullptr &&
1527
- parsed_service_config->parsed_lb_config() != nullptr) {
1568
+ if (parsed_service_config->parsed_lb_config() != nullptr) {
1528
1569
  *lb_policy_config = parsed_service_config->parsed_lb_config();
1529
1570
  return;
1530
1571
  }
1531
1572
  // Try the deprecated LB policy name from the service config.
1532
1573
  // If not, try the setting from channel args.
1533
1574
  const char* policy_name = nullptr;
1534
- if (parsed_service_config != nullptr &&
1535
- !parsed_service_config->parsed_deprecated_lb_policy().empty()) {
1575
+ if (!parsed_service_config->parsed_deprecated_lb_policy().empty()) {
1536
1576
  policy_name = parsed_service_config->parsed_deprecated_lb_policy().c_str();
1537
1577
  } else {
1538
1578
  const grpc_arg* channel_arg =
@@ -1652,16 +1692,17 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
1652
1692
  "filter");
1653
1693
  return;
1654
1694
  }
1655
- // Get default service config
1695
+ // Get default service config. If none is specified via the client API,
1696
+ // we use an empty config.
1656
1697
  const char* service_config_json = grpc_channel_arg_get_string(
1657
1698
  grpc_channel_args_find(args->channel_args, GRPC_ARG_SERVICE_CONFIG));
1658
- if (service_config_json != nullptr) {
1659
- *error = GRPC_ERROR_NONE;
1660
- default_service_config_ = ServiceConfig::Create(service_config_json, error);
1661
- if (*error != GRPC_ERROR_NONE) {
1662
- default_service_config_.reset();
1663
- return;
1664
- }
1699
+ if (service_config_json == nullptr) service_config_json = "{}";
1700
+ *error = GRPC_ERROR_NONE;
1701
+ default_service_config_ =
1702
+ ServiceConfig::Create(args->channel_args, service_config_json, error);
1703
+ if (*error != GRPC_ERROR_NONE) {
1704
+ default_service_config_.reset();
1705
+ return;
1665
1706
  }
1666
1707
  grpc_uri* uri = grpc_uri_parse(server_uri, true);
1667
1708
  if (uri != nullptr && uri->path[0] != '\0') {
@@ -1675,12 +1716,19 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
1675
1716
  &new_args);
1676
1717
  target_uri_.reset(proxy_name != nullptr ? proxy_name
1677
1718
  : gpr_strdup(server_uri));
1678
- channel_args_ = new_args != nullptr
1679
- ? new_args
1680
- : grpc_channel_args_copy(args->channel_args);
1719
+ // Strip out service config channel arg, so that it doesn't affect
1720
+ // subchannel uniqueness when the args flow down to that layer.
1721
+ const char* arg_to_remove = GRPC_ARG_SERVICE_CONFIG;
1722
+ channel_args_ = grpc_channel_args_copy_and_remove(
1723
+ new_args != nullptr ? new_args : args->channel_args, &arg_to_remove, 1);
1724
+ grpc_channel_args_destroy(new_args);
1725
+ keepalive_time_ = grpc_channel_args_find_integer(
1726
+ channel_args_, GRPC_ARG_KEEPALIVE_TIME_MS,
1727
+ {-1 /* default value, unset */, 1, INT_MAX});
1681
1728
  if (!ResolverRegistry::IsValidTarget(target_uri_.get())) {
1682
- *error =
1683
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("the target uri is not valid.");
1729
+ std::string error_message =
1730
+ absl::StrCat("the target uri is not valid: ", target_uri_.get());
1731
+ *error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_message.c_str());
1684
1732
  return;
1685
1733
  }
1686
1734
  *error = GRPC_ERROR_NONE;
@@ -1701,17 +1749,17 @@ ChannelData::~ChannelData() {
1701
1749
  }
1702
1750
 
1703
1751
  void ChannelData::UpdateStateAndPickerLocked(
1704
- grpc_connectivity_state state, const char* reason,
1752
+ grpc_connectivity_state state, const absl::Status& status,
1753
+ const char* reason,
1705
1754
  std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) {
1706
1755
  // Clean the control plane when entering IDLE.
1707
- if (picker_ == nullptr) {
1756
+ if (picker == nullptr || state == GRPC_CHANNEL_SHUTDOWN) {
1708
1757
  health_check_service_name_.reset();
1709
1758
  saved_service_config_.reset();
1710
1759
  saved_config_selector_.reset();
1711
- received_first_resolver_result_ = false;
1712
1760
  }
1713
1761
  // Update connectivity state.
1714
- state_tracker_.SetState(state, reason);
1762
+ state_tracker_.SetState(state, status, reason);
1715
1763
  if (channelz_node_ != nullptr) {
1716
1764
  channelz_node_->SetConnectivityState(state);
1717
1765
  channelz_node_->AddTraceEvent(
@@ -1754,7 +1802,7 @@ void ChannelData::UpdateStateAndPickerLocked(
1754
1802
  // Note: Original value will be destroyed after the lock is released.
1755
1803
  picker_.swap(picker);
1756
1804
  // Clean the data plane if the updated picker is nullptr.
1757
- if (picker_ == nullptr) {
1805
+ if (picker_ == nullptr || state == GRPC_CHANNEL_SHUTDOWN) {
1758
1806
  received_service_config_data_ = false;
1759
1807
  // Note: We save the objects to unref until after the lock is released.
1760
1808
  retry_throttle_data_to_unref = std::move(retry_throttle_data_);
@@ -1776,43 +1824,72 @@ void ChannelData::UpdateStateAndPickerLocked(
1776
1824
  pending_subchannel_updates_.clear();
1777
1825
  }
1778
1826
 
1779
- void ChannelData::UpdateServiceConfigInDataPlaneLocked(
1780
- bool service_config_changed,
1781
- RefCountedPtr<ConfigSelector> config_selector) {
1782
- // Check if ConfigSelector has changed.
1783
- const bool config_selector_changed =
1784
- saved_config_selector_ != config_selector;
1785
- saved_config_selector_ = config_selector;
1786
- // We want to set the service config at least once, even if the
1787
- // resolver does not return a config, because that ensures that we
1788
- // disable retries if they are not enabled in the service config.
1789
- // TODO(roth): Consider removing the received_first_resolver_result_ check
1790
- // when we implement transparent retries.
1791
- if (!service_config_changed && !config_selector_changed &&
1792
- received_first_resolver_result_) {
1793
- return;
1827
+ void ChannelData::UpdateServiceConfigInControlPlaneLocked(
1828
+ RefCountedPtr<ServiceConfig> service_config,
1829
+ RefCountedPtr<ConfigSelector> config_selector,
1830
+ const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
1831
+ const char* lb_policy_name) {
1832
+ grpc_core::UniquePtr<char> service_config_json(
1833
+ gpr_strdup(service_config->json_string().c_str()));
1834
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1835
+ gpr_log(GPR_INFO,
1836
+ "chand=%p: resolver returned updated service config: \"%s\"", this,
1837
+ service_config_json.get());
1838
+ }
1839
+ // Save service config.
1840
+ saved_service_config_ = std::move(service_config);
1841
+ // Update health check service name if needed.
1842
+ if (((health_check_service_name_ == nullptr) !=
1843
+ (parsed_service_config->health_check_service_name() == nullptr)) ||
1844
+ (health_check_service_name_ != nullptr &&
1845
+ strcmp(health_check_service_name_.get(),
1846
+ parsed_service_config->health_check_service_name()) != 0)) {
1847
+ health_check_service_name_.reset(
1848
+ gpr_strdup(parsed_service_config->health_check_service_name()));
1849
+ // Update health check service name used by existing subchannel wrappers.
1850
+ for (auto* subchannel_wrapper : subchannel_wrappers_) {
1851
+ subchannel_wrapper->UpdateHealthCheckServiceName(
1852
+ grpc_core::UniquePtr<char>(
1853
+ gpr_strdup(health_check_service_name_.get())));
1854
+ }
1855
+ }
1856
+ // Swap out the data used by GetChannelInfo().
1857
+ grpc_core::UniquePtr<char> lb_policy_name_owned(gpr_strdup(lb_policy_name));
1858
+ {
1859
+ MutexLock lock(&info_mu_);
1860
+ info_lb_policy_name_ = std::move(lb_policy_name_owned);
1861
+ info_service_config_json_ = std::move(service_config_json);
1862
+ }
1863
+ // Save config selector.
1864
+ saved_config_selector_ = std::move(config_selector);
1865
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1866
+ gpr_log(GPR_INFO, "chand=%p: using ConfigSelector %p", this,
1867
+ saved_config_selector_.get());
1794
1868
  }
1795
- received_first_resolver_result_ = true;
1869
+ }
1870
+
1871
+ void ChannelData::UpdateServiceConfigInDataPlaneLocked() {
1796
1872
  // Get retry throttle data from service config.
1873
+ const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
1874
+ static_cast<const internal::ClientChannelGlobalParsedConfig*>(
1875
+ saved_service_config_->GetGlobalParsedConfig(
1876
+ internal::ClientChannelServiceConfigParser::ParserIndex()));
1877
+ absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
1878
+ retry_throttle_config = parsed_service_config->retry_throttling();
1797
1879
  RefCountedPtr<ServerRetryThrottleData> retry_throttle_data;
1798
- if (saved_service_config_ != nullptr) {
1799
- const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
1800
- static_cast<const internal::ClientChannelGlobalParsedConfig*>(
1801
- saved_service_config_->GetGlobalParsedConfig(
1802
- internal::ClientChannelServiceConfigParser::ParserIndex()));
1803
- if (parsed_service_config != nullptr) {
1804
- absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
1805
- retry_throttle_config = parsed_service_config->retry_throttling();
1806
- if (retry_throttle_config.has_value()) {
1807
- retry_throttle_data =
1808
- internal::ServerRetryThrottleMap::GetDataForServer(
1809
- server_name_.get(),
1810
- retry_throttle_config.value().max_milli_tokens,
1811
- retry_throttle_config.value().milli_token_ratio);
1812
- }
1813
- }
1880
+ if (retry_throttle_config.has_value()) {
1881
+ retry_throttle_data = internal::ServerRetryThrottleMap::GetDataForServer(
1882
+ server_name_.get(), retry_throttle_config.value().max_milli_tokens,
1883
+ retry_throttle_config.value().milli_token_ratio);
1884
+ }
1885
+ // Grab ref to service config.
1886
+ RefCountedPtr<ServiceConfig> service_config = saved_service_config_;
1887
+ // Grab ref to config selector. Use default if resolver didn't supply one.
1888
+ RefCountedPtr<ConfigSelector> config_selector = saved_config_selector_;
1889
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1890
+ gpr_log(GPR_INFO, "chand=%p: switching to ConfigSelector %p", this,
1891
+ saved_config_selector_.get());
1814
1892
  }
1815
- // Create default config selector if not provided by resolver.
1816
1893
  if (config_selector == nullptr) {
1817
1894
  config_selector =
1818
1895
  MakeRefCounted<DefaultConfigSelector>(saved_service_config_);
@@ -1821,9 +1898,6 @@ void ChannelData::UpdateServiceConfigInDataPlaneLocked(
1821
1898
  //
1822
1899
  // We defer unreffing the old values (and deallocating memory) until
1823
1900
  // after releasing the lock to keep the critical section small.
1824
- RefCountedPtr<ServiceConfig> service_config_to_unref = saved_service_config_;
1825
- RefCountedPtr<ConfigSelector> config_selector_to_unref =
1826
- std::move(config_selector);
1827
1901
  {
1828
1902
  MutexLock lock(&data_plane_mu_);
1829
1903
  GRPC_ERROR_UNREF(resolver_transient_failure_error_);
@@ -1832,8 +1906,8 @@ void ChannelData::UpdateServiceConfigInDataPlaneLocked(
1832
1906
  received_service_config_data_ = true;
1833
1907
  // Old values will be unreffed after lock is released.
1834
1908
  retry_throttle_data_.swap(retry_throttle_data);
1835
- service_config_.swap(service_config_to_unref);
1836
- config_selector_.swap(config_selector_to_unref);
1909
+ service_config_.swap(service_config);
1910
+ config_selector_.swap(config_selector);
1837
1911
  // Re-process queued picks.
1838
1912
  for (QueuedPick* pick = queued_picks_; pick != nullptr; pick = pick->next) {
1839
1913
  grpc_call_element* elem = pick->elem;
@@ -1938,8 +2012,8 @@ void ChannelData::StartTransportOpLocked(grpc_transport_op* op) {
1938
2012
  static_cast<grpc_connectivity_state>(value) == GRPC_CHANNEL_IDLE) {
1939
2013
  if (disconnect_error() == GRPC_ERROR_NONE) {
1940
2014
  // Enter IDLE state.
1941
- UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, "channel entering IDLE",
1942
- nullptr);
2015
+ UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, absl::Status(),
2016
+ "channel entering IDLE", nullptr);
1943
2017
  }
1944
2018
  GRPC_ERROR_UNREF(op->disconnect_with_error);
1945
2019
  } else {
@@ -1948,7 +2022,7 @@ void ChannelData::StartTransportOpLocked(grpc_transport_op* op) {
1948
2022
  GRPC_ERROR_NONE);
1949
2023
  disconnect_error_.Store(op->disconnect_with_error, MemoryOrder::RELEASE);
1950
2024
  UpdateStateAndPickerLocked(
1951
- GRPC_CHANNEL_SHUTDOWN, "shutdown from API",
2025
+ GRPC_CHANNEL_SHUTDOWN, absl::Status(), "shutdown from API",
1952
2026
  absl::make_unique<LoadBalancingPolicy::TransientFailurePicker>(
1953
2027
  GRPC_ERROR_REF(op->disconnect_with_error)));
1954
2028
  }
@@ -2133,13 +2207,14 @@ void CallData::Destroy(grpc_call_element* elem,
2133
2207
  const grpc_call_final_info* /*final_info*/,
2134
2208
  grpc_closure* then_schedule_closure) {
2135
2209
  CallData* calld = static_cast<CallData*>(elem->call_data);
2136
- if (GPR_LIKELY(calld->subchannel_call_ != nullptr)) {
2137
- calld->subchannel_call_->SetAfterCallStackDestroy(then_schedule_closure);
2138
- then_schedule_closure = nullptr;
2139
- }
2210
+ RefCountedPtr<SubchannelCall> subchannel_call = calld->subchannel_call_;
2140
2211
  calld->~CallData();
2141
- // TODO(yashkt) : This can potentially be a Closure::Run
2142
- ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
2212
+ if (GPR_LIKELY(subchannel_call != nullptr)) {
2213
+ subchannel_call->SetAfterCallStackDestroy(then_schedule_closure);
2214
+ } else {
2215
+ // TODO(yashkt) : This can potentially be a Closure::Run
2216
+ ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
2217
+ }
2143
2218
  }
2144
2219
 
2145
2220
  void CallData::StartTransportStreamOpBatch(
@@ -3829,6 +3904,7 @@ class CallData::QueuedPickCanceller {
3829
3904
  }
3830
3905
  if (calld->pick_canceller_ == self && error != GRPC_ERROR_NONE) {
3831
3906
  // Remove pick from list of queued picks.
3907
+ calld->MaybeInvokeConfigSelectorCommitCallback();
3832
3908
  calld->MaybeRemoveCallFromQueuedPicksLocked(self->elem_);
3833
3909
  // Fail pending batches on the call.
3834
3910
  calld->PendingBatchesFail(self->elem_, GRPC_ERROR_REF(error),
@@ -3877,8 +3953,7 @@ grpc_error* CallData::ApplyServiceConfigToCallLocked(
3877
3953
  chand, this);
3878
3954
  }
3879
3955
  ConfigSelector* config_selector = chand->config_selector();
3880
- auto service_config = chand->service_config();
3881
- if (service_config != nullptr) {
3956
+ if (config_selector != nullptr) {
3882
3957
  // Use the ConfigSelector to determine the config for the call.
3883
3958
  ConfigSelector::CallConfig call_config =
3884
3959
  config_selector->GetCallConfig({&path_, initial_metadata, arena_});
@@ -3891,7 +3966,8 @@ grpc_error* CallData::ApplyServiceConfigToCallLocked(
3891
3966
  // so that it can be accessed by filters in the subchannel, and it
3892
3967
  // will be cleaned up when the call ends.
3893
3968
  auto* service_config_call_data = arena_->New<ServiceConfigCallData>(
3894
- std::move(service_config), call_config.method_configs, call_context_);
3969
+ std::move(call_config.service_config), call_config.method_configs,
3970
+ call_context_);
3895
3971
  // Apply our own method params to the call.
3896
3972
  method_params_ = static_cast<ClientChannelMethodParsedConfig*>(
3897
3973
  service_config_call_data->GetMethodParsedConfig(
@@ -4118,7 +4194,9 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
4118
4194
  connected_subchannel_ =
4119
4195
  chand->GetConnectedSubchannelInDataPlane(result.subchannel.get());
4120
4196
  GPR_ASSERT(connected_subchannel_ != nullptr);
4121
- if (retry_committed_) MaybeInvokeConfigSelectorCommitCallback();
4197
+ if (!enable_retries_ || retry_committed_) {
4198
+ MaybeInvokeConfigSelectorCommitCallback();
4199
+ }
4122
4200
  }
4123
4201
  lb_recv_trailing_metadata_ready_ = result.recv_trailing_metadata_ready;
4124
4202
  *error = result.error;