grpc 1.28.0 → 1.30.0

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 (497) 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 +22 -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 +203 -236
  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/client_auth_filter.cc +1 -2
  293. data/src/core/lib/slice/slice_intern.cc +2 -3
  294. data/src/core/lib/slice/slice_internal.h +14 -0
  295. data/src/core/lib/slice/slice_utils.h +9 -0
  296. data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
  297. data/src/core/lib/surface/call.cc +2 -3
  298. data/src/core/lib/surface/call_log_batch.cc +50 -58
  299. data/src/core/lib/surface/channel.cc +53 -31
  300. data/src/core/lib/surface/channel.h +35 -4
  301. data/src/core/lib/surface/channel_ping.cc +2 -3
  302. data/src/core/lib/surface/completion_queue.cc +33 -33
  303. data/src/core/lib/surface/event_string.cc +18 -25
  304. data/src/core/lib/surface/event_string.h +3 -1
  305. data/src/core/lib/surface/init_secure.cc +1 -4
  306. data/src/core/lib/surface/server.cc +570 -369
  307. data/src/core/lib/surface/server.h +32 -0
  308. data/src/core/lib/surface/version.cc +2 -2
  309. data/src/core/lib/transport/byte_stream.h +7 -2
  310. data/src/core/lib/transport/connectivity_state.cc +7 -6
  311. data/src/core/lib/transport/connectivity_state.h +5 -3
  312. data/src/core/lib/transport/metadata.cc +3 -3
  313. data/src/core/lib/transport/metadata_batch.h +2 -3
  314. data/src/core/lib/transport/static_metadata.h +1 -1
  315. data/src/core/lib/transport/status_conversion.cc +6 -14
  316. data/src/core/lib/transport/transport.cc +2 -3
  317. data/src/core/lib/transport/transport.h +3 -2
  318. data/src/core/lib/transport/transport_op_string.cc +61 -102
  319. data/src/core/lib/uri/uri_parser.h +2 -3
  320. data/src/core/plugin_registry/grpc_plugin_registry.cc +20 -4
  321. data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
  322. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +8 -1
  323. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
  324. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +32 -2
  325. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
  326. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
  327. data/src/core/tsi/fake_transport_security.cc +10 -15
  328. data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -2
  329. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
  330. data/src/core/tsi/ssl_transport_security.cc +52 -39
  331. data/src/core/tsi/ssl_transport_security.h +8 -8
  332. data/src/core/tsi/ssl_types.h +0 -2
  333. data/src/core/tsi/transport_security.h +6 -9
  334. data/src/core/tsi/transport_security_grpc.h +2 -3
  335. data/src/core/tsi/transport_security_interface.h +3 -3
  336. data/src/ruby/ext/grpc/rb_call.c +9 -1
  337. data/src/ruby/lib/grpc/errors.rb +103 -42
  338. data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
  339. data/src/ruby/lib/grpc/generic/interceptors.rb +4 -4
  340. data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
  341. data/src/ruby/lib/grpc/generic/service.rb +5 -4
  342. data/src/ruby/lib/grpc/structs.rb +1 -1
  343. data/src/ruby/lib/grpc/version.rb +1 -1
  344. data/src/ruby/pb/generate_proto_ruby.sh +5 -3
  345. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
  346. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
  347. data/src/ruby/spec/debug_message_spec.rb +134 -0
  348. data/src/ruby/spec/generic/service_spec.rb +2 -0
  349. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +5 -0
  350. data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -0
  351. data/src/ruby/spec/testdata/ca.pem +18 -13
  352. data/src/ruby/spec/testdata/client.key +26 -14
  353. data/src/ruby/spec/testdata/client.pem +18 -12
  354. data/src/ruby/spec/testdata/server1.key +26 -14
  355. data/src/ruby/spec/testdata/server1.pem +20 -14
  356. data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
  357. data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
  358. data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
  359. data/third_party/abseil-cpp/absl/time/clock.h +74 -0
  360. data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
  361. data/third_party/abseil-cpp/absl/time/format.cc +153 -0
  362. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
  363. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
  364. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
  365. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
  366. data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
  367. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
  368. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
  369. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
  370. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
  371. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
  372. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
  373. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
  374. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
  375. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
  376. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
  377. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
  378. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
  379. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
  380. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
  381. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
  382. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
  383. data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
  384. data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
  385. data/third_party/abseil-cpp/absl/time/time.cc +499 -0
  386. data/third_party/abseil-cpp/absl/time/time.h +1584 -0
  387. data/third_party/boringssl-with-bazel/err_data.c +329 -297
  388. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +1 -1
  389. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +7 -5
  390. data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +13 -4
  391. data/third_party/boringssl-with-bazel/src/crypto/crypto.c +11 -0
  392. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519.c +18 -26
  393. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519_tables.h +13 -21
  394. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/internal.h +14 -22
  395. data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +1 -1
  396. data/third_party/boringssl-with-bazel/src/crypto/dh/dh.c +15 -0
  397. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +10 -0
  398. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +425 -0
  399. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +78 -0
  400. data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +2 -2
  401. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +33 -32
  402. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1 -1
  403. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +2 -1
  404. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +3 -3
  405. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +14 -11
  406. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +8 -8
  407. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +30 -154
  408. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +16 -0
  409. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +289 -117
  410. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +13 -27
  411. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
  412. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +25 -7
  413. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +432 -160
  414. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +63 -71
  415. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -14
  416. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9481 -9485
  417. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +80 -99
  418. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +736 -0
  419. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
  420. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +90 -11
  421. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +125 -148
  422. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +189 -3
  423. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +61 -18
  424. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +2 -2
  425. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
  426. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
  427. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
  428. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
  429. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +41 -5
  430. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +32 -17
  431. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +24 -114
  432. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +4 -0
  433. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +1 -0
  434. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +51 -38
  435. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +15 -1
  436. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +44 -35
  437. data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -12
  438. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +15 -1
  439. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +6 -10
  440. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +16 -0
  441. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +4 -0
  442. data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +4 -0
  443. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +278 -0
  444. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1474 -0
  445. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +720 -0
  446. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +16 -0
  447. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +5 -0
  448. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +4 -3
  449. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -1
  450. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +9 -4
  451. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +20 -0
  452. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
  453. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +16 -0
  454. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +6 -0
  455. data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -0
  456. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +5 -0
  457. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -17
  458. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +31 -0
  459. data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +26 -0
  460. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +172 -77
  461. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +1 -0
  462. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +291 -0
  463. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +5 -3
  464. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -0
  465. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +0 -4
  466. data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +3 -3
  467. data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -4
  468. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +146 -57
  469. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +14 -3
  470. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +28 -20
  471. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +12 -4
  472. data/third_party/boringssl-with-bazel/src/ssl/internal.h +64 -47
  473. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +10 -10
  474. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
  475. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -21
  476. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +29 -0
  477. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -0
  478. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +6 -1
  479. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +13 -2
  480. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +64 -5
  481. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +6 -0
  482. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +6 -2
  483. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +47 -53
  484. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -1
  485. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -27
  486. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +23 -75
  487. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +50 -20
  488. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +63 -25
  489. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +245 -175
  490. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +135 -75
  491. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1593 -1672
  492. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +512 -503
  493. metadata +111 -37
  494. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1754
  495. data/src/core/lib/gprpp/string_view.h +0 -60
  496. data/src/core/tsi/grpc_shadow_boringssl.h +0 -3311
  497. 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);
