grpc 1.28.0 → 1.30.2

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 (503) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +7694 -11190
  3. data/include/grpc/grpc.h +2 -2
  4. data/include/grpc/grpc_security.h +30 -9
  5. data/include/grpc/grpc_security_constants.h +1 -0
  6. data/include/grpc/impl/codegen/grpc_types.h +19 -21
  7. data/include/grpc/impl/codegen/port_platform.h +6 -2
  8. data/include/grpc/module.modulemap +24 -39
  9. data/src/core/ext/filters/client_channel/backend_metric.cc +7 -4
  10. data/src/core/ext/filters/client_channel/client_channel.cc +212 -241
  11. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -2
  12. data/src/core/ext/filters/client_channel/health/health_check_client.cc +7 -22
  13. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  14. data/src/core/ext/filters/client_channel/http_proxy.cc +17 -10
  15. data/src/core/ext/filters/client_channel/lb_policy.cc +19 -18
  16. data/src/core/ext/filters/client_channel/lb_policy.h +42 -33
  17. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +83 -0
  18. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +99 -0
  19. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -4
  20. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +240 -301
  21. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
  23. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +11 -9
  24. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -2
  25. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +871 -0
  26. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
  27. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +5 -11
  28. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +734 -0
  29. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +84 -37
  30. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +938 -0
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +528 -0
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -2
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +834 -0
  34. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +6 -2
  35. data/src/core/ext/filters/client_channel/local_subchannel_pool.h +2 -1
  36. data/src/core/ext/filters/client_channel/parse_address.cc +22 -21
  37. data/src/core/ext/filters/client_channel/resolver.cc +5 -8
  38. data/src/core/ext/filters/client_channel/resolver.h +12 -14
  39. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +73 -59
  40. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +35 -35
  41. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -7
  42. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +16 -20
  43. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
  44. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +72 -117
  45. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +184 -133
  46. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -3
  47. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +7 -4
  48. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +40 -43
  49. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +93 -102
  50. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +0 -4
  51. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +2 -2
  52. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +32 -5
  53. data/src/core/ext/filters/client_channel/resolver_factory.h +2 -2
  54. data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -3
  55. data/src/core/ext/filters/client_channel/resolver_registry.h +8 -8
  56. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +16 -16
  57. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +19 -16
  58. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +20 -31
  59. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +4 -3
  60. data/src/core/ext/filters/client_channel/server_address.cc +6 -9
  61. data/src/core/ext/filters/client_channel/server_address.h +6 -12
  62. data/src/core/ext/filters/client_channel/service_config.cc +104 -144
  63. data/src/core/ext/filters/client_channel/service_config.h +28 -98
  64. data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -0
  65. data/src/core/ext/filters/client_channel/service_config_parser.cc +87 -0
  66. data/src/core/ext/filters/client_channel/service_config_parser.h +89 -0
  67. data/src/core/ext/filters/client_channel/subchannel.cc +54 -24
  68. data/src/core/ext/filters/client_channel/subchannel.h +35 -11
  69. data/src/core/ext/filters/client_channel/xds/xds_api.cc +348 -221
  70. data/src/core/ext/filters/client_channel/xds/xds_api.h +37 -37
  71. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +44 -49
  72. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +4 -3
  73. data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +4 -2
  74. data/src/core/ext/filters/client_channel/xds/xds_client.cc +532 -339
  75. data/src/core/ext/filters/client_channel/xds/xds_client.h +57 -22
  76. data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +11 -12
  77. data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +31 -19
  78. data/src/core/ext/filters/http/client/http_client_filter.cc +23 -28
  79. data/src/core/ext/filters/http/client_authority_filter.cc +4 -4
  80. data/src/core/ext/filters/http/http_filters_plugin.cc +27 -12
  81. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +258 -221
  82. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +358 -0
  83. data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +29 -0
  84. data/src/core/ext/filters/message_size/message_size_filter.cc +7 -10
  85. data/src/core/ext/filters/message_size/message_size_filter.h +4 -4
  86. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +4 -4
  87. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
  88. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +23 -22
  89. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  90. data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
  91. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
  92. data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
  93. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
  94. data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -3
  95. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -3
  96. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +29 -16
  97. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -3
  98. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
  99. data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -2
  100. data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
  101. data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
  102. data/src/core/ext/transport/chttp2/transport/internal.h +14 -21
  103. data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
  104. data/src/core/ext/transport/chttp2/transport/writing.cc +15 -8
  105. data/src/core/ext/transport/inproc/inproc_transport.cc +19 -0
  106. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +4 -229
  107. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +5 -875
  108. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +114 -0
  109. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +418 -0
  110. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +72 -0
  111. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +197 -0
  112. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +105 -0
  113. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +378 -0
  114. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +1 -0
  115. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +21 -8
  116. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +43 -7
  117. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +1 -0
  118. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +1 -0
  119. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +1 -0
  120. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +2 -1
  121. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +35 -0
  122. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +78 -0
  123. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +47 -26
  124. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +115 -65
  125. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +1 -0
  126. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +34 -0
  127. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +72 -0
  128. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +2 -1
  129. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +24 -20
  130. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +28 -13
  131. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +1 -0
  132. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +38 -18
  133. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +88 -6
  134. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.c +34 -0
  135. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +89 -0
  136. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -0
  137. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +1 -0
  138. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +1 -0
  139. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +1 -0
  140. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +9 -6
  141. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +12 -4
  142. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +1 -0
  143. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +1 -0
  144. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +15 -10
  145. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +16 -0
  146. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +1 -0
  147. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +2 -1
  148. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +1 -0
  149. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +1 -0
  150. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +1 -0
  151. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +1 -0
  152. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +63 -41
  153. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +173 -77
  154. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +1 -0
  155. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +1 -0
  156. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +1 -0
  157. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +48 -28
  158. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +90 -30
  159. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +1 -0
  160. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +51 -0
  161. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +125 -0
  162. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +1 -0
  163. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +4 -2
  164. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +4 -0
  165. data/src/core/ext/upb-generated/envoy/type/http.upb.c +1 -0
  166. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +16 -0
  167. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +36 -0
  168. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +1 -0
  169. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +1 -0
  170. data/src/core/ext/upb-generated/envoy/type/percent.upb.c +1 -0
  171. data/src/core/ext/upb-generated/envoy/type/range.upb.c +1 -0
  172. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +1 -0
  173. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +1 -0
  174. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +9 -8
  175. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +30 -24
  176. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
  177. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +65 -0
  178. data/src/core/ext/upb-generated/validate/validate.upb.c +21 -20
  179. data/src/core/ext/upb-generated/validate/validate.upb.h +69 -63
  180. data/src/core/lib/channel/channel_args.cc +15 -14
  181. data/src/core/lib/channel/channel_args.h +3 -1
  182. data/src/core/lib/channel/channel_stack.h +20 -13
  183. data/src/core/lib/channel/channelz.cc +5 -6
  184. data/src/core/lib/channel/channelz.h +3 -2
  185. data/src/core/lib/channel/channelz_registry.cc +5 -3
  186. data/src/core/lib/channel/connected_channel.cc +7 -5
  187. data/src/core/lib/channel/context.h +1 -1
  188. data/src/core/lib/channel/handshaker.cc +11 -13
  189. data/src/core/lib/channel/handshaker.h +4 -2
  190. data/src/core/lib/channel/handshaker_registry.cc +5 -17
  191. data/src/core/lib/channel/status_util.cc +2 -3
  192. data/src/core/lib/compression/message_compress.cc +5 -1
  193. data/src/core/lib/debug/stats.cc +21 -27
  194. data/src/core/lib/debug/stats.h +3 -1
  195. data/src/core/lib/gpr/spinlock.h +2 -3
  196. data/src/core/lib/gpr/string.cc +2 -26
  197. data/src/core/lib/gpr/string.h +0 -16
  198. data/src/core/lib/gpr/sync_abseil.cc +2 -0
  199. data/src/core/lib/gpr/time.cc +4 -0
  200. data/src/core/lib/gpr/time_posix.cc +1 -1
  201. data/src/core/lib/gprpp/atomic.h +6 -6
  202. data/src/core/lib/gprpp/fork.cc +1 -1
  203. data/src/core/lib/gprpp/host_port.cc +29 -35
  204. data/src/core/lib/gprpp/host_port.h +14 -17
  205. data/src/core/lib/gprpp/map.h +5 -11
  206. data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
  207. data/src/core/lib/http/format_request.cc +46 -65
  208. data/src/core/lib/http/httpcli.cc +2 -3
  209. data/src/core/lib/http/httpcli.h +2 -3
  210. data/src/core/lib/http/httpcli_security_connector.cc +5 -5
  211. data/src/core/lib/http/parser.h +2 -3
  212. data/src/core/lib/iomgr/buffer_list.h +22 -21
  213. data/src/core/lib/iomgr/call_combiner.h +3 -2
  214. data/src/core/lib/iomgr/cfstream_handle.cc +3 -2
  215. data/src/core/lib/iomgr/closure.h +2 -3
  216. data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
  217. data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -3
  218. data/src/core/lib/iomgr/endpoint_pair.h +2 -3
  219. data/src/core/lib/iomgr/error.cc +6 -9
  220. data/src/core/lib/iomgr/error.h +0 -1
  221. data/src/core/lib/iomgr/ev_apple.cc +356 -0
  222. data/src/core/lib/iomgr/ev_apple.h +43 -0
  223. data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -23
  224. data/src/core/lib/iomgr/ev_epollex_linux.cc +2 -3
  225. data/src/core/lib/iomgr/ev_poll_posix.cc +3 -3
  226. data/src/core/lib/iomgr/ev_posix.cc +2 -3
  227. data/src/core/lib/iomgr/exec_ctx.h +14 -2
  228. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -20
  229. data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
  230. data/src/core/lib/{gprpp/optional.h → iomgr/pollset_uv.h} +11 -12
  231. data/src/core/lib/iomgr/port.h +1 -0
  232. data/src/core/lib/iomgr/python_util.h +46 -0
  233. data/src/core/lib/iomgr/resolve_address.h +4 -6
  234. data/src/core/lib/iomgr/resolve_address_custom.cc +29 -39
  235. data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
  236. data/src/core/lib/iomgr/resolve_address_posix.cc +10 -11
  237. data/src/core/lib/iomgr/resolve_address_windows.cc +8 -17
  238. data/src/core/lib/iomgr/resource_quota.cc +4 -6
  239. data/src/core/lib/iomgr/sockaddr_utils.cc +23 -29
  240. data/src/core/lib/iomgr/sockaddr_utils.h +9 -14
  241. data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
  242. data/src/core/lib/iomgr/socket_mutator.h +2 -3
  243. data/src/core/lib/iomgr/socket_utils_common_posix.cc +7 -26
  244. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  245. data/src/core/lib/iomgr/tcp_client_cfstream.cc +5 -7
  246. data/src/core/lib/iomgr/tcp_client_posix.cc +8 -5
  247. data/src/core/lib/iomgr/tcp_client_windows.cc +2 -3
  248. data/src/core/lib/iomgr/tcp_custom.cc +2 -3
  249. data/src/core/lib/iomgr/tcp_server_custom.cc +5 -9
  250. data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
  251. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -4
  252. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -11
  253. data/src/core/lib/iomgr/tcp_uv.cc +3 -2
  254. data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
  255. data/src/core/lib/iomgr/timer_generic.cc +2 -3
  256. data/src/core/lib/{gprpp/inlined_vector.h → iomgr/timer_generic.h} +19 -17
  257. data/src/core/lib/iomgr/timer_heap.h +2 -3
  258. data/src/core/lib/iomgr/udp_server.cc +9 -14
  259. data/src/core/lib/json/json.h +3 -2
  260. data/src/core/lib/json/json_reader.cc +5 -5
  261. data/src/core/lib/json/json_writer.cc +13 -12
  262. data/src/core/lib/security/credentials/composite/composite_credentials.cc +12 -0
  263. data/src/core/lib/security/credentials/composite/composite_credentials.h +6 -3
  264. data/src/core/lib/security/credentials/credentials.cc +0 -84
  265. data/src/core/lib/security/credentials/credentials.h +8 -59
  266. data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
  267. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +3 -8
  268. data/src/core/lib/security/credentials/iam/iam_credentials.cc +8 -6
  269. data/src/core/lib/security/credentials/iam/iam_credentials.h +4 -0
  270. data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
  271. data/src/core/lib/security/credentials/jwt/json_token.h +2 -5
  272. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -0
  273. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +8 -15
  274. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
  275. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +55 -27
  276. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +9 -3
  277. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +13 -0
  278. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
  279. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -13
  280. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +38 -11
  281. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +21 -6
  282. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +7 -7
  283. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -2
  284. data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
  285. data/src/core/lib/security/security_connector/security_connector.h +1 -1
  286. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +20 -25
  287. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +4 -6
  288. data/src/core/lib/security/security_connector/ssl_utils.cc +59 -12
  289. data/src/core/lib/security/security_connector/ssl_utils.h +12 -10
  290. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +77 -51
  291. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +27 -5
  292. data/src/core/lib/security/transport/auth_filters.h +0 -5
  293. data/src/core/lib/security/transport/client_auth_filter.cc +1 -2
  294. data/src/core/lib/slice/slice_intern.cc +2 -3
  295. data/src/core/lib/slice/slice_internal.h +14 -0
  296. data/src/core/lib/slice/slice_utils.h +9 -0
  297. data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
  298. data/src/core/lib/surface/call.cc +2 -3
  299. data/src/core/lib/surface/call_log_batch.cc +50 -58
  300. data/src/core/lib/surface/channel.cc +53 -31
  301. data/src/core/lib/surface/channel.h +35 -4
  302. data/src/core/lib/surface/channel_ping.cc +2 -3
  303. data/src/core/lib/surface/completion_queue.cc +33 -33
  304. data/src/core/lib/surface/event_string.cc +18 -25
  305. data/src/core/lib/surface/event_string.h +3 -1
  306. data/src/core/lib/surface/init_secure.cc +1 -4
  307. data/src/core/lib/surface/server.cc +570 -369
  308. data/src/core/lib/surface/server.h +32 -0
  309. data/src/core/lib/surface/version.cc +2 -2
  310. data/src/core/lib/transport/byte_stream.h +7 -2
  311. data/src/core/lib/transport/connectivity_state.cc +7 -6
  312. data/src/core/lib/transport/connectivity_state.h +5 -3
  313. data/src/core/lib/transport/metadata.cc +3 -3
  314. data/src/core/lib/transport/metadata_batch.h +2 -3
  315. data/src/core/lib/transport/static_metadata.h +1 -1
  316. data/src/core/lib/transport/status_conversion.cc +6 -14
  317. data/src/core/lib/transport/transport.cc +2 -3
  318. data/src/core/lib/transport/transport.h +3 -2
  319. data/src/core/lib/transport/transport_op_string.cc +61 -102
  320. data/src/core/lib/uri/uri_parser.h +2 -3
  321. data/src/core/plugin_registry/grpc_plugin_registry.cc +20 -4
  322. data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
  323. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +8 -1
  324. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
  325. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +32 -2
  326. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
  327. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
  328. data/src/core/tsi/fake_transport_security.cc +10 -15
  329. data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -2
  330. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
  331. data/src/core/tsi/ssl_transport_security.cc +52 -39
  332. data/src/core/tsi/ssl_transport_security.h +8 -8
  333. data/src/core/tsi/ssl_types.h +0 -2
  334. data/src/core/tsi/transport_security.h +6 -9
  335. data/src/core/tsi/transport_security_grpc.h +2 -3
  336. data/src/core/tsi/transport_security_interface.h +3 -3
  337. data/src/ruby/ext/grpc/rb_call.c +9 -1
  338. data/src/ruby/ext/grpc/rb_call_credentials.c +3 -2
  339. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  340. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  341. data/src/ruby/lib/grpc/errors.rb +103 -42
  342. data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
  343. data/src/ruby/lib/grpc/generic/interceptors.rb +4 -4
  344. data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
  345. data/src/ruby/lib/grpc/generic/service.rb +5 -4
  346. data/src/ruby/lib/grpc/structs.rb +1 -1
  347. data/src/ruby/lib/grpc/version.rb +1 -1
  348. data/src/ruby/pb/generate_proto_ruby.sh +5 -3
  349. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
  350. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
  351. data/src/ruby/spec/debug_message_spec.rb +134 -0
  352. data/src/ruby/spec/generic/service_spec.rb +2 -0
  353. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
  354. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +7 -0
  355. data/src/ruby/spec/pb/codegen/package_option_spec.rb +7 -1
  356. data/src/ruby/spec/support/services.rb +10 -4
  357. data/src/ruby/spec/testdata/ca.pem +18 -13
  358. data/src/ruby/spec/testdata/client.key +26 -14
  359. data/src/ruby/spec/testdata/client.pem +18 -12
  360. data/src/ruby/spec/testdata/server1.key +26 -14
  361. data/src/ruby/spec/testdata/server1.pem +20 -14
  362. data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
  363. data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
  364. data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
  365. data/third_party/abseil-cpp/absl/time/clock.h +74 -0
  366. data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
  367. data/third_party/abseil-cpp/absl/time/format.cc +153 -0
  368. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
  369. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
  370. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
  371. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
  372. data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
  373. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
  374. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
  375. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
  376. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
  377. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
  378. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
  379. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
  380. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
  381. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
  382. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
  383. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
  384. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
  385. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
  386. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
  387. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
  388. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
  389. data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
  390. data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
  391. data/third_party/abseil-cpp/absl/time/time.cc +499 -0
  392. data/third_party/abseil-cpp/absl/time/time.h +1584 -0
  393. data/third_party/boringssl-with-bazel/err_data.c +329 -297
  394. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +1 -1
  395. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +7 -5
  396. data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +13 -4
  397. data/third_party/boringssl-with-bazel/src/crypto/crypto.c +11 -0
  398. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519.c +18 -26
  399. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519_tables.h +13 -21
  400. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/internal.h +14 -22
  401. data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +1 -1
  402. data/third_party/boringssl-with-bazel/src/crypto/dh/dh.c +15 -0
  403. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +10 -0
  404. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +425 -0
  405. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +78 -0
  406. data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +2 -2
  407. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +33 -32
  408. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1 -1
  409. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +2 -1
  410. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +3 -3
  411. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +14 -11
  412. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +8 -8
  413. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +30 -154
  414. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +16 -0
  415. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +289 -117
  416. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +13 -27
  417. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
  418. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +25 -7
  419. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +432 -160
  420. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +63 -71
  421. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -14
  422. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9481 -9485
  423. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +80 -99
  424. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +736 -0
  425. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
  426. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +90 -11
  427. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +125 -148
  428. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +189 -3
  429. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +61 -18
  430. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +2 -2
  431. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
  432. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
  433. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
  434. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
  435. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +41 -5
  436. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +32 -17
  437. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +24 -114
  438. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +4 -0
  439. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +1 -0
  440. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +51 -38
  441. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +15 -1
  442. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +44 -35
  443. data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -12
  444. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +15 -1
  445. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +6 -10
  446. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +16 -0
  447. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +4 -0
  448. data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +4 -0
  449. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +278 -0
  450. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1474 -0
  451. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +720 -0
  452. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +16 -0
  453. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +5 -0
  454. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +4 -3
  455. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -1
  456. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +9 -4
  457. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +20 -0
  458. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
  459. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +16 -0
  460. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +6 -0
  461. data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -0
  462. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +5 -0
  463. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -17
  464. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +31 -0
  465. data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +26 -0
  466. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +172 -77
  467. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +1 -0
  468. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +291 -0
  469. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +5 -3
  470. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -0
  471. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +0 -4
  472. data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +3 -3
  473. data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -4
  474. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +146 -57
  475. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +14 -3
  476. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +28 -20
  477. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +12 -4
  478. data/third_party/boringssl-with-bazel/src/ssl/internal.h +64 -47
  479. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +10 -10
  480. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
  481. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -21
  482. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +29 -0
  483. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -0
  484. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +6 -1
  485. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +13 -2
  486. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +64 -5
  487. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +6 -0
  488. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +6 -2
  489. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +47 -53
  490. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -1
  491. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -27
  492. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +23 -75
  493. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +50 -20
  494. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +63 -25
  495. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +245 -175
  496. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +135 -75
  497. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1593 -1672
  498. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +512 -503
  499. metadata +115 -39
  500. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1754
  501. data/src/core/lib/gprpp/string_view.h +0 -60
  502. data/src/core/tsi/grpc_shadow_boringssl.h +0 -3311
  503. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256.c +0 -1063
@@ -225,8 +225,8 @@ GRPCAPI void grpc_channel_ping(grpc_channel* channel, grpc_completion_queue* cq,
225
225
  void* tag, void* reserved);
226
226
 
227
227
  /** Pre-register a method/host pair on a channel.
228
- method and host are not owned and must remain alive while the server is
229
- running. */
228
+ method and host are not owned and must remain alive while the channel is
229
+ alive. */
230
230
  GRPCAPI void* grpc_channel_register_call(grpc_channel* channel,
231
231
  const char* method, const char* host,
232
232
  void* reserved);
@@ -390,6 +390,14 @@ typedef struct {
390
390
  void* reserved;
391
391
  } grpc_auth_metadata_context;
392
392
 
393
+ /** Performs a deep copy from \a from to \a to. **/
394
+ GRPCAPI void grpc_auth_metadata_context_copy(grpc_auth_metadata_context* from,
395
+ grpc_auth_metadata_context* to);
396
+
397
+ /** Releases internal resources held by \a context. **/
398
+ GRPCAPI void grpc_auth_metadata_context_reset(
399
+ grpc_auth_metadata_context* context);
400
+
393
401
  /** Maximum number of metadata entries returnable by a credentials plugin via
394
402
  a synchronous return. */
395
403
  #define GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX 4