@@ -425,6 +425,10 @@ typedef struct {
425
425
  size_t* num_creds_md, grpc_status_code* status,
426
426
  const char** error_details);
427
427
 
428
+ /** Implements debug string of the given plugin. This method returns an
429
+ * allocated string that the caller needs to free using gpr_free() */
430
+ char* (*debug_string)(void* state);
431
+
428
432
  /** Destroys the plugin state. */
429
433
  void (*destroy)(void* state);
430
434
 
@@ -710,6 +714,10 @@ GRPCAPI grpc_server_credentials* grpc_local_server_credentials_create(
710
714
  /** --- TLS channel/server credentials ---
711
715
  * It is used for experimental purpose for now and subject to change. */
712
716
 
717
+ /** Struct for indicating errors. It is used for
718
+ * experimental purpose for now and subject to change. */
719
+ typedef struct grpc_tls_error_details grpc_tls_error_details;
720
+
713
721
  /** Config for TLS key materials. It is used for
714
722
  * experimental purpose for now and subject to change. */
715
723
  typedef struct grpc_tls_key_materials_config grpc_tls_key_materials_config;
@@ -789,11 +797,13 @@ GRPCAPI grpc_tls_key_materials_config* grpc_tls_key_materials_config_create(
789
797
  void);
790
798
 
791
799
  /** 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
800
  It's valid for the caller to provide nullptr pem_root_certs, in which case
794
801
  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.
802
+ NULL.
803
+ The ownerships of |pem_root_certs| and |pem_key_cert_pairs| remain with the
804
+ caller.
805
+ It returns 1 on success and 0 on failure. It is used for experimental
806
+ purpose for now and subject to change.
797
807
  */
798
808
  GRPCAPI int grpc_tls_key_materials_config_set_key_materials(
799
809
  grpc_tls_key_materials_config* config, const char* pem_root_certs,
@@ -832,8 +842,10 @@ typedef void (*grpc_tls_on_credential_reload_done_cb)(
832
842
  - cb and cb_user_data represent a gRPC-provided
833
843
  callback and an argument passed to it.
834
844
  - 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.
845
+ used/newly reloaded credentials. If credential reload does not result in
846
+ a new credential, key_materials_config should not be modified. The same
847
+ key_materials_config object can be updated if new key materials is
848
+ available.
837
849
  - status and error_details are used to hold information about
838
850
  errors occurred when a credential reload request is scheduled/cancelled.
839
851
  - config is a pointer to the unique grpc_tls_credential_reload_config
@@ -849,7 +861,7 @@ struct grpc_tls_credential_reload_arg {
849
861
  void* cb_user_data;
850
862
  grpc_tls_key_materials_config* key_materials_config;
851
863
  grpc_ssl_certificate_config_reload_status status;
852
- const char* error_details;
864
+ grpc_tls_error_details* error_details;
853
865
  grpc_tls_credential_reload_config* config;
854
866
  void* context;
855
867
  void (*destroy_context)(void* ctx);
@@ -861,8 +873,9 @@ struct grpc_tls_credential_reload_arg {
861
873
  - schedule is a pointer to an application-provided callback used to invoke
862
874
  credential reload API. The implementation of this method has to be
863
875
  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.
876
+ 1) If processing occurs synchronously, it populates
877
+ arg->key_materials_config, arg->status, and arg->error_details
878
+ and returns zero.
866
879
  2) If processing occurs asynchronously, it returns a non-zero value.
867
880
  The application then invokes arg->cb when processing is completed. Note
868
881
  that arg->cb cannot be invoked before schedule API returns.
@@ -926,7 +939,7 @@ struct grpc_tls_server_authorization_check_arg {
926
939
  const char* peer_cert;
927
940
  const char* peer_cert_full_chain;
928
941
  grpc_status_code status;
929
- const char* error_details;
942
+ grpc_tls_error_details* error_details;
930
943
  grpc_tls_server_authorization_check_config* config;
931
944
  void* context;
932
945
  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,11 +166,15 @@ 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,
@@ -204,13 +215,15 @@ class ChannelData {
204
215
 
205
216
  ~ExternalConnectivityWatcher();
206
217
 
218
+ void Start();
219
+
207
220
  void Notify(grpc_connectivity_state state) override;
208
221
 
209
222
  void Cancel();
210
223
 
211
224
  private:
212
- static void AddWatcherLocked(void* arg, grpc_error* ignored);
213
- static void RemoveWatcherLocked(void* arg, grpc_error* ignored);
225
+ void AddWatcherLocked();
226
+ void RemoveWatcherLocked();
214
227
 
215
228
  ChannelData* chand_;
216
229
  grpc_polling_entity pollent_;
@@ -218,8 +231,6 @@ class ChannelData {
218
231
  grpc_connectivity_state* state_;
219
232
  grpc_closure* on_complete_;
220
233
  grpc_closure* watcher_timer_init_;
221
- grpc_closure add_closure_;
222
- grpc_closure remove_closure_;
223
234
  Atomic<bool> done_{false};
224
235
  };
225
236
 
@@ -245,9 +256,9 @@ class ChannelData {
245
256
 
246
257
  grpc_error* DoPingLocked(grpc_transport_op* op);
247
258
 
248
- static void StartTransportOpLocked(void* arg, grpc_error* ignored);
259
+ void StartTransportOpLocked(grpc_transport_op* op);
249
260
 
250
- static void TryToConnectLocked(void* arg, grpc_error* error_ignored);
261
+ void TryToConnectLocked();
251
262
 
252
263
  void ProcessLbPolicy(
253
264
  const Resolver::Result& resolver_result,
@@ -280,9 +291,9 @@ class ChannelData {
280
291
  RefCountedPtr<ServiceConfig> service_config_;
281
292
 
282
293
  //
283
- // Fields used in the control plane. Guarded by combiner.
294
+ // Fields used in the control plane. Guarded by work_serializer.
284
295
  //
285
- Combiner* combiner_;
296
+ std::shared_ptr<WorkSerializer> work_serializer_;
286
297
  grpc_pollset_set* interested_parties_;
287
298
  RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
288
299
  OrphanablePtr<ResolvingLoadBalancingPolicy> resolving_lb_policy_;
@@ -294,17 +305,17 @@ class ChannelData {
294
305
  std::map<Subchannel*, int> subchannel_refcount_map_;
295
306
  // The set of SubchannelWrappers that currently exist.
296
307
  // No need to hold a ref, since the map is updated in the control-plane
297
- // combiner when the SubchannelWrappers are created and destroyed.
308
+ // work_serializer when the SubchannelWrappers are created and destroyed.
298
309
  std::set<SubchannelWrapper*> subchannel_wrappers_;
299
310
  // 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>>
311
+ // Updates are queued here in the control plane work_serializer and then
312
+ // applied in the data plane mutex when the picker is updated.
313
+ std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>>
304
314
  pending_subchannel_updates_;
305
315
 
306
316
  //
307
- // Fields accessed from both data plane mutex and control plane combiner.
317
+ // Fields accessed from both data plane mutex and control plane
318
+ // work_serializer.
308
319
  //
309
320
  Atomic<grpc_error*> disconnect_error_;
310
321
 
@@ -364,7 +375,7 @@ class CallData {
364
375
  Metadata(CallData* calld, grpc_metadata_batch* batch)
365
376
  : calld_(calld), batch_(batch) {}
366
377
 
367
- void Add(StringView key, StringView value) override {
378
+ void Add(absl::string_view key, absl::string_view value) override {
368
379
  grpc_linked_mdelem* linked_mdelem = static_cast<grpc_linked_mdelem*>(
369
380
  calld_->arena_->Alloc(sizeof(grpc_linked_mdelem)));
370
381
  linked_mdelem->md = grpc_mdelem_from_slices(
@@ -399,7 +410,7 @@ class CallData {
399
410
  reinterpret_cast<grpc_linked_mdelem*>(handle);
400
411
  return reinterpret_cast<intptr_t>(linked_mdelem->next);
401
412
  }
402
- std::pair<StringView, StringView> IteratorHandleGet(
413
+ std::pair<absl::string_view, absl::string_view> IteratorHandleGet(
403
414
  intptr_t handle) const override {
404
415
  grpc_linked_mdelem* linked_mdelem =
405
416
  reinterpret_cast<grpc_linked_mdelem*>(handle);
@@ -431,6 +442,12 @@ class CallData {
431
442
  return calld_->backend_metric_data_;
432
443
  }
433
444
 
445
+ absl::string_view ExperimentalGetCallAttribute(const char* key) override {
446
+ auto it = calld_->call_attributes_.find(key);
447
+ if (it == calld_->call_attributes_.end()) return absl::string_view();
448
+ return it->second;
449
+ }
450
+
434
451
  private:
435
452
  CallData* calld_;
436
453
  };
@@ -750,8 +767,8 @@ class CallData {
750
767
  grpc_call_context_element* call_context_;
751
768
 
752
769
  RefCountedPtr<ServerRetryThrottleData> retry_throttle_data_;
753
- ServiceConfig::CallData service_config_call_data_;
754
770
  const ClientChannelMethodParsedConfig* method_params_ = nullptr;
771
+ std::map<const char*, absl::string_view> call_attributes_;
755
772
 
756
773
  RefCountedPtr<SubchannelCall> subchannel_call_;
757
774
 
@@ -820,7 +837,7 @@ class CallData {
820
837
  // Note: We inline the cache for the first 3 send_message ops and use
821
838
  // dynamic allocation after that. This number was essentially picked
822
839
  // at random; it could be changed in the future to tune performance.
823
- InlinedVector<ByteStreamCache*, 3> send_messages_;
840
+ absl::InlinedVector<ByteStreamCache*, 3> send_messages_;
824
841
  // send_trailing_metadata
825
842
  bool seen_send_trailing_metadata_ = false;
826
843
  grpc_linked_mdelem* send_trailing_metadata_storage_ = nullptr;
@@ -838,7 +855,7 @@ class CallData {
838
855
  // Note that no synchronization is needed here, because even if the
839
856
  // underlying subchannel is shared between channels, this wrapper will only
840
857
  // be used within one channel, so it will always be synchronized by the
841
- // control plane combiner.
858
+ // control plane work_serializer.
842
859
  class ChannelData::SubchannelWrapper : public SubchannelInterface {
843
860
  public:
844
861
  SubchannelWrapper(ChannelData* chand, Subchannel* subchannel,
@@ -907,7 +924,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
907
924
  initial_state,
908
925
  grpc_core::UniquePtr<char>(
909
926
  gpr_strdup(health_check_service_name_.get())),
910
- OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
927
+ RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
911
928
  watcher_wrapper));
912
929
  }
913
930
 
@@ -957,14 +974,14 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
957
974
  replacement->last_seen_state(),
958
975
  grpc_core::UniquePtr<char>(
959
976
  gpr_strdup(health_check_service_name.get())),
960
- OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
977
+ RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
961
978
  replacement));
962
979
  }
963
980
  // Save the new health check service name.
964
981
  health_check_service_name_ = std::move(health_check_service_name);
965
982
  }
966
983
 
967
- // Caller must be holding the control-plane combiner.
984
+ // Caller must be holding the control-plane work_serializer.
968
985
  ConnectedSubchannel* connected_subchannel() const {
969
986
  return connected_subchannel_.get();
970
987
  }
@@ -1004,23 +1021,27 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
1004
1021
  parent_(std::move(parent)),
1005
1022
  last_seen_state_(initial_state) {}
1006
1023
 
1007
- ~WatcherWrapper() { parent_.reset(DEBUG_LOCATION, "WatcherWrapper"); }
1008
-
1009
- void Orphan() override { Unref(); }
1024
+ ~WatcherWrapper() {
1025
+ auto* parent = parent_.release(); // ref owned by lambda
1026
+ parent->chand_->work_serializer_->Run(
1027
+ [parent]() { parent->Unref(DEBUG_LOCATION, "WatcherWrapper"); },
1028
+ DEBUG_LOCATION);
1029
+ }
1010
1030
 
1011
- void OnConnectivityStateChange(
1012
- grpc_connectivity_state new_state,
1013
- RefCountedPtr<ConnectedSubchannel> connected_subchannel) override {
1031
+ void OnConnectivityStateChange() override {
1014
1032
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1015
1033
  gpr_log(GPR_INFO,
1016
1034
  "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));
1035
+ "subchannel %p; hopping into work_serializer",
1036
+ parent_->chand_, parent_.get(), parent_->subchannel_);
1021
1037
  }
1022
- // Will delete itself.
1023
- new Updater(Ref(), new_state, std::move(connected_subchannel));
1038
+ Ref().release(); // ref owned by lambda
1039
+ parent_->chand_->work_serializer_->Run(
1040
+ [this]() {
1041
+ ApplyUpdateInControlPlaneWorkSerializer();
1042
+ Unref();
1043
+ },
1044
+ DEBUG_LOCATION);
1024
1045
  }
1025
1046
 
1026
1047
  grpc_pollset_set* interested_parties() override {
@@ -1040,50 +1061,25 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
1040
1061
  grpc_connectivity_state last_seen_state() const { return last_seen_state_; }
1041
1062
 
1042
1063
  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);
1064
+ void ApplyUpdateInControlPlaneWorkSerializer() {
1065
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1066
+ gpr_log(GPR_INFO,
1067
+ "chand=%p: processing connectivity change in work serializer "
1068
+ "for subchannel wrapper %p subchannel %p "
1069
+ "watcher=%p",
1070
+ parent_->chand_, parent_.get(), parent_->subchannel_,
1071
+ watcher_.get());
1055
1072
  }
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;
1073
+ ConnectivityStateChange state_change = PopConnectivityStateChange();
1074
+ // Ignore update if the parent WatcherWrapper has been replaced
1075
+ // since this callback was scheduled.
1076
+ if (watcher_ != nullptr) {
1077
+ last_seen_state_ = state_change.state;
1078
+ parent_->MaybeUpdateConnectedSubchannel(
1079
+ std::move(state_change.connected_subchannel));
1080
+ watcher_->OnConnectivityStateChange(state_change.state);
1080
1081
  }
1081
-
1082
- RefCountedPtr<WatcherWrapper> parent_;
1083
- grpc_connectivity_state state_;
1084
- RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
1085
- grpc_closure closure_;
1086
- };
1082
+ }
1087
1083
 
1088
1084
  std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
1089
1085
  watcher_;
@@ -1122,7 +1118,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
1122
1118
  // CancelConnectivityStateWatch() with its watcher, we know the
1123
1119
  // corresponding WrapperWatcher to cancel on the underlying subchannel.
1124
1120
  std::map<ConnectivityStateWatcherInterface*, WatcherWrapper*> watcher_map_;
1125
- // To be accessed only in the control plane combiner.
1121
+ // To be accessed only in the control plane work_serializer.
1126
1122
  RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
1127
1123
  // To be accessed only in the data plane mutex.
1128
1124
  RefCountedPtr<ConnectedSubchannel> connected_subchannel_in_data_plane_;
@@ -1145,9 +1141,6 @@ ChannelData::ExternalConnectivityWatcher::ExternalConnectivityWatcher(
1145
1141
  grpc_polling_entity_add_to_pollset_set(&pollent_,
1146
1142
  chand_->interested_parties_);
1147
1143
  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
1144
  }
1152
1145
 
1153
1146
  ChannelData::ExternalConnectivityWatcher::~ExternalConnectivityWatcher() {
@@ -1157,6 +1150,11 @@ ChannelData::ExternalConnectivityWatcher::~ExternalConnectivityWatcher() {
1157
1150
  "ExternalConnectivityWatcher");
1158
1151
  }
1159
1152
 
1153
+ void ChannelData::ExternalConnectivityWatcher::Start() {
1154
+ chand_->work_serializer_->Run([this]() { AddWatcherLocked(); },
1155
+ DEBUG_LOCATION);
1156
+ }
1157
+
1160
1158
  void ChannelData::ExternalConnectivityWatcher::Notify(
1161
1159
  grpc_connectivity_state state) {
1162
1160
  bool done = false;
@@ -1169,13 +1167,12 @@ void ChannelData::ExternalConnectivityWatcher::Notify(
1169
1167
  // Report new state to the user.
1170
1168
  *state_ = state;
1171
1169
  ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_NONE);
1172
- // Hop back into the combiner to clean up.
1170
+ // Hop back into the work_serializer to clean up.
1173
1171
  // Not needed in state SHUTDOWN, because the tracker will
1174
1172
  // automatically remove all watchers in that case.
1175
1173
  if (state != GRPC_CHANNEL_SHUTDOWN) {
1176
- chand_->combiner_->Run(
1177
- GRPC_CLOSURE_INIT(&remove_closure_, RemoveWatcherLocked, this, nullptr),
1178
- GRPC_ERROR_NONE);
1174
+ chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
1175
+ DEBUG_LOCATION);
1179
1176
  }
1180
1177
  }
1181
1178
 
@@ -1186,28 +1183,20 @@ void ChannelData::ExternalConnectivityWatcher::Cancel() {
1186
1183
  return; // Already done.
1187
1184
  }
1188
1185
  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);
1186
+ // Hop back into the work_serializer to clean up.
1187
+ chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
1188
+ DEBUG_LOCATION);
1193
1189
  }
1194
1190
 
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);
1191
+ void ChannelData::ExternalConnectivityWatcher::AddWatcherLocked() {
1192
+ Closure::Run(DEBUG_LOCATION, watcher_timer_init_, GRPC_ERROR_NONE);
1200
1193
  // Add new watcher.
1201
- self->chand_->state_tracker_.AddWatcher(
1202
- self->initial_state_,
1203
- OrphanablePtr<ConnectivityStateWatcherInterface>(self));
1194
+ chand_->state_tracker_.AddWatcher(
1195
+ initial_state_, OrphanablePtr<ConnectivityStateWatcherInterface>(this));
1204
1196
  }
1205
1197
 
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);
1198
+ void ChannelData::ExternalConnectivityWatcher::RemoveWatcherLocked() {
1199
+ chand_->state_tracker_.RemoveWatcher(this);
1211
1200
  }
1212
1201
 
1213
1202
  //
@@ -1223,28 +1212,20 @@ class ChannelData::ConnectivityWatcherAdder {
1223
1212
  initial_state_(initial_state),
1224
1213
  watcher_(std::move(watcher)) {
1225
1214
  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);
1215
+ chand_->work_serializer_->Run([this]() { AddWatcherLocked(); },
1216
+ DEBUG_LOCATION);
1231
1217
  }
1232
1218
 
1233
1219
  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;
1220
+ void AddWatcherLocked() {
1221
+ chand_->state_tracker_.AddWatcher(initial_state_, std::move(watcher_));
1222
+ GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "ConnectivityWatcherAdder");
1223
+ delete this;
1242
1224
  }
1243
1225
 
1244
1226
  ChannelData* chand_;
1245
1227
  grpc_connectivity_state initial_state_;
1246
1228
  OrphanablePtr<AsyncConnectivityStateWatcherInterface> watcher_;
1247
- grpc_closure closure_;
1248
1229
  };
1249
1230
 
1250
1231
  //
@@ -1257,26 +1238,20 @@ class ChannelData::ConnectivityWatcherRemover {
1257
1238
  AsyncConnectivityStateWatcherInterface* watcher)
1258
1239
  : chand_(chand), watcher_(watcher) {
1259
1240
  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);
1241
+ chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
1242
+ DEBUG_LOCATION);
1265
1243
  }