@@ -425,6 +433,10 @@ typedef struct {
425
433
  size_t* num_creds_md, grpc_status_code* status,
426
434
  const char** error_details);
427
435
 
436
+ /** Implements debug string of the given plugin. This method returns an
437
+ * allocated string that the caller needs to free using gpr_free() */
438
+ char* (*debug_string)(void* state);
439
+
428
440
  /** Destroys the plugin state. */
429
441
  void (*destroy)(void* state);
430
442
 
@@ -710,6 +722,10 @@ GRPCAPI grpc_server_credentials* grpc_local_server_credentials_create(
710
722
  /** --- TLS channel/server credentials ---
711
723
  * It is used for experimental purpose for now and subject to change. */
712
724
 
725
+ /** Struct for indicating errors. It is used for
726
+ * experimental purpose for now and subject to change. */
727
+ typedef struct grpc_tls_error_details grpc_tls_error_details;
728
+
713
729
  /** Config for TLS key materials. It is used for
714
730
  * experimental purpose for now and subject to change. */
715
731
  typedef struct grpc_tls_key_materials_config grpc_tls_key_materials_config;
@@ -789,11 +805,13 @@ GRPCAPI grpc_tls_key_materials_config* grpc_tls_key_materials_config_create(
789
805
  void);
790
806
 
791
807
  /** Set grpc_tls_key_materials_config instance with provided a TLS certificate.
792
- config will take the ownership of pem_root_certs and pem_key_cert_pairs.
793
808
  It's valid for the caller to provide nullptr pem_root_certs, in which case
794
809
  the gRPC-provided root cert will be used. pem_key_cert_pairs should not be
795
- NULL. It returns 1 on success and 0 on failure. It is used for
796
- experimental purpose for now and subject to change.
810
+ NULL.
811
+ The ownerships of |pem_root_certs| and |pem_key_cert_pairs| remain with the
812
+ caller.
813
+ It returns 1 on success and 0 on failure. It is used for experimental
814
+ purpose for now and subject to change.
797
815
  */
798
816
  GRPCAPI int grpc_tls_key_materials_config_set_key_materials(
799
817
  grpc_tls_key_materials_config* config, const char* pem_root_certs,
@@ -832,8 +850,10 @@ typedef void (*grpc_tls_on_credential_reload_done_cb)(
832
850
  - cb and cb_user_data represent a gRPC-provided
833
851
  callback and an argument passed to it.
834
852
  - key_materials_config is an in/output parameter containing currently
835
- used/newly reloaded credentials. If credential reload does not result
836
- in a new credential, key_materials_config should not be modified.
853
+ used/newly reloaded credentials. If credential reload does not result in
854
+ a new credential, key_materials_config should not be modified. The same
855
+ key_materials_config object can be updated if new key materials is
856
+ available.
837
857
  - status and error_details are used to hold information about
838
858
  errors occurred when a credential reload request is scheduled/cancelled.
839
859
  - config is a pointer to the unique grpc_tls_credential_reload_config
@@ -849,7 +869,7 @@ struct grpc_tls_credential_reload_arg {
849
869
  void* cb_user_data;
850
870
  grpc_tls_key_materials_config* key_materials_config;
851
871
  grpc_ssl_certificate_config_reload_status status;
852
- const char* error_details;
872
+ grpc_tls_error_details* error_details;
853
873
  grpc_tls_credential_reload_config* config;
854
874
  void* context;
855
875
  void (*destroy_context)(void* ctx);
@@ -861,8 +881,9 @@ struct grpc_tls_credential_reload_arg {
861
881
  - schedule is a pointer to an application-provided callback used to invoke
862
882
  credential reload API. The implementation of this method has to be
863
883
  non-blocking, but can be performed synchronously or asynchronously.
864
- 1) If processing occurs synchronously, it populates arg->key_materials,
865
- arg->status, and arg->error_details and returns zero.
884
+ 1) If processing occurs synchronously, it populates
885
+ arg->key_materials_config, arg->status, and arg->error_details
886
+ and returns zero.
866
887
  2) If processing occurs asynchronously, it returns a non-zero value.
867
888
  The application then invokes arg->cb when processing is completed. Note
868
889
  that arg->cb cannot be invoked before schedule API returns.
@@ -926,7 +947,7 @@ struct grpc_tls_server_authorization_check_arg {
926
947
  const char* peer_cert;
927
948
  const char* peer_cert_full_chain;
928
949
  grpc_status_code status;
929
- const char* error_details;
950
+ grpc_tls_error_details* error_details;
930
951
  grpc_tls_server_authorization_check_config* config;
931
952
  void* context;
932
953
  void (*destroy_context)(void* ctx);
@@ -32,6 +32,7 @@ extern "C" {
32
32
  #define GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME "x509_pem_cert_chain"
33
33
  #define GRPC_SSL_SESSION_REUSED_PROPERTY "ssl_session_reused"
34
34
  #define GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME "security_level"
35
+ #define GRPC_PEER_SPIFFE_ID_PROPERTY_NAME "peer_spiffe_id"
35
36
 
36
37
  /** Environment variable that points to the default SSL roots file. This file
37
38
  must be a PEM encoded file with all the roots such as the one that can be
@@ -174,6 +174,11 @@ typedef struct {
174
174
  /** Enable/disable support for per-message compression. Defaults to 1, unless
175
175
  GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */
176
176
  #define GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION "grpc.per_message_compression"
177
+ /** Experimental Arg. Enable/disable support for per-message decompression.
178
+ Defaults to 1. If disabled, decompression will not be performed and the
179
+ application will see the compressed message in the byte buffer. */
180
+ #define GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION \
181
+ "grpc.per_message_decompression"
177
182
  /** Enable/disable support for deadline checking. Defaults to 1, unless
178
183
  GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0 */
179
184
  #define GRPC_ARG_ENABLE_DEADLINE_CHECKS "grpc.enable_deadline_checking"
@@ -198,18 +203,19 @@ typedef struct {
198
203
  /** Should BDP probing be performed? */
199
204
  #define GRPC_ARG_HTTP2_BDP_PROBE "grpc.http2.bdp_probe"
200
205
  /** Minimum time between sending successive ping frames without receiving any
201
- data frame, Int valued, milliseconds. */
206
+ data/header/window_update frame, Int valued, milliseconds. */
202
207
  #define GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS \
203
208
  "grpc.http2.min_time_between_pings_ms"
204
209
  /** Minimum allowed time between a server receiving successive ping frames
205
- without sending any data frame. Int valued, milliseconds */
210
+ without sending any data/header/window_update frame. Int valued, milliseconds
211
+ */
206
212
  #define GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS \
207
213
  "grpc.http2.min_ping_interval_without_data_ms"
208
214
  /** Channel arg to override the http2 :scheme header */
209
215
  #define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
210
- /** How many pings can we send before needing to send a data frame or header
211
- frame? (0 indicates that an infinite number of pings can be sent without
212
- sending a data frame or header frame) */
216
+ /** How many pings can we send before needing to send a
217
+ data/header/window_update frame? (0 indicates that an infinite number of
218
+ pings can be sent without sending a data frame or header frame) */
213
219
  #define GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA \
214
220
  "grpc.http2.max_pings_without_data"
215
221
  /** How many misbehaving pings the server can bear before sending goaway and
@@ -344,22 +350,11 @@ typedef struct {
344
350
  balancer before using fallback backend addresses from the resolver.
345
351
  If 0, enter fallback mode immediately. Default value is 10000. */
346
352
  #define GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS "grpc.grpclb_fallback_timeout_ms"
347
- /* Timeout in milliseconds to wait for the serverlist from the xDS load
348
- balancer before using fallback backend addresses from the resolver.
349
- If 0, enter fallback mode immediately. Default value is 10000. */
350
- #define GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS "grpc.xds_fallback_timeout_ms"
351
- /* Time in milliseconds to wait before a locality is deleted after it's removed
352
- from the received EDS update. If 0, delete the locality immediately. Default
353
- value is 15 minutes. */
354
- #define GRPC_ARG_LOCALITY_RETENTION_INTERVAL_MS \
355
- "grpc.xds_locality_retention_interval_ms"
356
- /* Timeout in milliseconds to wait for the localities of a specific priority to
357
- complete their initial connection attempt before xDS fails over to the next
358
- priority. Specifically, the connection attempt of a priority is considered
359
- completed when any locality of that priority is ready or all the localities
360
- of that priority fail to connect. If 0, failover happens immediately. Default
361
- value is 10 seconds. */
362
- #define GRPC_ARG_XDS_FAILOVER_TIMEOUT_MS "grpc.xds_failover_timeout_ms"
353
+ /* Timeout in milliseconds to wait for the child of a specific priority to
354
+ complete its initial connection attempt before the priority LB policy fails
355
+ over to the next priority. Default value is 10 seconds. */
356
+ #define GRPC_ARG_PRIORITY_FAILOVER_TIMEOUT_MS \
357
+ "grpc.priority_failover_timeout_ms"
363
358
  /* Timeout in milliseconds to wait for a resource to be returned from
364
359
  * the xds server before assuming that it does not exist.
365
360
  * The default is 15 seconds. */
@@ -392,6 +387,9 @@ typedef struct {
392
387
  "grpc.disable_client_authority_filter"
393
388
  /** If set to zero, disables use of http proxies. Enabled by default. */
394
389
  #define GRPC_ARG_ENABLE_HTTP_PROXY "grpc.enable_http_proxy"
390
+ /** Channel arg to set http proxy per channel. If set, the channel arg
391
+ * value will be prefered over the envrionment variable settings. */
392
+ #define GRPC_ARG_HTTP_PROXY "grpc.http_proxy"
395
393
  /** If set to non zero, surfaces the user agent string to the server. User
396
394
  agent is surfaced by default. */
397
395
  #define GRPC_ARG_SURFACE_USER_AGENT "grpc.surface_user_agent"
@@ -53,6 +53,8 @@
53
53
  #define NOMINMAX
54
54
  #endif /* NOMINMAX */
55
55
 
56
+ #include <windows.h>
57
+
56
58
  #ifndef _WIN32_WINNT
57
59
  #error \
58
60
  "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
@@ -63,8 +65,6 @@
63
65
  #endif /* _WIN32_WINNT < 0x0600 */
64
66
  #endif /* defined(_WIN32_WINNT) */
65
67
 
66
- #include <windows.h>
67
-
68
68
  #ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
69
69
  #undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
70
70
  #undef WIN32_LEAN_AND_MEAN
@@ -666,18 +666,22 @@ typedef unsigned __int64 uint64_t;
666
666
  #endif /* GPR_ATTRIBUTE_NO_TSAN (1) */
667
667
 
668
668
  /* GRPC_TSAN_ENABLED will be defined, when compiled with thread sanitizer. */
669
+ #ifndef GRPC_TSAN_SUPPRESSED
669
670
  #if defined(__SANITIZE_THREAD__)
670
671
  #define GRPC_TSAN_ENABLED
671
672
  #elif GPR_HAS_FEATURE(thread_sanitizer)
672
673
  #define GRPC_TSAN_ENABLED
673
674
  #endif
675
+ #endif
674
676
 
675
677
  /* GRPC_ASAN_ENABLED will be defined, when compiled with address sanitizer. */
678
+ #ifndef GRPC_ASAN_SUPPRESSED
676
679
  #if defined(__SANITIZE_ADDRESS__)
677
680
  #define GRPC_ASAN_ENABLED
678
681
  #elif GPR_HAS_FEATURE(address_sanitizer)
679
682
  #define GRPC_ASAN_ENABLED
680
683
  #endif
684
+ #endif
681
685
 
682
686
  /* GRPC_ALLOW_EXCEPTIONS should be 0 or 1 if exceptions are allowed or not */
683
687
  #ifndef GRPC_ALLOW_EXCEPTIONS
@@ -2,77 +2,62 @@
2
2
  framework module grpc {
3
3
  umbrella header "grpc.h"
4
4
 
5
- header "support/alloc.h"
6
- header "support/atm.h"
7
- header "support/cpu.h"
8
- header "support/log.h"
9
- header "support/log_windows.h"
10
- header "support/port_platform.h"
11
- header "support/string_util.h"
12
- header "support/sync.h"
13
- header "support/sync_abseil.h"
14
- header "support/sync_generic.h"
15
- header "support/thd_id.h"
16
- header "support/time.h"
17
5
  header "impl/codegen/atm.h"
18
- header "impl/codegen/fork.h"
19
- header "impl/codegen/gpr_slice.h"
20
- header "impl/codegen/gpr_types.h"
21
- header "impl/codegen/log.h"
22
- header "impl/codegen/port_platform.h"
23
- header "impl/codegen/sync.h"
24
- header "impl/codegen/sync_abseil.h"
25
- header "impl/codegen/sync_generic.h"
26
6
  header "impl/codegen/byte_buffer.h"
27
7
  header "impl/codegen/byte_buffer_reader.h"
28
8
  header "impl/codegen/compression_types.h"
29
9
  header "impl/codegen/connectivity_state.h"
30
- header "impl/codegen/grpc_types.h"
31
- header "impl/codegen/propagation_bits.h"
32
- header "impl/codegen/slice.h"
33
- header "impl/codegen/status.h"
34
- header "impl/codegen/atm.h"
35
10
  header "impl/codegen/fork.h"
36
11
  header "impl/codegen/gpr_slice.h"
37
12
  header "impl/codegen/gpr_types.h"
13
+ header "impl/codegen/grpc_types.h"
38
14
  header "impl/codegen/log.h"
39
15
  header "impl/codegen/port_platform.h"
16
+ header "impl/codegen/propagation_bits.h"
17
+ header "impl/codegen/slice.h"
18
+ header "impl/codegen/status.h"
40
19
  header "impl/codegen/sync.h"
41
20
  header "impl/codegen/sync_abseil.h"
42
21
  header "impl/codegen/sync_generic.h"
43
- header "grpc_security.h"
22
+ header "support/alloc.h"
23
+ header "support/atm.h"
24
+ header "support/cpu.h"
25
+ header "support/log.h"
26
+ header "support/log_windows.h"
27
+ header "support/port_platform.h"
28
+ header "support/string_util.h"
29
+ header "support/sync.h"
30
+ header "support/sync_abseil.h"
31
+ header "support/sync_generic.h"
32
+ header "support/thd_id.h"
33
+ header "support/time.h"
44
34
  header "byte_buffer.h"
45
35
  header "byte_buffer_reader.h"
36
+ header "census.h"
46
37
  header "compression.h"
47
38
  header "fork.h"
48
39
  header "grpc.h"
49
40
  header "grpc_posix.h"
41
+ header "grpc_security.h"
50
42
  header "grpc_security_constants.h"
51
43
  header "load_reporting.h"
52
44
  header "slice.h"
53
45
  header "slice_buffer.h"
54
46
  header "status.h"
55
47
  header "support/workaround_list.h"
56
- header "census.h"
57
48
 
58
- textual header "support/atm_gcc_atomic.h"
59
- textual header "support/atm_gcc_sync.h"
60
- textual header "support/atm_windows.h"
61
- textual header "support/sync_custom.h"
62
- textual header "support/sync_posix.h"
63
- textual header "support/sync_windows.h"
64
- textual header "impl/codegen/atm_gcc_atomic.h"
65
- textual header "impl/codegen/atm_gcc_sync.h"
66
- textual header "impl/codegen/atm_windows.h"
67
- textual header "impl/codegen/sync_custom.h"
68
- textual header "impl/codegen/sync_posix.h"
69
- textual header "impl/codegen/sync_windows.h"
70
49
  textual header "impl/codegen/atm_gcc_atomic.h"
71
50
  textual header "impl/codegen/atm_gcc_sync.h"
72
51
  textual header "impl/codegen/atm_windows.h"
73
52
  textual header "impl/codegen/sync_custom.h"
74
53
  textual header "impl/codegen/sync_posix.h"
75
54
  textual header "impl/codegen/sync_windows.h"
55
+ textual header "support/atm_gcc_atomic.h"
56
+ textual header "support/atm_gcc_sync.h"
57
+ textual header "support/atm_windows.h"
58
+ textual header "support/sync_custom.h"
59
+ textual header "support/sync_posix.h"
60
+ textual header "support/sync_windows.h"
76
61
 
77
62
  export *
78
63
  module * { export * }
@@ -18,27 +18,30 @@
18
18
 
19
19
  #include "src/core/ext/filters/client_channel/backend_metric.h"
20
20
 
21
- #include "src/core/lib/gprpp/string_view.h"
21
+ #include "absl/strings/string_view.h"
22
+
22
23
  #include "udpa/data/orca/v1/orca_load_report.upb.h"
23
24
 
25
+ #include "src/core/lib/gprpp/map.h"
26
+
24
27
  namespace grpc_core {
25
28
 
26
29
  namespace {
27
30
 
28
31
  template <typename EntryType>
29
- std::map<StringView, double, StringLess> ParseMap(
32
+ std::map<absl::string_view, double, StringLess> ParseMap(
30
33
  udpa_data_orca_v1_OrcaLoadReport* msg,
31
34
  EntryType** (*entry_func)(udpa_data_orca_v1_OrcaLoadReport*, size_t*),
32
35
  upb_strview (*key_func)(const EntryType*),
33
36
  double (*value_func)(const EntryType*), Arena* arena) {
34
- std::map<StringView, double, StringLess> result;
37
+ std::map<absl::string_view, double, StringLess> result;
35
38
  size_t size;
36
39
  const auto* const* entries = entry_func(msg, &size);
37
40
  for (size_t i = 0; i < size; ++i) {
38
41
  upb_strview key_view = key_func(entries[i]);
39
42
  char* key = static_cast<char*>(arena->Alloc(key_view.size + 1));
40
43
  memcpy(key, key_view.data, key_view.size);
41
- result[StringView(key, key_view.size)] = value_func(entries[i]);
44
+ result[absl::string_view(key, key_view.size)] = value_func(entries[i]);
42
45
  }
43
46
  return result;
44
47
  }
@@ -28,11 +28,16 @@
28
28
 
29
29
  #include <set>
30
30
 
31
+ #include "absl/strings/string_view.h"
32
+
31
33
  #include <grpc/support/alloc.h>
32
34
  #include <grpc/support/log.h>
33
35
  #include <grpc/support/string_util.h>
34
36
  #include <grpc/support/sync.h>
35
37
 
38
+ #include "absl/container/inlined_vector.h"
39
+ #include "absl/types/optional.h"
40
+
36
41
  #include "src/core/ext/filters/client_channel/backend_metric.h"
37
42
  #include "src/core/ext/filters/client_channel/backup_poller.h"
38
43
  #include "src/core/ext/filters/client_channel/global_subchannel_pool.h"
@@ -45,6 +50,7 @@
45
50
  #include "src/core/ext/filters/client_channel/resolving_lb_policy.h"
46
51
  #include "src/core/ext/filters/client_channel/retry_throttle.h"
47
52
  #include "src/core/ext/filters/client_channel/service_config.h"
53
+ #include "src/core/ext/filters/client_channel/service_config_call_data.h"
48
54
  #include "src/core/ext/filters/client_channel/subchannel.h"
49
55
  #include "src/core/ext/filters/deadline/deadline_filter.h"
50
56
  #include "src/core/lib/backoff/backoff.h"
@@ -52,13 +58,12 @@
52
58
  #include "src/core/lib/channel/connected_channel.h"
53
59
  #include "src/core/lib/channel/status_util.h"
54
60
  #include "src/core/lib/gpr/string.h"
55
- #include "src/core/lib/gprpp/inlined_vector.h"
56
61
  #include "src/core/lib/gprpp/manual_constructor.h"
57
62
  #include "src/core/lib/gprpp/map.h"
58
63
  #include "src/core/lib/gprpp/sync.h"
59
- #include "src/core/lib/iomgr/combiner.h"
60
64
  #include "src/core/lib/iomgr/iomgr.h"
61
65
  #include "src/core/lib/iomgr/polling_entity.h"
66
+ #include "src/core/lib/iomgr/work_serializer.h"
62
67
  #include "src/core/lib/profiling/timers.h"
63
68
  #include "src/core/lib/slice/slice_internal.h"
64
69
  #include "src/core/lib/slice/slice_string_helpers.h"
@@ -126,6 +131,7 @@ class ChannelData {
126
131
  size_t per_rpc_retry_buffer_size() const {
127
132
  return per_rpc_retry_buffer_size_;
128
133
  }
134
+ grpc_channel_stack* owning_stack() const { return owning_stack_; }
129
135
 
130
136
  // Note: Does NOT return a new ref.
131
137
  grpc_error* disconnect_error() const {
@@ -149,6 +155,7 @@ class ChannelData {
149
155
  RefCountedPtr<ServiceConfig> service_config() const {
150
156
  return service_config_;
151
157
  }
158
+ WorkSerializer* work_serializer() const { return work_serializer_.get(); }
152
159
 
153
160
  RefCountedPtr<ConnectedSubchannel> GetConnectedSubchannelInDataPlane(
154
161
  SubchannelInterface* subchannel) const;
@@ -159,21 +166,29 @@ class ChannelData {
159
166
  grpc_connectivity_state* state,
160
167
  grpc_closure* on_complete,
161
168
  grpc_closure* watcher_timer_init) {
162
- MutexLock lock(&external_watchers_mu_);
163
- // Will be deleted when the watch is complete.
164
- GPR_ASSERT(external_watchers_[on_complete] == nullptr);
165
- external_watchers_[on_complete] = new ExternalConnectivityWatcher(
169
+ auto* watcher = new ExternalConnectivityWatcher(
166
170
  this, pollent, state, on_complete, watcher_timer_init);
171
+ {
172
+ MutexLock lock(&external_watchers_mu_);
173
+ // Will be deleted when the watch is complete.
174
+ GPR_ASSERT(external_watchers_[on_complete] == nullptr);
175
+ external_watchers_[on_complete] = watcher;
176
+ }
177
+ watcher->Start();
167
178
  }
168
179
 
169
180
  void RemoveExternalConnectivityWatcher(grpc_closure* on_complete,
170
181
  bool cancel) {
171
- MutexLock lock(&external_watchers_mu_);
172
- auto it = external_watchers_.find(on_complete);
173
- if (it != external_watchers_.end()) {
174
- if (cancel) it->second->Cancel();
175
- external_watchers_.erase(it);
182
+ ExternalConnectivityWatcher* watcher = nullptr;
183
+ {
184
+ MutexLock lock(&external_watchers_mu_);
185
+ auto it = external_watchers_.find(on_complete);
186
+ if (it != external_watchers_.end()) {
187
+ watcher = it->second;
188
+ external_watchers_.erase(it);
189
+ }
176
190
  }
191
+ if (watcher != nullptr && cancel) watcher->Cancel();
177
192
  }
178
193
 
179
194
  int NumExternalConnectivityWatchers() const {
@@ -204,13 +219,15 @@ class ChannelData {
204
219
 
205
220
  ~ExternalConnectivityWatcher();
206
221
 
222
+ void Start();
223
+
207
224
  void Notify(grpc_connectivity_state state) override;
208
225
 
209
226
  void Cancel();
210
227
 
211
228
  private:
212
- static void AddWatcherLocked(void* arg, grpc_error* ignored);
213
- static void RemoveWatcherLocked(void* arg, grpc_error* ignored);
229
+ void AddWatcherLocked();
230
+ void RemoveWatcherLocked();
214
231
 
215
232
  ChannelData* chand_;
216
233
  grpc_polling_entity pollent_;
@@ -218,8 +235,6 @@ class ChannelData {
218
235
  grpc_connectivity_state* state_;
219
236
  grpc_closure* on_complete_;
220
237
  grpc_closure* watcher_timer_init_;
221
- grpc_closure add_closure_;
222
- grpc_closure remove_closure_;
223
238
  Atomic<bool> done_{false};
224
239
  };
225
240
 
@@ -245,9 +260,9 @@ class ChannelData {
245
260
 
246
261
  grpc_error* DoPingLocked(grpc_transport_op* op);
247
262
 
248
- static void StartTransportOpLocked(void* arg, grpc_error* ignored);
263
+ void StartTransportOpLocked(grpc_transport_op* op);
249
264
 
250
- static void TryToConnectLocked(void* arg, grpc_error* error_ignored);
265
+ void TryToConnectLocked();
251
266
 
252
267
  void ProcessLbPolicy(
253
268
  const Resolver::Result& resolver_result,
@@ -280,9 +295,9 @@ class ChannelData {
280
295
  RefCountedPtr<ServiceConfig> service_config_;
281
296
 
282
297
  //
283
- // Fields used in the control plane. Guarded by combiner.
298
+ // Fields used in the control plane. Guarded by work_serializer.
284
299
  //
285
- Combiner* combiner_;
300
+ std::shared_ptr<WorkSerializer> work_serializer_;
286
301
  grpc_pollset_set* interested_parties_;
287
302
  RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
288
303
  OrphanablePtr<ResolvingLoadBalancingPolicy> resolving_lb_policy_;
@@ -294,17 +309,17 @@ class ChannelData {
294
309
  std::map<Subchannel*, int> subchannel_refcount_map_;
295
310
  // The set of SubchannelWrappers that currently exist.
296
311
  // No need to hold a ref, since the map is updated in the control-plane
297
- // combiner when the SubchannelWrappers are created and destroyed.
312
+ // work_serializer when the SubchannelWrappers are created and destroyed.
298
313
  std::set<SubchannelWrapper*> subchannel_wrappers_;
299
314
  // Pending ConnectedSubchannel updates for each SubchannelWrapper.
300
- // Updates are queued here in the control plane combiner and then applied
301
- // in the data plane mutex when the picker is updated.
302
- std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>,
303
- RefCountedPtrLess<SubchannelWrapper>>
315
+ // Updates are queued here in the control plane work_serializer and then
316
+ // applied in the data plane mutex when the picker is updated.
317
+ std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>>
304
318
  pending_subchannel_updates_;
305
319
 
306
320
  //
307
- // Fields accessed from both data plane mutex and control plane combiner.
321
+ // Fields accessed from both data plane mutex and control plane
322
+ // work_serializer.
308
323
  //
309
324
  Atomic<grpc_error*> disconnect_error_;
310
325
 
@@ -364,7 +379,7 @@ class CallData {
364
379
  Metadata(CallData* calld, grpc_metadata_batch* batch)
365
380
  : calld_(calld), batch_(batch) {}
366
381
 
367
- void Add(StringView key, StringView value) override {
382
+ void Add(absl::string_view key, absl::string_view value) override {
368
383
  grpc_linked_mdelem* linked_mdelem = static_cast<grpc_linked_mdelem*>(
369
384
  calld_->arena_->Alloc(sizeof(grpc_linked_mdelem)));
370
385
  linked_mdelem->md = grpc_mdelem_from_slices(
@@ -399,7 +414,7 @@ class CallData {
399
414
  reinterpret_cast<grpc_linked_mdelem*>(handle);
400
415
  return reinterpret_cast<intptr_t>(linked_mdelem->next);
401
416
  }
402
- std::pair<StringView, StringView> IteratorHandleGet(
417
+ std::pair<absl::string_view, absl::string_view> IteratorHandleGet(
403
418
  intptr_t handle) const override {
404
419
  grpc_linked_mdelem* linked_mdelem =
405
420
  reinterpret_cast<grpc_linked_mdelem*>(handle);
@@ -431,6 +446,12 @@ class CallData {
431
446
  return calld_->backend_metric_data_;
432
447
  }
433
448
 
449
+ absl::string_view ExperimentalGetCallAttribute(const char* key) override {
450
+ auto it = calld_->call_attributes_.find(key);
451
+ if (it == calld_->call_attributes_.end()) return absl::string_view();
452
+ return it->second;
453
+ }
454
+
434
455
  private:
435
456
  CallData* calld_;
436
457
  };
@@ -750,8 +771,8 @@ class CallData {
750
771
  grpc_call_context_element* call_context_;
751
772
 
752
773
  RefCountedPtr<ServerRetryThrottleData> retry_throttle_data_;
753
- ServiceConfig::CallData service_config_call_data_;
754
774
  const ClientChannelMethodParsedConfig* method_params_ = nullptr;
775
+ std::map<const char*, absl::string_view> call_attributes_;
755
776
 
756
777
  RefCountedPtr<SubchannelCall> subchannel_call_;
757
778
 
@@ -820,7 +841,7 @@ class CallData {
820
841
  // Note: We inline the cache for the first 3 send_message ops and use
821
842
  // dynamic allocation after that. This number was essentially picked
822
843
  // at random; it could be changed in the future to tune performance.
823
- InlinedVector<ByteStreamCache*, 3> send_messages_;
844
+ absl::InlinedVector<ByteStreamCache*, 3> send_messages_;
824
845
  // send_trailing_metadata
825
846
  bool seen_send_trailing_metadata_ = false;
826
847
  grpc_linked_mdelem* send_trailing_metadata_storage_ = nullptr;
@@ -838,7 +859,7 @@ class CallData {
838
859
  // Note that no synchronization is needed here, because even if the
839
860
  // underlying subchannel is shared between channels, this wrapper will only
840
861
  // be used within one channel, so it will always be synchronized by the
841
- // control plane combiner.
862
+ // control plane work_serializer.
842
863
  class ChannelData::SubchannelWrapper : public SubchannelInterface {
843
864
  public:
844
865
  SubchannelWrapper(ChannelData* chand, Subchannel* subchannel,
@@ -907,7 +928,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
907
928
  initial_state,
908
929
  grpc_core::UniquePtr<char>(
909
930
  gpr_strdup(health_check_service_name_.get())),
910
- OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
931
+ RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
911
932
  watcher_wrapper));
912
933
  }
913
934
 
@@ -957,14 +978,14 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
957
978
  replacement->last_seen_state(),
958
979
  grpc_core::UniquePtr<char>(
959
980
  gpr_strdup(health_check_service_name.get())),
960
- OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
981
+ RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
961
982
  replacement));
962
983
  }
963
984
  // Save the new health check service name.
964
985
  health_check_service_name_ = std::move(health_check_service_name);
965
986
  }
966
987
 
967
- // Caller must be holding the control-plane combiner.
988
+ // Caller must be holding the control-plane work_serializer.
968
989
  ConnectedSubchannel* connected_subchannel() const {
969
990
  return connected_subchannel_.get();
970
991
  }
@@ -1004,23 +1025,27 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
1004
1025
  parent_(std::move(parent)),
1005
1026
  last_seen_state_(initial_state) {}
1006
1027
 
1007
- ~WatcherWrapper() { parent_.reset(DEBUG_LOCATION, "WatcherWrapper"); }
1008
-
1009
- void Orphan() override { Unref(); }
1028
+ ~WatcherWrapper() {
1029
+ auto* parent = parent_.release(); // ref owned by lambda
1030
+ parent->chand_->work_serializer_->Run(
1031
+ [parent]() { parent->Unref(DEBUG_LOCATION, "WatcherWrapper"); },
1032
+ DEBUG_LOCATION);
1033
+ }
1010
1034
 
1011
- void OnConnectivityStateChange(
1012
- grpc_connectivity_state new_state,
1013
- RefCountedPtr<ConnectedSubchannel> connected_subchannel) override {
1035
+ void OnConnectivityStateChange() override {
1014
1036
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1015
1037
  gpr_log(GPR_INFO,
1016
1038
  "chand=%p: connectivity change for subchannel wrapper %p "
1017
- "subchannel %p (connected_subchannel=%p state=%s); "
1018
- "hopping into combiner",
1019
- parent_->chand_, parent_.get(), parent_->subchannel_,
1020
- connected_subchannel.get(), ConnectivityStateName(new_state));
1039
+ "subchannel %p; hopping into work_serializer",
1040
+ parent_->chand_, parent_.get(), parent_->subchannel_);
1021
1041
  }
1022
- // Will delete itself.
1023
- new Updater(Ref(), new_state, std::move(connected_subchannel));
1042
+ Ref().release(); // ref owned by lambda
1043
+ parent_->chand_->work_serializer_->Run(
1044
+ [this]() {
1045
+ ApplyUpdateInControlPlaneWorkSerializer();
1046
+ Unref();
1047
+ },
1048
+ DEBUG_LOCATION);
1024
1049
  }
1025
1050
 
1026
1051
  grpc_pollset_set* interested_parties() override {
@@ -1040,50 +1065,25 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
1040
1065
  grpc_connectivity_state last_seen_state() const { return last_seen_state_; }
1041
1066
 
1042
1067
  private:
1043
- class Updater {
1044
- public:
1045
- Updater(RefCountedPtr<WatcherWrapper> parent,
1046
- grpc_connectivity_state new_state,
1047
- RefCountedPtr<ConnectedSubchannel> connected_subchannel)
1048
- : parent_(std::move(parent)),
1049
- state_(new_state),
1050
- connected_subchannel_(std::move(connected_subchannel)) {
1051
- parent_->parent_->chand_->combiner_->Run(
1052
- GRPC_CLOSURE_INIT(&closure_, ApplyUpdateInControlPlaneCombiner,
1053
- this, nullptr),
1054
- GRPC_ERROR_NONE);
1068
+ void ApplyUpdateInControlPlaneWorkSerializer() {
1069
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1070
+ gpr_log(GPR_INFO,
1071
+ "chand=%p: processing connectivity change in work serializer "
1072
+ "for subchannel wrapper %p subchannel %p "
1073
+ "watcher=%p",
1074
+ parent_->chand_, parent_.get(), parent_->subchannel_,
1075
+ watcher_.get());
1055
1076
  }
1056
-
1057
- private:
1058
- static void ApplyUpdateInControlPlaneCombiner(void* arg,
1059
- grpc_error* /*error*/) {
1060
- Updater* self = static_cast<Updater*>(arg);
1061
- if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1062
- gpr_log(GPR_INFO,
1063
- "chand=%p: processing connectivity change in combiner "
1064
- "for subchannel wrapper %p subchannel %p "
1065
- "(connected_subchannel=%p state=%s): watcher=%p",
1066
- self->parent_->parent_->chand_, self->parent_->parent_.get(),
1067
- self->parent_->parent_->subchannel_,
1068
- self->connected_subchannel_.get(),
1069
- ConnectivityStateName(self->state_),
1070
- self->parent_->watcher_.get());
1071
- }
1072
- // Ignore update if the parent WatcherWrapper has been replaced
1073
- // since this callback was scheduled.
1074
- if (self->parent_->watcher_ == nullptr) return;
1075
- self->parent_->last_seen_state_ = self->state_;
1076
- self->parent_->parent_->MaybeUpdateConnectedSubchannel(
1077
- std::move(self->connected_subchannel_));
1078
- self->parent_->watcher_->OnConnectivityStateChange(self->state_);
1079
- delete self;
1077
+ ConnectivityStateChange state_change = PopConnectivityStateChange();
1078
+ // Ignore update if the parent WatcherWrapper has been replaced
1079
+ // since this callback was scheduled.
1080
+ if (watcher_ != nullptr) {
1081
+ last_seen_state_ = state_change.state;
1082
+ parent_->MaybeUpdateConnectedSubchannel(
1083
+ std::move(state_change.connected_subchannel));
1084
+ watcher_->OnConnectivityStateChange(state_change.state);
1080
1085
  }
1081
-
1082
- RefCountedPtr<WatcherWrapper> parent_;
1083
- grpc_connectivity_state state_;
1084
- RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
1085
- grpc_closure closure_;
1086
- };
1086
+ }
1087
1087
 
1088
1088
  std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
1089
1089
  watcher_;
@@ -1122,7 +1122,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
1122
1122
  // CancelConnectivityStateWatch() with its watcher, we know the
1123
1123
  // corresponding WrapperWatcher to cancel on the underlying subchannel.
1124
1124
  std::map<ConnectivityStateWatcherInterface*, WatcherWrapper*> watcher_map_;
1125
- // To be accessed only in the control plane combiner.
1125
+ // To be accessed only in the control plane work_serializer.
1126
1126
  RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
1127
1127
  // To be accessed only in the data plane mutex.
1128
1128
  RefCountedPtr<ConnectedSubchannel> connected_subchannel_in_data_plane_;
@@ -1145,9 +1145,6 @@ ChannelData::ExternalConnectivityWatcher::ExternalConnectivityWatcher(
1145
1145
  grpc_polling_entity_add_to_pollset_set(&pollent_,
1146
1146
  chand_->interested_parties_);
1147
1147
  GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "ExternalConnectivityWatcher");
1148
- chand_->combiner_->Run(
1149
- GRPC_CLOSURE_INIT(&add_closure_, AddWatcherLocked, this, nullptr),
1150
- GRPC_ERROR_NONE);
1151
1148
  }
1152
1149
 
1153
1150
  ChannelData::ExternalConnectivityWatcher::~ExternalConnectivityWatcher() {
@@ -1157,6 +1154,11 @@ ChannelData::ExternalConnectivityWatcher::~ExternalConnectivityWatcher() {
1157
1154
  "ExternalConnectivityWatcher");
1158
1155
  }
1159
1156
 
1157
+ void ChannelData::ExternalConnectivityWatcher::Start() {
1158
+ chand_->work_serializer_->Run([this]() { AddWatcherLocked(); },
1159
+ DEBUG_LOCATION);
1160
+ }
1161
+
1160
1162
  void ChannelData::ExternalConnectivityWatcher::Notify(
1161
1163
  grpc_connectivity_state state) {
1162
1164
  bool done = false;
@@ -1169,13 +1171,12 @@ void ChannelData::ExternalConnectivityWatcher::Notify(
1169
1171
  // Report new state to the user.
1170
1172
  *state_ = state;
1171
1173
  ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_NONE);
1172
- // Hop back into the combiner to clean up.
1174
+ // Hop back into the work_serializer to clean up.
1173
1175
  // Not needed in state SHUTDOWN, because the tracker will
1174
1176
  // automatically remove all watchers in that case.
1175
1177
  if (state != GRPC_CHANNEL_SHUTDOWN) {
1176
- chand_->combiner_->Run(
1177
- GRPC_CLOSURE_INIT(&remove_closure_, RemoveWatcherLocked, this, nullptr),
1178
- GRPC_ERROR_NONE);
1178
+ chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
1179
+ DEBUG_LOCATION);
1179
1180
  }
1180
1181
  }
1181
1182
 
@@ -1186,28 +1187,20 @@ void ChannelData::ExternalConnectivityWatcher::Cancel() {
1186
1187
  return; // Already done.
1187
1188
  }
1188
1189
  ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_CANCELLED);
1189
- // Hop back into the combiner to clean up.
1190
- chand_->combiner_->Run(
1191
- GRPC_CLOSURE_INIT(&remove_closure_, RemoveWatcherLocked, this, nullptr),
1192
- GRPC_ERROR_NONE);
1190
+ // Hop back into the work_serializer to clean up.
1191
+ chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
1192
+ DEBUG_LOCATION);
1193
1193
  }
1194
1194
 
1195
- void ChannelData::ExternalConnectivityWatcher::AddWatcherLocked(
1196
- void* arg, grpc_error* /*ignored*/) {
1197
- ExternalConnectivityWatcher* self =
1198
- static_cast<ExternalConnectivityWatcher*>(arg);
1199
- Closure::Run(DEBUG_LOCATION, self->watcher_timer_init_, GRPC_ERROR_NONE);
1195
+ void ChannelData::ExternalConnectivityWatcher::AddWatcherLocked() {
1196
+ Closure::Run(DEBUG_LOCATION, watcher_timer_init_, GRPC_ERROR_NONE);
1200
1197
  // Add new watcher.
1201
- self->chand_->state_tracker_.AddWatcher(
1202
- self->initial_state_,
1203
- OrphanablePtr<ConnectivityStateWatcherInterface>(self));
1198
+ chand_->state_tracker_.AddWatcher(
1199
+ initial_state_, OrphanablePtr<ConnectivityStateWatcherInterface>(this));
1204
1200
  }
1205
1201
 
1206
- void ChannelData::ExternalConnectivityWatcher::RemoveWatcherLocked(
1207
- void* arg, grpc_error* /*ignored*/) {
1208
- ExternalConnectivityWatcher* self =
1209
- static_cast<ExternalConnectivityWatcher*>(arg);
1210
- self->chand_->state_tracker_.RemoveWatcher(self);
1202
+ void ChannelData::ExternalConnectivityWatcher::RemoveWatcherLocked() {
1203
+ chand_->state_tracker_.RemoveWatcher(this);
1211
1204
  }
1212
1205
 
1213
1206
  //
@@ -1223,28 +1216,20 @@ class ChannelData::ConnectivityWatcherAdder {
1223
1216
  initial_state_(initial_state),
1224
1217
  watcher_(std::move(watcher)) {
1225
1218
  GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "ConnectivityWatcherAdder");
1226
- chand_->combiner_->Run(
1227
- GRPC_CLOSURE_INIT(&closure_,
1228
- &ConnectivityWatcherAdder::AddWatcherLocked, this,
1229
- nullptr),
1230
- GRPC_ERROR_NONE);
1219
+ chand_->work_serializer_->Run([this]() { AddWatcherLocked(); },
1220
+ DEBUG_LOCATION);
1231
1221
  }
1232
1222
 
1233
1223
  private:
1234
- static void AddWatcherLocked(void* arg, grpc_error* /*error*/) {
1235
- ConnectivityWatcherAdder* self =
1236
- static_cast<ConnectivityWatcherAdder*>(arg);
1237
- self->chand_->state_tracker_.AddWatcher(self->initial_state_,
1238
- std::move(self->watcher_));
1239
- GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
1240
- "ConnectivityWatcherAdder");
1241
- delete self;
1224
+ void AddWatcherLocked() {
1225
+ chand_->state_tracker_.AddWatcher(initial_state_, std::move(watcher_));
1226
+ GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "ConnectivityWatcherAdder");
1227
+ delete this;
1242
1228
  }
1243
1229
 
1244
1230
  ChannelData* chand_;
1245
1231
  grpc_connectivity_state initial_state_;
1246
1232
  OrphanablePtr<AsyncConnectivityStateWatcherInterface> watcher_;
1247
- grpc_closure closure_;
1248
1233
  };
1249
1234
 
1250
1235
  //
@@ -1257,26 +1242,20 @@ class ChannelData::ConnectivityWatcherRemover {
1257
1242
  AsyncConnectivityStateWatcherInterface* watcher)
1258
1243
  : chand_(chand), watcher_(watcher) {
1259
1244
  GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "ConnectivityWatcherRemover");
1260
- chand_->combiner_->Run(
1261
- GRPC_CLOSURE_INIT(&closure_,
1262
- &ConnectivityWatcherRemover::RemoveWatcherLocked,
1263
- this, nullptr),
1264
- GRPC_ERROR_NONE);
1245
+ chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
1246
+ DEBUG_LOCATION);
1265
1247
  }
1266
1248
 
1267
1249
  private:
1268
- static void RemoveWatcherLocked(void* arg, grpc_error* /*error*/) {
1269
- ConnectivityWatcherRemover* self =
1270
- static_cast<ConnectivityWatcherRemover*>(arg);
1271
- self->chand_->state_tracker_.RemoveWatcher(self->watcher_);
1272
- GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
1250
+ void RemoveWatcherLocked() {
1251
+ chand_->state_tracker_.RemoveWatcher(watcher_);
1252
+ GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_,
1273
1253
  "ConnectivityWatcherRemover");
1274
- delete self;
1254
+ delete this;
1275
1255
  }
1276
1256
 
1277
1257
  ChannelData* chand_;
1278
1258
  AsyncConnectivityStateWatcherInterface* watcher_;
1279
- grpc_closure closure_;
1280
1259
  };
1281
1260
 
1282
1261
  //
@@ -1340,7 +1319,8 @@ class ChannelData::ClientChannelControlHelper
1340
1319
  // No-op -- we should never get this from ResolvingLoadBalancingPolicy.
1341
1320
  void RequestReresolution() override {}
1342
1321
 
1343
- void AddTraceEvent(TraceSeverity severity, StringView message) override {
1322
+ void AddTraceEvent(TraceSeverity severity,
1323
+ absl::string_view message) override {
1344
1324
  if (chand_->channelz_node_ != nullptr) {
1345
1325
  chand_->channelz_node_->AddTraceEvent(
1346
1326
  ConvertSeverityEnum(severity),
@@ -1417,7 +1397,7 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
1417
1397
  client_channel_factory_(
1418
1398
  ClientChannelFactory::GetFromChannelArgs(args->channel_args)),
1419
1399
  channelz_node_(GetChannelzNode(args->channel_args)),
1420
- combiner_(grpc_combiner_create()),
1400
+ work_serializer_(std::make_shared<WorkSerializer>()),
1421
1401
  interested_parties_(grpc_pollset_set_create()),
1422
1402
  subchannel_pool_(GetSubchannelPool(args->channel_args)),
1423
1403
  state_tracker_("client_channel", GRPC_CHANNEL_IDLE),
@@ -1488,7 +1468,6 @@ ChannelData::~ChannelData() {
1488
1468
  // Stop backup polling.
1489
1469
  grpc_client_channel_stop_backup_polling(interested_parties_);
1490
1470
  grpc_pollset_set_destroy(interested_parties_);
1491
- GRPC_COMBINER_UNREF(combiner_, "client_channel");
1492
1471
  GRPC_ERROR_UNREF(disconnect_error_.Load(MemoryOrder::RELAXED));
1493
1472
  gpr_mu_destroy(&info_mu_);
1494
1473
  }
@@ -1592,7 +1571,7 @@ void ChannelData::UpdateServiceConfigLocked(
1592
1571
  void ChannelData::CreateResolvingLoadBalancingPolicyLocked() {
1593
1572
  // Instantiate resolving LB policy.
1594
1573
  LoadBalancingPolicy::Args lb_args;
1595
- lb_args.combiner = combiner_;
1574
+ lb_args.work_serializer = work_serializer_;
1596
1575
  lb_args.channel_control_helper =
1597
1576
  absl::make_unique<ClientChannelControlHelper>(this);
1598
1577
  lb_args.args = channel_args_;
@@ -1630,32 +1609,13 @@ void ChannelData::ProcessLbPolicy(
1630
1609
  // If not, try the setting from channel args.
1631
1610
  const char* policy_name = nullptr;
1632
1611
  if (parsed_service_config != nullptr &&
1633
- parsed_service_config->parsed_deprecated_lb_policy() != nullptr) {
1634
- policy_name = parsed_service_config->parsed_deprecated_lb_policy();
1612
+ !parsed_service_config->parsed_deprecated_lb_policy().empty()) {
1613
+ policy_name = parsed_service_config->parsed_deprecated_lb_policy().c_str();
1635
1614
  } else {
1636
1615
  const grpc_arg* channel_arg =
1637
1616
  grpc_channel_args_find(resolver_result.args, GRPC_ARG_LB_POLICY_NAME);
1638
1617
  policy_name = grpc_channel_arg_get_string(channel_arg);
1639
1618
  }
1640
- // Special case: If at least one balancer address is present, we use
1641
- // the grpclb policy, regardless of what the resolver has returned.
1642
- bool found_balancer_address = false;
1643
- for (size_t i = 0; i < resolver_result.addresses.size(); ++i) {
1644
- const ServerAddress& address = resolver_result.addresses[i];
1645
- if (address.IsBalancer()) {
1646
- found_balancer_address = true;
1647
- break;
1648
- }
1649
- }
1650
- if (found_balancer_address) {
1651
- if (policy_name != nullptr && strcmp(policy_name, "grpclb") != 0) {
1652
- gpr_log(GPR_INFO,
1653
- "resolver requested LB policy %s but provided at least one "
1654
- "balancer address -- forcing use of grpclb LB policy",
1655
- policy_name);
1656
- }
1657
- policy_name = "grpclb";
1658
- }
1659
1619
  // Use pick_first if nothing was specified and we didn't select grpclb
1660
1620
  // above.
1661
1621
  if (policy_name == nullptr) policy_name = "pick_first";
@@ -1781,7 +1741,7 @@ bool ChannelData::ProcessResolverResultLocked(
1781
1741
  chand->received_first_resolver_result_ = true;
1782
1742
  RefCountedPtr<ServerRetryThrottleData> retry_throttle_data;
1783
1743
  if (parsed_service_config != nullptr) {
1784
- Optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
1744
+ absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
1785
1745
  retry_throttle_config = parsed_service_config->retry_throttling();
1786
1746
  if (retry_throttle_config.has_value()) {
1787
1747
  retry_throttle_data =
@@ -1832,22 +1792,18 @@ grpc_error* ChannelData::DoPingLocked(grpc_transport_op* op) {
1832
1792
  return result.error;
1833
1793
  }
1834
1794
 
1835
- void ChannelData::StartTransportOpLocked(void* arg, grpc_error* /*ignored*/) {
1836
- grpc_transport_op* op = static_cast<grpc_transport_op*>(arg);
1837
- grpc_channel_element* elem =
1838
- static_cast<grpc_channel_element*>(op->handler_private.extra_arg);
1839
- ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
1795
+ void ChannelData::StartTransportOpLocked(grpc_transport_op* op) {
1840
1796
  // Connectivity watch.
1841
1797
  if (op->start_connectivity_watch != nullptr) {
1842
- chand->state_tracker_.AddWatcher(op->start_connectivity_watch_state,
1843
- std::move(op->start_connectivity_watch));
1798
+ state_tracker_.AddWatcher(op->start_connectivity_watch_state,
1799
+ std::move(op->start_connectivity_watch));
1844
1800
  }
1845
1801
  if (op->stop_connectivity_watch != nullptr) {
1846
- chand->state_tracker_.RemoveWatcher(op->stop_connectivity_watch);
1802
+ state_tracker_.RemoveWatcher(op->stop_connectivity_watch);
1847
1803
  }
1848
1804
  // Ping.
1849
1805
  if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
1850
- grpc_error* error = chand->DoPingLocked(op);
1806
+ grpc_error* error = DoPingLocked(op);
1851
1807
  if (error != GRPC_ERROR_NONE) {
1852
1808
  ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_initiate,
1853
1809
  GRPC_ERROR_REF(error));
@@ -1859,40 +1815,39 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* /*ignored*/) {
1859
1815
  }
1860
1816
  // Reset backoff.
1861
1817
  if (op->reset_connect_backoff) {
1862
- if (chand->resolving_lb_policy_ != nullptr) {
1863
- chand->resolving_lb_policy_->ResetBackoffLocked();
1818
+ if (resolving_lb_policy_ != nullptr) {
1819
+ resolving_lb_policy_->ResetBackoffLocked();
1864
1820
  }
1865
1821
  }
1866
1822
  // Disconnect or enter IDLE.
1867
1823
  if (op->disconnect_with_error != GRPC_ERROR_NONE) {
1868
1824
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
1869
- gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", chand,
1825
+ gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", this,
1870
1826
  grpc_error_string(op->disconnect_with_error));
1871
1827
  }
1872
- chand->DestroyResolvingLoadBalancingPolicyLocked();
1828
+ DestroyResolvingLoadBalancingPolicyLocked();
1873
1829
  intptr_t value;
1874
1830
  if (grpc_error_get_int(op->disconnect_with_error,
1875
1831
  GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, &value) &&
1876
1832
  static_cast<grpc_connectivity_state>(value) == GRPC_CHANNEL_IDLE) {
1877
- if (chand->disconnect_error() == GRPC_ERROR_NONE) {
1833
+ if (disconnect_error() == GRPC_ERROR_NONE) {
1878
1834
  // Enter IDLE state.
1879
- chand->UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE,
1880
- "channel entering IDLE", nullptr);
1835
+ UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, "channel entering IDLE",
1836
+ nullptr);
1881
1837
  }
1882
1838
  GRPC_ERROR_UNREF(op->disconnect_with_error);
1883
1839
  } else {
1884
1840
  // Disconnect.
1885
- GPR_ASSERT(chand->disconnect_error_.Load(MemoryOrder::RELAXED) ==
1841
+ GPR_ASSERT(disconnect_error_.Load(MemoryOrder::RELAXED) ==
1886
1842
  GRPC_ERROR_NONE);
1887
- chand->disconnect_error_.Store(op->disconnect_with_error,
1888
- MemoryOrder::RELEASE);
1889
- chand->UpdateStateAndPickerLocked(
1843
+ disconnect_error_.Store(op->disconnect_with_error, MemoryOrder::RELEASE);
1844
+ UpdateStateAndPickerLocked(
1890
1845
  GRPC_CHANNEL_SHUTDOWN, "shutdown from API",
1891
1846
  absl::make_unique<LoadBalancingPolicy::TransientFailurePicker>(
1892
1847
  GRPC_ERROR_REF(op->disconnect_with_error)));
1893
1848
  }
1894
1849
  }
1895
- GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "start_transport_op");
1850
+ GRPC_CHANNEL_STACK_UNREF(owning_stack_, "start_transport_op");
1896
1851
  ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, GRPC_ERROR_NONE);
1897
1852
  }
1898
1853
 
@@ -1904,13 +1859,10 @@ void ChannelData::StartTransportOp(grpc_channel_element* elem,
1904
1859
  if (op->bind_pollset != nullptr) {
1905
1860
  grpc_pollset_set_add_pollset(chand->interested_parties_, op->bind_pollset);
1906
1861
  }
1907
- // Pop into control plane combiner for remaining ops.
1908
- op->handler_private.extra_arg = elem;
1862
+ // Pop into control plane work_serializer for remaining ops.
1909
1863
  GRPC_CHANNEL_STACK_REF(chand->owning_stack_, "start_transport_op");
1910
- chand->combiner_->Run(
1911
- GRPC_CLOSURE_INIT(&op->handler_private.closure,
1912
- ChannelData::StartTransportOpLocked, op, nullptr),
1913
- GRPC_ERROR_NONE);
1864
+ chand->work_serializer_->Run(
1865
+ [chand, op]() { chand->StartTransportOpLocked(op); }, DEBUG_LOCATION);
1914
1866
  }
1915
1867
 
1916
1868
  void ChannelData::GetChannelInfo(grpc_channel_element* elem,
@@ -1961,14 +1913,13 @@ ChannelData::GetConnectedSubchannelInDataPlane(
1961
1913
  return connected_subchannel->Ref();
1962
1914
  }
1963
1915
 
1964
- void ChannelData::TryToConnectLocked(void* arg, grpc_error* /*error_ignored*/) {
1965
- auto* chand = static_cast<ChannelData*>(arg);
1966
- if (chand->resolving_lb_policy_ != nullptr) {
1967
- chand->resolving_lb_policy_->ExitIdleLocked();
1916
+ void ChannelData::TryToConnectLocked() {
1917
+ if (resolving_lb_policy_ != nullptr) {
1918
+ resolving_lb_policy_->ExitIdleLocked();
1968
1919
  } else {
1969
- chand->CreateResolvingLoadBalancingPolicyLocked();
1920
+ CreateResolvingLoadBalancingPolicyLocked();
1970
1921
  }
1971
- GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "TryToConnect");
1922
+ GRPC_CHANNEL_STACK_UNREF(owning_stack_, "TryToConnect");
1972
1923
  }
1973
1924
 
1974
1925
  grpc_connectivity_state ChannelData::CheckConnectivityState(
@@ -1976,8 +1927,7 @@ grpc_connectivity_state ChannelData::CheckConnectivityState(
1976
1927
  grpc_connectivity_state out = state_tracker_.state();
1977
1928
  if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
1978
1929
  GRPC_CHANNEL_STACK_REF(owning_stack_, "TryToConnect");
1979
- combiner_->Run(GRPC_CLOSURE_CREATE(TryToConnectLocked, this, nullptr),
1980
- GRPC_ERROR_NONE);
1930
+ work_serializer_->Run([this]() { TryToConnectLocked(); }, DEBUG_LOCATION);
1981
1931
  }
1982
1932
  return out;
1983
1933
  }
@@ -3225,10 +3175,9 @@ void CallData::OnComplete(void* arg, grpc_error* error) {
3225
3175
  ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
3226
3176
  CallData* calld = static_cast<CallData*>(elem->call_data);
3227
3177
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
3228
- char* batch_str = grpc_transport_stream_op_batch_string(&batch_data->batch);
3229
3178
  gpr_log(GPR_INFO, "chand=%p calld=%p: got on_complete, error=%s, batch=%s",
3230
- chand, calld, grpc_error_string(error), batch_str);
3231
- gpr_free(batch_str);
3179
+ chand, calld, grpc_error_string(error),
3180
+ grpc_transport_stream_op_batch_string(&batch_data->batch).c_str());
3232
3181
  }
3233
3182
  SubchannelCallRetryState* retry_state =
3234
3183
  static_cast<SubchannelCallRetryState*>(
@@ -3301,10 +3250,8 @@ void CallData::AddClosureForSubchannelBatch(
3301
3250
  GRPC_CLOSURE_INIT(&batch->handler_private.closure, StartBatchInCallCombiner,
3302
3251
  batch, grpc_schedule_on_exec_ctx);
3303
3252
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
3304
- char* batch_str = grpc_transport_stream_op_batch_string(batch);
3305
3253
  gpr_log(GPR_INFO, "chand=%p calld=%p: starting subchannel batch: %s", chand,
3306
- this, batch_str);
3307
- gpr_free(batch_str);
3254
+ this, grpc_transport_stream_op_batch_string(batch).c_str());
3308
3255
  }
3309
3256
  closures->Add(&batch->handler_private.closure, GRPC_ERROR_NONE,
3310
3257
  "start_subchannel_batch");
@@ -3817,45 +3764,52 @@ void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) {
3817
3764
  gpr_log(GPR_INFO, "chand=%p calld=%p: applying service config to call",
3818
3765
  chand, this);
3819
3766
  }
3820
- // Store a ref to the service_config in service_config_call_data_. Also, save
3821
- // a pointer to this in the call_context so that all future filters can access
3822
- // it.
3823
- service_config_call_data_ =
3824
- ServiceConfig::CallData(chand->service_config(), path_);
3825
- if (service_config_call_data_.service_config() != nullptr) {
3826
- call_context_[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA].value =
3827
- &service_config_call_data_;
3767
+ auto service_config = chand->service_config();
3768
+ if (service_config != nullptr) {
3769
+ // Create a ServiceConfigCallData for the call. This stores a ref to the
3770
+ // ServiceConfig and caches the right set of parsed configs to use for
3771
+ // the call. The MethodConfig will store itself in the call context,
3772
+ // so that it can be accessed by filters in the subchannel, and it
3773
+ // will be cleaned up when the call ends.
3774
+ const auto* method_params_vector =
3775
+ service_config->GetMethodParsedConfigVector(path_);
3776
+ auto* service_config_call_data = arena_->New<ServiceConfigCallData>(
3777
+ std::move(service_config), method_params_vector, call_context_);
3778
+ // Apply our own method params to the call.
3828
3779
  method_params_ = static_cast<ClientChannelMethodParsedConfig*>(
3829
- service_config_call_data_.GetMethodParsedConfig(
3780
+ service_config_call_data->GetMethodParsedConfig(
3830
3781
  internal::ClientChannelServiceConfigParser::ParserIndex()));
3831
- }
3832
- retry_throttle_data_ = chand->retry_throttle_data();
3833
- if (method_params_ != nullptr) {
3834
- // If the deadline from the service config is shorter than the one
3835
- // from the client API, reset the deadline timer.
3836
- if (chand->deadline_checking_enabled() && method_params_->timeout() != 0) {
3837
- const grpc_millis per_method_deadline =
3838
- grpc_cycle_counter_to_millis_round_up(call_start_time_) +
3839
- method_params_->timeout();
3840
- if (per_method_deadline < deadline_) {
3841
- deadline_ = per_method_deadline;
3842
- grpc_deadline_state_reset(elem, deadline_);
3782
+ if (method_params_ != nullptr) {
3783
+ // If the deadline from the service config is shorter than the one
3784
+ // from the client API, reset the deadline timer.
3785
+ if (chand->deadline_checking_enabled() &&
3786
+ method_params_->timeout() != 0) {
3787
+ const grpc_millis per_method_deadline =
3788
+ grpc_cycle_counter_to_millis_round_up(call_start_time_) +
3789
+ method_params_->timeout();
3790
+ if (per_method_deadline < deadline_) {
3791
+ deadline_ = per_method_deadline;
3792
+ grpc_deadline_state_reset(elem, deadline_);
3793
+ }
3843
3794
  }
3844
- }
3845
- // If the service config set wait_for_ready and the application
3846
- // did not explicitly set it, use the value from the service config.
3847
- uint32_t* send_initial_metadata_flags =
3848
- &pending_batches_[0]
3849
- .batch->payload->send_initial_metadata.send_initial_metadata_flags;
3850
- if (method_params_->wait_for_ready().has_value() &&
3851
- !(*send_initial_metadata_flags &
3852
- GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET)) {
3853
- if (method_params_->wait_for_ready().value()) {
3854
- *send_initial_metadata_flags |= GRPC_INITIAL_METADATA_WAIT_FOR_READY;
3855
- } else {
3856
- *send_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY;
3795
+ // If the service config set wait_for_ready and the application
3796
+ // did not explicitly set it, use the value from the service config.
3797
+ uint32_t* send_initial_metadata_flags =
3798
+ &pending_batches_[0]
3799
+ .batch->payload->send_initial_metadata
3800
+ .send_initial_metadata_flags;
3801
+ if (method_params_->wait_for_ready().has_value() &&
3802
+ !(*send_initial_metadata_flags &
3803
+ GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET)) {
3804
+ if (method_params_->wait_for_ready().value()) {
3805
+ *send_initial_metadata_flags |= GRPC_INITIAL_METADATA_WAIT_FOR_READY;
3806
+ } else {
3807
+ *send_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY;
3808
+ }
3857
3809
  }
3858
3810
  }
3811
+ // Set retry throttle data for call.
3812
+ retry_throttle_data_ = chand->retry_throttle_data();
3859
3813
  }
3860
3814
  // If no retry policy, disable retries.
3861
3815
  // TODO(roth): Remove this when adding support for transparent retries.
@@ -3911,8 +3865,25 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
3911
3865
  // The picker being null means that the channel is currently in IDLE state.
3912
3866
  // The incoming call will make the channel exit IDLE.
3913
3867
  if (chand->picker() == nullptr) {
3914
- // Bounce into the control plane combiner to exit IDLE.
3915
- chand->CheckConnectivityState(/*try_to_connect=*/true);
3868
+ GRPC_CHANNEL_STACK_REF(chand->owning_stack(), "PickSubchannelLocked");
3869
+ // Bounce into the control plane work serializer to exit IDLE. Since we are
3870
+ // holding on to the data plane mutex here, we offload it on the ExecCtx so
3871
+ // that we don't deadlock with ourselves.
3872
+ ExecCtx::Run(
3873
+ DEBUG_LOCATION,
3874
+ GRPC_CLOSURE_CREATE(
3875
+ [](void* arg, grpc_error* /*error*/) {
3876
+ auto* chand = static_cast<ChannelData*>(arg);
3877
+ chand->work_serializer()->Run(
3878
+ [chand]() {
3879
+ chand->CheckConnectivityState(/*try_to_connect=*/true);
3880
+ GRPC_CHANNEL_STACK_UNREF(chand->owning_stack(),
3881
+ "PickSubchannelLocked");
3882
+ },
3883
+ DEBUG_LOCATION);
3884
+ },
3885
+ chand, nullptr),
3886
+ GRPC_ERROR_NONE);
3916
3887
  // Queue the pick, so that it will be attempted once the channel
3917
3888
  // becomes connected.
3918
3889
  AddCallToQueuedPicksLocked(elem);