1266
1244
 
1267
1245
  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_,
1246
+ void RemoveWatcherLocked() {
1247
+ chand_->state_tracker_.RemoveWatcher(watcher_);
1248
+ GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_,
1273
1249
  "ConnectivityWatcherRemover");
1274
- delete self;
1250
+ delete this;
1275
1251
  }
1276
1252
 
1277
1253
  ChannelData* chand_;
1278
1254
  AsyncConnectivityStateWatcherInterface* watcher_;
1279
- grpc_closure closure_;
1280
1255
  };
1281
1256
 
1282
1257
  //
@@ -1340,7 +1315,8 @@ class ChannelData::ClientChannelControlHelper
1340
1315
  // No-op -- we should never get this from ResolvingLoadBalancingPolicy.
1341
1316
  void RequestReresolution() override {}
1342
1317
 
1343
- void AddTraceEvent(TraceSeverity severity, StringView message) override {
1318
+ void AddTraceEvent(TraceSeverity severity,
1319
+ absl::string_view message) override {
1344
1320
  if (chand_->channelz_node_ != nullptr) {
1345
1321
  chand_->channelz_node_->AddTraceEvent(
1346
1322
  ConvertSeverityEnum(severity),
@@ -1417,7 +1393,7 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
1417
1393
  client_channel_factory_(
1418
1394
  ClientChannelFactory::GetFromChannelArgs(args->channel_args)),
1419
1395
  channelz_node_(GetChannelzNode(args->channel_args)),
1420
- combiner_(grpc_combiner_create()),
1396
+ work_serializer_(std::make_shared<WorkSerializer>()),
1421
1397
  interested_parties_(grpc_pollset_set_create()),
1422
1398
  subchannel_pool_(GetSubchannelPool(args->channel_args)),
1423
1399
  state_tracker_("client_channel", GRPC_CHANNEL_IDLE),
@@ -1488,7 +1464,6 @@ ChannelData::~ChannelData() {
1488
1464
  // Stop backup polling.
1489
1465
  grpc_client_channel_stop_backup_polling(interested_parties_);
1490
1466
  grpc_pollset_set_destroy(interested_parties_);
1491
- GRPC_COMBINER_UNREF(combiner_, "client_channel");
1492
1467
  GRPC_ERROR_UNREF(disconnect_error_.Load(MemoryOrder::RELAXED));
1493
1468
  gpr_mu_destroy(&info_mu_);
1494
1469
  }
@@ -1592,7 +1567,7 @@ void ChannelData::UpdateServiceConfigLocked(
1592
1567
  void ChannelData::CreateResolvingLoadBalancingPolicyLocked() {
1593
1568
  // Instantiate resolving LB policy.
1594
1569
  LoadBalancingPolicy::Args lb_args;
1595
- lb_args.combiner = combiner_;
1570
+ lb_args.work_serializer = work_serializer_;
1596
1571
  lb_args.channel_control_helper =
1597
1572
  absl::make_unique<ClientChannelControlHelper>(this);
1598
1573
  lb_args.args = channel_args_;
@@ -1630,32 +1605,13 @@ void ChannelData::ProcessLbPolicy(
1630
1605
  // If not, try the setting from channel args.
1631
1606
  const char* policy_name = nullptr;
1632
1607
  if (parsed_service_config != nullptr &&
1633
- parsed_service_config->parsed_deprecated_lb_policy() != nullptr) {
1634
- policy_name = parsed_service_config->parsed_deprecated_lb_policy();
1608
+ !parsed_service_config->parsed_deprecated_lb_policy().empty()) {
1609
+ policy_name = parsed_service_config->parsed_deprecated_lb_policy().c_str();
1635
1610
  } else {
1636
1611
  const grpc_arg* channel_arg =
1637
1612
  grpc_channel_args_find(resolver_result.args, GRPC_ARG_LB_POLICY_NAME);
1638
1613
  policy_name = grpc_channel_arg_get_string(channel_arg);
1639
1614
  }
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
1615
  // Use pick_first if nothing was specified and we didn't select grpclb
1660
1616
  // above.
1661
1617
  if (policy_name == nullptr) policy_name = "pick_first";
@@ -1781,7 +1737,7 @@ bool ChannelData::ProcessResolverResultLocked(
1781
1737
  chand->received_first_resolver_result_ = true;
1782
1738
  RefCountedPtr<ServerRetryThrottleData> retry_throttle_data;
1783
1739
  if (parsed_service_config != nullptr) {
1784
- Optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
1740
+ absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
1785
1741
  retry_throttle_config = parsed_service_config->retry_throttling();
1786
1742
  if (retry_throttle_config.has_value()) {
1787
1743
  retry_throttle_data =
@@ -1832,22 +1788,18 @@ grpc_error* ChannelData::DoPingLocked(grpc_transport_op* op) {
1832
1788
  return result.error;
1833
1789
  }
1834
1790
 
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);
1791
+ void ChannelData::StartTransportOpLocked(grpc_transport_op* op) {
1840
1792
  // Connectivity watch.
1841
1793
  if (op->start_connectivity_watch != nullptr) {
1842
- chand->state_tracker_.AddWatcher(op->start_connectivity_watch_state,
1843
- std::move(op->start_connectivity_watch));
1794
+ state_tracker_.AddWatcher(op->start_connectivity_watch_state,
1795
+ std::move(op->start_connectivity_watch));
1844
1796
  }
1845
1797
  if (op->stop_connectivity_watch != nullptr) {
1846
- chand->state_tracker_.RemoveWatcher(op->stop_connectivity_watch);
1798
+ state_tracker_.RemoveWatcher(op->stop_connectivity_watch);
1847
1799
  }
1848
1800
  // Ping.
1849
1801
  if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
1850
- grpc_error* error = chand->DoPingLocked(op);
1802
+ grpc_error* error = DoPingLocked(op);
1851
1803
  if (error != GRPC_ERROR_NONE) {
1852
1804
  ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_initiate,
1853
1805
  GRPC_ERROR_REF(error));
@@ -1859,40 +1811,39 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* /*ignored*/) {
1859
1811
  }
1860
1812
  // Reset backoff.
1861
1813
  if (op->reset_connect_backoff) {
1862
- if (chand->resolving_lb_policy_ != nullptr) {
1863
- chand->resolving_lb_policy_->ResetBackoffLocked();
1814
+ if (resolving_lb_policy_ != nullptr) {
1815
+ resolving_lb_policy_->ResetBackoffLocked();
1864
1816
  }
1865
1817
  }
1866
1818
  // Disconnect or enter IDLE.
1867
1819
  if (op->disconnect_with_error != GRPC_ERROR_NONE) {
1868
1820
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
1869
- gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", chand,
1821
+ gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", this,
1870
1822
  grpc_error_string(op->disconnect_with_error));
1871
1823
  }
1872
- chand->DestroyResolvingLoadBalancingPolicyLocked();
1824
+ DestroyResolvingLoadBalancingPolicyLocked();
1873
1825
  intptr_t value;
1874
1826
  if (grpc_error_get_int(op->disconnect_with_error,
1875
1827
  GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, &value) &&
1876
1828
  static_cast<grpc_connectivity_state>(value) == GRPC_CHANNEL_IDLE) {
1877
- if (chand->disconnect_error() == GRPC_ERROR_NONE) {
1829
+ if (disconnect_error() == GRPC_ERROR_NONE) {
1878
1830
  // Enter IDLE state.
1879
- chand->UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE,
1880
- "channel entering IDLE", nullptr);
1831
+ UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, "channel entering IDLE",
1832
+ nullptr);
1881
1833
  }
1882
1834
  GRPC_ERROR_UNREF(op->disconnect_with_error);
1883
1835
  } else {
1884
1836
  // Disconnect.
1885
- GPR_ASSERT(chand->disconnect_error_.Load(MemoryOrder::RELAXED) ==
1837
+ GPR_ASSERT(disconnect_error_.Load(MemoryOrder::RELAXED) ==
1886
1838
  GRPC_ERROR_NONE);
1887
- chand->disconnect_error_.Store(op->disconnect_with_error,
1888
- MemoryOrder::RELEASE);
1889
- chand->UpdateStateAndPickerLocked(
1839
+ disconnect_error_.Store(op->disconnect_with_error, MemoryOrder::RELEASE);
1840
+ UpdateStateAndPickerLocked(
1890
1841
  GRPC_CHANNEL_SHUTDOWN, "shutdown from API",
1891
1842
  absl::make_unique<LoadBalancingPolicy::TransientFailurePicker>(
1892
1843
  GRPC_ERROR_REF(op->disconnect_with_error)));
1893
1844
  }
1894
1845
  }
1895
- GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "start_transport_op");
1846
+ GRPC_CHANNEL_STACK_UNREF(owning_stack_, "start_transport_op");
1896
1847
  ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, GRPC_ERROR_NONE);
1897
1848
  }
1898
1849
 
@@ -1904,13 +1855,10 @@ void ChannelData::StartTransportOp(grpc_channel_element* elem,
1904
1855
  if (op->bind_pollset != nullptr) {
1905
1856
  grpc_pollset_set_add_pollset(chand->interested_parties_, op->bind_pollset);
1906
1857
  }
1907
- // Pop into control plane combiner for remaining ops.
1908
- op->handler_private.extra_arg = elem;
1858
+ // Pop into control plane work_serializer for remaining ops.
1909
1859
  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);
1860
+ chand->work_serializer_->Run(
1861
+ [chand, op]() { chand->StartTransportOpLocked(op); }, DEBUG_LOCATION);
1914
1862
  }
1915
1863
 
1916
1864
  void ChannelData::GetChannelInfo(grpc_channel_element* elem,
@@ -1961,14 +1909,13 @@ ChannelData::GetConnectedSubchannelInDataPlane(
1961
1909
  return connected_subchannel->Ref();
1962
1910
  }
1963
1911
 
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();
1912
+ void ChannelData::TryToConnectLocked() {
1913
+ if (resolving_lb_policy_ != nullptr) {
1914
+ resolving_lb_policy_->ExitIdleLocked();
1968
1915
  } else {
1969
- chand->CreateResolvingLoadBalancingPolicyLocked();
1916
+ CreateResolvingLoadBalancingPolicyLocked();
1970
1917
  }
1971
- GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "TryToConnect");
1918
+ GRPC_CHANNEL_STACK_UNREF(owning_stack_, "TryToConnect");
1972
1919
  }
1973
1920
 
1974
1921
  grpc_connectivity_state ChannelData::CheckConnectivityState(
@@ -1976,8 +1923,7 @@ grpc_connectivity_state ChannelData::CheckConnectivityState(
1976
1923
  grpc_connectivity_state out = state_tracker_.state();
1977
1924
  if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
1978
1925
  GRPC_CHANNEL_STACK_REF(owning_stack_, "TryToConnect");
1979
- combiner_->Run(GRPC_CLOSURE_CREATE(TryToConnectLocked, this, nullptr),
1980
- GRPC_ERROR_NONE);
1926
+ work_serializer_->Run([this]() { TryToConnectLocked(); }, DEBUG_LOCATION);
1981
1927
  }
1982
1928
  return out;
1983
1929
  }
@@ -3225,10 +3171,9 @@ void CallData::OnComplete(void* arg, grpc_error* error) {
3225
3171
  ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
3226
3172
  CallData* calld = static_cast<CallData*>(elem->call_data);
3227
3173
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
3228
- char* batch_str = grpc_transport_stream_op_batch_string(&batch_data->batch);
3229
3174
  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);
3175
+ chand, calld, grpc_error_string(error),
3176
+ grpc_transport_stream_op_batch_string(&batch_data->batch).c_str());
3232
3177
  }
3233
3178
  SubchannelCallRetryState* retry_state =
3234
3179
  static_cast<SubchannelCallRetryState*>(
@@ -3301,10 +3246,8 @@ void CallData::AddClosureForSubchannelBatch(
3301
3246
  GRPC_CLOSURE_INIT(&batch->handler_private.closure, StartBatchInCallCombiner,
3302
3247
  batch, grpc_schedule_on_exec_ctx);
3303
3248
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
3304
- char* batch_str = grpc_transport_stream_op_batch_string(batch);
3305
3249
  gpr_log(GPR_INFO, "chand=%p calld=%p: starting subchannel batch: %s", chand,
3306
- this, batch_str);
3307
- gpr_free(batch_str);
3250
+ this, grpc_transport_stream_op_batch_string(batch).c_str());
3308
3251
  }
3309
3252
  closures->Add(&batch->handler_private.closure, GRPC_ERROR_NONE,
3310
3253
  "start_subchannel_batch");
@@ -3817,45 +3760,52 @@ void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) {
3817
3760
  gpr_log(GPR_INFO, "chand=%p calld=%p: applying service config to call",
3818
3761
  chand, this);
3819
3762
  }
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_;
3763
+ auto service_config = chand->service_config();
3764
+ if (service_config != nullptr) {
3765
+ // Create a ServiceConfigCallData for the call. This stores a ref to the
3766
+ // ServiceConfig and caches the right set of parsed configs to use for
3767
+ // the call. The MethodConfig will store itself in the call context,
3768
+ // so that it can be accessed by filters in the subchannel, and it
3769
+ // will be cleaned up when the call ends.
3770
+ const auto* method_params_vector =
3771
+ service_config->GetMethodParsedConfigVector(path_);
3772
+ auto* service_config_call_data = arena_->New<ServiceConfigCallData>(
3773
+ std::move(service_config), method_params_vector, call_context_);
3774
+ // Apply our own method params to the call.
3828
3775
  method_params_ = static_cast<ClientChannelMethodParsedConfig*>(
3829
- service_config_call_data_.GetMethodParsedConfig(
3776
+ service_config_call_data->GetMethodParsedConfig(
3830
3777
  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_);
3778
+ if (method_params_ != nullptr) {
3779
+ // If the deadline from the service config is shorter than the one
3780
+ // from the client API, reset the deadline timer.
3781
+ if (chand->deadline_checking_enabled() &&
3782
+ method_params_->timeout() != 0) {
3783
+ const grpc_millis per_method_deadline =
3784
+ grpc_cycle_counter_to_millis_round_up(call_start_time_) +
3785
+ method_params_->timeout();
3786
+ if (per_method_deadline < deadline_) {
3787
+ deadline_ = per_method_deadline;
3788
+ grpc_deadline_state_reset(elem, deadline_);
3789
+ }
3843
3790
  }
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;
3791
+ // If the service config set wait_for_ready and the application
3792
+ // did not explicitly set it, use the value from the service config.
3793
+ uint32_t* send_initial_metadata_flags =
3794
+ &pending_batches_[0]
3795
+ .batch->payload->send_initial_metadata
3796
+ .send_initial_metadata_flags;
3797
+ if (method_params_->wait_for_ready().has_value() &&
3798
+ !(*send_initial_metadata_flags &
3799
+ GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET)) {
3800
+ if (method_params_->wait_for_ready().value()) {
3801
+ *send_initial_metadata_flags |= GRPC_INITIAL_METADATA_WAIT_FOR_READY;
3802
+ } else {
3803
+ *send_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY;
3804
+ }
3857
3805
  }
3858
3806
  }
3807
+ // Set retry throttle data for call.
3808
+ retry_throttle_data_ = chand->retry_throttle_data();
3859
3809
  }
3860
3810
  // If no retry policy, disable retries.
3861
3811
  // TODO(roth): Remove this when adding support for transparent retries.
@@ -3911,8 +3861,25 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
3911
3861
  // The picker being null means that the channel is currently in IDLE state.
3912
3862
  // The incoming call will make the channel exit IDLE.
3913
3863
  if (chand->picker() == nullptr) {
3914
- // Bounce into the control plane combiner to exit IDLE.
3915
- chand->CheckConnectivityState(/*try_to_connect=*/true);
3864
+ GRPC_CHANNEL_STACK_REF(chand->owning_stack(), "PickSubchannelLocked");
3865
+ // Bounce into the control plane work serializer to exit IDLE. Since we are
3866
+ // holding on to the data plane mutex here, we offload it on the ExecCtx so
3867
+ // that we don't deadlock with ourselves.
3868
+ ExecCtx::Run(
3869
+ DEBUG_LOCATION,
3870
+ GRPC_CLOSURE_CREATE(
3871
+ [](void* arg, grpc_error* /*error*/) {
3872
+ auto* chand = static_cast<ChannelData*>(arg);
3873
+ chand->work_serializer()->Run(
3874
+ [chand]() {
3875
+ chand->CheckConnectivityState(/*try_to_connect=*/true);
3876
+ GRPC_CHANNEL_STACK_UNREF(chand->owning_stack(),
3877
+ "PickSubchannelLocked");
3878
+ },
3879
+ DEBUG_LOCATION);
3880
+ },
3881
+ chand, nullptr),
3882
+ GRPC_ERROR_NONE);
3916
3883
  // Queue the pick, so that it will be attempted once the channel
3917
3884
  // becomes connected.
3918
3885
  AddCallToQueuedPicksLocked(elem);