grpc 1.52.0 → 1.53.0.pre2

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 (892) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +50 -5
  3. data/include/grpc/event_engine/event_engine.h +24 -2
  4. data/include/grpc/event_engine/slice_buffer.h +13 -1
  5. data/include/grpc/impl/grpc_types.h +3 -0
  6. data/include/grpc/support/time.h +6 -4
  7. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +148 -0
  8. data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +52 -0
  9. data/src/core/ext/filters/backend_metrics/backend_metric_provider.h +29 -0
  10. data/src/core/ext/filters/channel_idle/channel_idle_filter.h +3 -3
  11. data/src/core/ext/filters/channel_idle/idle_filter_state.h +3 -3
  12. data/src/core/ext/filters/client_channel/backend_metric.h +3 -3
  13. data/src/core/ext/filters/client_channel/backup_poller.h +3 -3
  14. data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
  15. data/src/core/ext/filters/client_channel/client_channel.cc +29 -33
  16. data/src/core/ext/filters/client_channel/client_channel.h +3 -3
  17. data/src/core/ext/filters/client_channel/client_channel_channelz.h +3 -3
  18. data/src/core/ext/filters/client_channel/client_channel_factory.h +3 -3
  19. data/src/core/ext/filters/client_channel/client_channel_service_config.h +3 -3
  20. data/src/core/ext/filters/client_channel/config_selector.h +3 -3
  21. data/src/core/ext/filters/client_channel/connector.h +8 -4
  22. data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
  23. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +3 -3
  24. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  25. data/src/core/ext/filters/client_channel/http_proxy.h +3 -3
  26. data/src/core/ext/filters/client_channel/lb_call_state_internal.h +3 -3
  27. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +3 -3
  28. data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -3
  29. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +3 -3
  30. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -7
  31. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +3 -3
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1 -0
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +3 -3
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +3 -3
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -3
  36. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -3
  37. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +1 -78
  38. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h +3 -3
  39. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +117 -0
  40. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +3 -3
  41. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +3 -3
  42. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -0
  43. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +3 -3
  44. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +128 -0
  45. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h +71 -0
  46. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +972 -0
  47. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -6
  48. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +3 -3
  49. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +3 -3
  50. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +12 -7
  51. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +275 -107
  52. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h +10 -3
  53. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +5 -0
  54. data/src/core/ext/filters/client_channel/local_subchannel_pool.h +3 -3
  55. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -3
  56. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +6 -1
  57. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +1 -2
  58. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +3 -3
  59. data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h +3 -3
  60. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +3 -3
  61. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +1 -0
  62. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +3 -3
  63. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +3 -7
  64. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +3 -3
  65. data/src/core/ext/filters/client_channel/retry_filter.cc +10 -13
  66. data/src/core/ext/filters/client_channel/retry_filter.h +3 -3
  67. data/src/core/ext/filters/client_channel/retry_service_config.h +3 -3
  68. data/src/core/ext/filters/client_channel/retry_throttle.h +3 -3
  69. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +4 -4
  70. data/src/core/ext/filters/client_channel/subchannel.cc +5 -1
  71. data/src/core/ext/filters/client_channel/subchannel.h +3 -3
  72. data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -3
  73. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +3 -3
  74. data/src/core/ext/filters/client_channel/subchannel_stream_client.h +3 -3
  75. data/src/core/ext/filters/deadline/deadline_filter.cc +40 -48
  76. data/src/core/ext/filters/deadline/deadline_filter.h +6 -10
  77. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +3 -3
  78. data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h +3 -3
  79. data/src/core/ext/filters/http/client/http_client_filter.cc +26 -21
  80. data/src/core/ext/filters/http/client/http_client_filter.h +3 -3
  81. data/src/core/ext/filters/http/client_authority_filter.h +3 -3
  82. data/src/core/ext/filters/http/message_compress/compression_filter.cc +109 -117
  83. data/src/core/ext/filters/http/message_compress/compression_filter.h +17 -10
  84. data/src/core/ext/filters/http/server/http_server_filter.cc +25 -24
  85. data/src/core/ext/filters/http/server/http_server_filter.h +3 -3
  86. data/src/core/ext/filters/message_size/message_size_filter.cc +2 -1
  87. data/src/core/ext/filters/message_size/message_size_filter.h +3 -3
  88. data/src/core/ext/filters/rbac/rbac_filter.cc +4 -3
  89. data/src/core/ext/filters/rbac/rbac_filter.h +3 -3
  90. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +3 -3
  91. data/src/core/ext/filters/server_config_selector/server_config_selector.h +3 -3
  92. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.h +3 -3
  93. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +27 -37
  94. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +5 -5
  95. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +3 -3
  96. data/src/core/ext/transport/chttp2/alpn/alpn.h +3 -3
  97. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -7
  98. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +3 -3
  99. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -0
  100. data/src/core/ext/transport/chttp2/server/chttp2_server.h +3 -3
  101. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +3 -3
  102. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +3 -3
  103. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +195 -111
  104. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -3
  105. data/src/core/ext/transport/chttp2/transport/context_list.h +3 -3
  106. data/src/core/ext/transport/chttp2/transport/decode_huff.h +3 -3
  107. data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
  108. data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -3
  109. data/src/core/ext/transport/chttp2/transport/frame.h +3 -3
  110. data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -0
  111. data/src/core/ext/transport/chttp2/transport/frame_data.h +3 -3
  112. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -0
  113. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -3
  114. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -0
  115. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
  116. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -0
  117. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +3 -3
  118. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -0
  119. data/src/core/ext/transport/chttp2/transport/frame_settings.h +3 -3
  120. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +2 -0
  121. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +3 -3
  122. data/src/core/ext/transport/chttp2/transport/hpack_constants.h +3 -3
  123. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +3 -3
  124. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +3 -3
  125. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +18 -407
  126. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -3
  127. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -0
  128. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -3
  129. data/src/core/ext/transport/chttp2/transport/http2_settings.h +3 -3
  130. data/src/core/ext/transport/chttp2/transport/http_trace.h +3 -3
  131. data/src/core/ext/transport/chttp2/transport/huffsyms.h +3 -3
  132. data/src/core/ext/transport/chttp2/transport/internal.h +28 -23
  133. data/src/core/ext/transport/chttp2/transport/parsing.cc +111 -31
  134. data/src/core/ext/transport/chttp2/transport/stream_map.h +3 -3
  135. data/src/core/ext/transport/chttp2/transport/varint.h +3 -3
  136. data/src/core/ext/transport/chttp2/transport/writing.cc +9 -8
  137. data/src/core/ext/transport/inproc/inproc_transport.h +3 -3
  138. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +3 -2
  139. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +9 -0
  140. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +38 -2
  141. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +185 -0
  142. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +7 -3
  143. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +44 -0
  144. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +16 -25
  145. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +48 -74
  146. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +30 -7
  147. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +137 -0
  148. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +15 -12
  149. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +83 -51
  150. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +3 -2
  151. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +15 -0
  152. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +17 -2
  153. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +61 -0
  154. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +11 -5
  155. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +37 -6
  156. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +5 -3
  157. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +24 -0
  158. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +5 -3
  159. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +22 -0
  160. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +6 -3
  161. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +24 -0
  162. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +24 -5
  163. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +50 -0
  164. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +57 -16
  165. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +254 -17
  166. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +3 -2
  167. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +9 -0
  168. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -2
  169. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +9 -0
  170. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +7 -6
  171. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +21 -12
  172. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +6 -3
  173. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +23 -0
  174. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +10 -7
  175. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +42 -12
  176. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +54 -0
  177. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +188 -0
  178. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +111 -0
  179. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +444 -0
  180. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +7 -3
  181. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +24 -0
  182. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +8 -6
  183. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +31 -9
  184. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +5 -3
  185. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +24 -0
  186. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +47 -0
  187. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +113 -0
  188. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +43 -0
  189. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +114 -0
  190. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +3 -1
  191. data/src/core/ext/upbdefs-generated/envoy/admin/v3/clusters.upbdefs.c +54 -53
  192. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump_shared.upbdefs.c +34 -13
  193. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump_shared.upbdefs.h +10 -0
  194. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +195 -187
  195. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +232 -224
  196. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +0 -5
  197. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +95 -75
  198. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +5 -0
  199. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +94 -93
  200. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +81 -75
  201. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +189 -187
  202. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +7 -3
  203. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +5 -0
  204. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +71 -66
  205. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +137 -133
  206. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +16 -12
  207. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +140 -133
  208. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +81 -70
  209. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +5 -0
  210. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +771 -741
  211. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +10 -0
  212. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/datadog.upbdefs.c +16 -14
  213. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/opentelemetry.upbdefs.c +14 -13
  214. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/zipkin.upbdefs.c +20 -18
  215. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +53 -42
  216. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +363 -356
  217. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +149 -145
  218. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +16 -13
  219. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/filter_state.upbdefs.c +48 -0
  220. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/filter_state.upbdefs.h +35 -0
  221. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +14 -14
  222. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/status_code_input.upbdefs.c +40 -0
  223. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/status_code_input.upbdefs.h +40 -0
  224. data/src/core/ext/upbdefs-generated/envoy/type/v3/ratelimit_unit.upbdefs.c +10 -9
  225. data/src/core/ext/xds/certificate_provider_store.h +3 -3
  226. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +1 -0
  227. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +3 -3
  228. data/src/core/ext/xds/upb_utils.h +3 -3
  229. data/src/core/ext/xds/xds_api.h +3 -3
  230. data/src/core/ext/xds/xds_bootstrap.h +3 -3
  231. data/src/core/ext/xds/xds_bootstrap_grpc.cc +1 -0
  232. data/src/core/ext/xds/xds_bootstrap_grpc.h +3 -3
  233. data/src/core/ext/xds/xds_certificate_provider.h +3 -3
  234. data/src/core/ext/xds/xds_channel_args.h +3 -3
  235. data/src/core/ext/xds/xds_channel_stack_modifier.h +3 -3
  236. data/src/core/ext/xds/xds_client.cc +8 -3
  237. data/src/core/ext/xds/xds_client.h +3 -3
  238. data/src/core/ext/xds/xds_client_grpc.cc +0 -1
  239. data/src/core/ext/xds/xds_client_grpc.h +3 -3
  240. data/src/core/ext/xds/xds_client_stats.h +4 -3
  241. data/src/core/ext/xds/xds_cluster.cc +11 -7
  242. data/src/core/ext/xds/xds_cluster.h +6 -6
  243. data/src/core/ext/xds/xds_cluster_specifier_plugin.h +3 -3
  244. data/src/core/ext/xds/xds_common_types.cc +1 -0
  245. data/src/core/ext/xds/xds_common_types.h +3 -3
  246. data/src/core/ext/xds/xds_endpoint.cc +1 -1
  247. data/src/core/ext/xds/xds_endpoint.h +3 -3
  248. data/src/core/ext/xds/xds_health_status.h +30 -3
  249. data/src/core/ext/xds/xds_http_fault_filter.h +3 -3
  250. data/src/core/ext/xds/xds_http_filters.cc +1 -1
  251. data/src/core/ext/xds/xds_http_filters.h +3 -3
  252. data/src/core/ext/xds/xds_http_rbac_filter.h +3 -3
  253. data/src/core/ext/xds/xds_http_stateful_session_filter.h +3 -3
  254. data/src/core/ext/xds/xds_lb_policy_registry.cc +95 -0
  255. data/src/core/ext/xds/xds_lb_policy_registry.h +3 -3
  256. data/src/core/ext/xds/xds_listener.cc +1 -0
  257. data/src/core/ext/xds/xds_listener.h +3 -3
  258. data/src/core/ext/xds/xds_resource_type.h +3 -3
  259. data/src/core/ext/xds/xds_resource_type_impl.h +3 -3
  260. data/src/core/ext/xds/xds_route_config.cc +6 -0
  261. data/src/core/ext/xds/xds_route_config.h +3 -3
  262. data/src/core/ext/xds/xds_routing.h +3 -3
  263. data/src/core/ext/xds/xds_transport.h +3 -3
  264. data/src/core/ext/xds/xds_transport_grpc.h +3 -3
  265. data/src/core/lib/address_utils/parse_address.h +3 -3
  266. data/src/core/lib/address_utils/sockaddr_utils.cc +1 -0
  267. data/src/core/lib/address_utils/sockaddr_utils.h +3 -3
  268. data/src/core/lib/avl/avl.h +3 -3
  269. data/src/core/lib/backoff/backoff.h +3 -3
  270. data/src/core/lib/channel/call_finalization.h +3 -3
  271. data/src/core/lib/channel/call_tracer.h +3 -3
  272. data/src/core/lib/channel/channel_args.cc +1 -0
  273. data/src/core/lib/channel/channel_args.h +11 -5
  274. data/src/core/lib/channel/channel_args_preconditioning.h +3 -3
  275. data/src/core/lib/channel/channel_fwd.h +3 -3
  276. data/src/core/lib/channel/channel_stack.cc +1 -2
  277. data/src/core/lib/channel/channel_stack.h +4 -4
  278. data/src/core/lib/channel/channel_stack_builder.h +3 -3
  279. data/src/core/lib/channel/channel_stack_builder_impl.cc +14 -1
  280. data/src/core/lib/channel/channel_stack_builder_impl.h +3 -3
  281. data/src/core/lib/channel/channel_trace.h +3 -3
  282. data/src/core/lib/channel/channelz.h +3 -3
  283. data/src/core/lib/channel/channelz_registry.h +3 -3
  284. data/src/core/lib/channel/connected_channel.cc +883 -354
  285. data/src/core/lib/channel/connected_channel.h +3 -3
  286. data/src/core/lib/channel/context.h +7 -3
  287. data/src/core/lib/channel/promise_based_filter.cc +532 -260
  288. data/src/core/lib/channel/promise_based_filter.h +124 -44
  289. data/src/core/lib/channel/status_util.h +3 -3
  290. data/src/core/lib/compression/compression_internal.h +3 -3
  291. data/src/core/lib/compression/message_compress.h +3 -3
  292. data/src/core/lib/config/core_configuration.h +3 -3
  293. data/src/core/lib/debug/event_log.h +3 -3
  294. data/src/core/lib/debug/histogram_view.h +3 -3
  295. data/src/core/lib/debug/stats.h +3 -3
  296. data/src/core/lib/debug/stats_data.cc +66 -65
  297. data/src/core/lib/debug/stats_data.h +42 -33
  298. data/src/core/lib/debug/trace.h +4 -26
  299. data/src/core/lib/event_engine/channel_args_endpoint_config.cc +5 -0
  300. data/src/core/lib/event_engine/channel_args_endpoint_config.h +3 -3
  301. data/src/core/lib/event_engine/common_closures.h +3 -3
  302. data/src/core/lib/event_engine/default_event_engine.cc +9 -4
  303. data/src/core/lib/event_engine/default_event_engine.h +30 -6
  304. data/src/core/lib/event_engine/default_event_engine_factory.h +3 -3
  305. data/src/core/lib/event_engine/event_engine.cc +25 -0
  306. data/src/core/lib/event_engine/executor/executor.h +3 -3
  307. data/src/core/lib/event_engine/forkable.cc +11 -6
  308. data/src/core/lib/event_engine/forkable.h +3 -3
  309. data/src/core/lib/event_engine/handle_containers.h +10 -3
  310. data/src/core/lib/event_engine/poller.h +3 -3
  311. data/src/core/lib/event_engine/posix.h +158 -0
  312. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +44 -16
  313. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +14 -4
  314. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +6 -7
  315. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +3 -3
  316. data/src/core/lib/event_engine/posix_engine/event_poller.h +3 -3
  317. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +3 -3
  318. data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +3 -3
  319. data/src/core/lib/event_engine/posix_engine/lockfree_event.h +3 -3
  320. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +52 -55
  321. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +46 -13
  322. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +82 -12
  323. data/src/core/lib/event_engine/posix_engine/posix_engine.h +23 -9
  324. data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +3 -3
  325. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +60 -7
  326. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +65 -14
  327. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +0 -1
  328. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +6 -6
  329. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -3
  330. data/src/core/lib/event_engine/posix_engine/timer.h +3 -3
  331. data/src/core/lib/event_engine/posix_engine/timer_heap.h +3 -3
  332. data/src/core/lib/event_engine/posix_engine/timer_manager.h +3 -3
  333. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +3 -3
  334. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +3 -3
  335. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +3 -3
  336. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +3 -3
  337. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +3 -3
  338. data/src/core/lib/event_engine/resolved_address.cc +19 -0
  339. data/src/core/lib/event_engine/resolved_address_internal.h +34 -0
  340. data/src/core/lib/event_engine/shim.cc +56 -0
  341. data/src/core/lib/event_engine/shim.h +33 -0
  342. data/src/core/lib/event_engine/slice.cc +1 -1
  343. data/src/core/lib/event_engine/tcp_socket_utils.cc +18 -2
  344. data/src/core/lib/event_engine/tcp_socket_utils.h +8 -3
  345. data/src/core/lib/event_engine/thread_local.cc +29 -0
  346. data/src/core/lib/event_engine/thread_local.h +32 -0
  347. data/src/core/lib/event_engine/thread_pool.cc +41 -65
  348. data/src/core/lib/event_engine/thread_pool.h +21 -17
  349. data/src/core/lib/event_engine/time_util.h +3 -3
  350. data/src/core/lib/event_engine/trace.cc +6 -0
  351. data/src/core/lib/event_engine/trace.h +16 -3
  352. data/src/core/lib/event_engine/utils.cc +2 -2
  353. data/src/core/lib/event_engine/utils.h +12 -4
  354. data/src/core/lib/event_engine/windows/iocp.cc +24 -40
  355. data/src/core/lib/event_engine/windows/iocp.h +3 -3
  356. data/src/core/lib/event_engine/windows/win_socket.cc +56 -33
  357. data/src/core/lib/event_engine/windows/win_socket.h +34 -25
  358. data/src/core/lib/event_engine/windows/windows_endpoint.cc +331 -0
  359. data/src/core/lib/event_engine/windows/windows_endpoint.h +103 -0
  360. data/src/core/lib/event_engine/windows/windows_engine.cc +243 -20
  361. data/src/core/lib/event_engine/windows/windows_engine.h +62 -23
  362. data/src/core/lib/experiments/config.cc +16 -1
  363. data/src/core/lib/experiments/config.h +13 -3
  364. data/src/core/lib/experiments/experiments.cc +14 -8
  365. data/src/core/lib/experiments/experiments.h +80 -21
  366. data/src/core/lib/gpr/alloc.h +3 -3
  367. data/src/core/lib/gpr/spinlock.h +3 -3
  368. data/src/core/lib/gpr/string.h +3 -3
  369. data/src/core/lib/gpr/sync_abseil.cc +15 -7
  370. data/src/core/lib/gpr/time_precise.h +3 -3
  371. data/src/core/lib/gpr/tmpfile.h +3 -3
  372. data/src/core/lib/gpr/useful.h +3 -3
  373. data/src/core/lib/gprpp/atomic_utils.h +3 -3
  374. data/src/core/lib/gprpp/bitset.h +3 -3
  375. data/src/core/lib/gprpp/chunked_vector.h +3 -3
  376. data/src/core/lib/gprpp/construct_destruct.h +3 -3
  377. data/src/core/lib/gprpp/cpp_impl_of.h +3 -3
  378. data/src/core/lib/gprpp/crash.h +3 -3
  379. data/src/core/lib/gprpp/debug_location.h +3 -6
  380. data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
  381. data/src/core/lib/gprpp/env.h +3 -3
  382. data/src/core/lib/gprpp/examine_stack.h +3 -3
  383. data/src/core/lib/gprpp/fork.cc +21 -4
  384. data/src/core/lib/gprpp/fork.h +7 -5
  385. data/src/core/lib/gprpp/global_config.h +3 -3
  386. data/src/core/lib/gprpp/global_config_custom.h +3 -3
  387. data/src/core/lib/gprpp/global_config_env.cc +1 -0
  388. data/src/core/lib/gprpp/global_config_env.h +3 -3
  389. data/src/core/lib/gprpp/global_config_generic.h +3 -3
  390. data/src/core/lib/gprpp/host_port.cc +2 -0
  391. data/src/core/lib/gprpp/host_port.h +3 -3
  392. data/src/core/lib/gprpp/load_file.h +3 -3
  393. data/src/core/lib/gprpp/manual_constructor.h +3 -3
  394. data/src/core/lib/gprpp/match.h +3 -3
  395. data/src/core/lib/gprpp/memory.h +3 -3
  396. data/src/core/lib/gprpp/mpscq.h +3 -3
  397. data/src/core/lib/gprpp/no_destruct.h +3 -3
  398. data/src/core/lib/gprpp/notification.h +3 -3
  399. data/src/core/lib/gprpp/orphanable.h +3 -3
  400. data/src/core/lib/gprpp/overload.h +3 -3
  401. data/src/core/lib/gprpp/packed_table.h +3 -3
  402. data/src/core/lib/gprpp/per_cpu.h +3 -3
  403. data/src/core/lib/gprpp/ref_counted.h +3 -3
  404. data/src/core/lib/gprpp/ref_counted_ptr.h +3 -3
  405. data/src/core/lib/gprpp/single_set_ptr.h +3 -3
  406. data/src/core/lib/gprpp/sorted_pack.h +3 -3
  407. data/src/core/lib/gprpp/stat.h +3 -3
  408. data/src/core/lib/gprpp/status_helper.h +3 -3
  409. data/src/core/lib/gprpp/strerror.cc +2 -0
  410. data/src/core/lib/gprpp/strerror.h +3 -3
  411. data/src/core/lib/gprpp/sync.h +3 -3
  412. data/src/core/lib/gprpp/table.h +3 -3
  413. data/src/core/lib/gprpp/tchar.h +3 -3
  414. data/src/core/lib/gprpp/thd.h +3 -3
  415. data/src/core/lib/gprpp/time.cc +1 -0
  416. data/src/core/lib/gprpp/time.h +3 -3
  417. data/src/core/lib/gprpp/time_averaged_stats.h +3 -3
  418. data/src/core/lib/gprpp/time_util.h +3 -3
  419. data/src/core/lib/gprpp/unique_type_name.h +3 -3
  420. data/src/core/lib/gprpp/validation_errors.h +3 -3
  421. data/src/core/lib/gprpp/work_serializer.h +3 -3
  422. data/src/core/lib/handshaker/proxy_mapper.h +3 -3
  423. data/src/core/lib/handshaker/proxy_mapper_registry.h +3 -3
  424. data/src/core/lib/http/format_request.cc +1 -0
  425. data/src/core/lib/http/format_request.h +3 -3
  426. data/src/core/lib/http/httpcli.cc +1 -0
  427. data/src/core/lib/http/httpcli.h +3 -3
  428. data/src/core/lib/http/httpcli_ssl_credentials.h +3 -3
  429. data/src/core/lib/http/parser.h +3 -3
  430. data/src/core/lib/iomgr/block_annotate.h +3 -3
  431. data/src/core/lib/iomgr/buffer_list.h +3 -3
  432. data/src/core/lib/iomgr/call_combiner.cc +4 -4
  433. data/src/core/lib/iomgr/call_combiner.h +3 -3
  434. data/src/core/lib/iomgr/cfstream_handle.h +3 -3
  435. data/src/core/lib/iomgr/closure.cc +27 -0
  436. data/src/core/lib/iomgr/closure.h +5 -3
  437. data/src/core/lib/iomgr/combiner.h +3 -3
  438. data/src/core/lib/iomgr/dynamic_annotations.h +3 -3
  439. data/src/core/lib/iomgr/endpoint.h +3 -3
  440. data/src/core/lib/iomgr/endpoint_cfstream.h +3 -3
  441. data/src/core/lib/iomgr/endpoint_pair.h +3 -3
  442. data/src/core/lib/iomgr/endpoint_pair_windows.cc +10 -2
  443. data/src/core/lib/iomgr/error.h +3 -3
  444. data/src/core/lib/iomgr/error_cfstream.h +3 -3
  445. data/src/core/lib/iomgr/ev_apple.h +3 -3
  446. data/src/core/lib/iomgr/ev_epoll1_linux.h +3 -3
  447. data/src/core/lib/iomgr/ev_poll_posix.h +3 -3
  448. data/src/core/lib/iomgr/ev_posix.h +3 -3
  449. data/src/core/lib/iomgr/event_engine_shims/closure.cc +62 -0
  450. data/src/core/lib/iomgr/event_engine_shims/closure.h +39 -0
  451. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +430 -0
  452. data/src/core/lib/iomgr/event_engine_shims/endpoint.h +43 -0
  453. data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +91 -0
  454. data/src/core/lib/iomgr/event_engine_shims/tcp_client.h +44 -0
  455. data/src/core/lib/iomgr/exec_ctx.h +3 -3
  456. data/src/core/lib/iomgr/executor.h +3 -3
  457. data/src/core/lib/iomgr/fork_posix.cc +5 -4
  458. data/src/core/lib/iomgr/gethostname.h +3 -3
  459. data/src/core/lib/iomgr/grpc_if_nametoindex.h +3 -3
  460. data/src/core/lib/iomgr/internal_errqueue.h +3 -3
  461. data/src/core/lib/iomgr/iocp_windows.h +3 -3
  462. data/src/core/lib/iomgr/iomgr.h +3 -3
  463. data/src/core/lib/iomgr/iomgr_fwd.h +3 -3
  464. data/src/core/lib/iomgr/iomgr_internal.h +3 -3
  465. data/src/core/lib/iomgr/load_file.h +3 -3
  466. data/src/core/lib/iomgr/lockfree_event.h +3 -3
  467. data/src/core/lib/iomgr/nameser.h +3 -3
  468. data/src/core/lib/iomgr/polling_entity.h +3 -3
  469. data/src/core/lib/iomgr/pollset.h +3 -3
  470. data/src/core/lib/iomgr/pollset_set.h +3 -3
  471. data/src/core/lib/iomgr/pollset_set_windows.h +3 -3
  472. data/src/core/lib/iomgr/pollset_windows.cc +2 -2
  473. data/src/core/lib/iomgr/pollset_windows.h +3 -3
  474. data/src/core/lib/iomgr/port.h +3 -3
  475. data/src/core/lib/iomgr/python_util.h +3 -3
  476. data/src/core/lib/iomgr/resolve_address.h +3 -3
  477. data/src/core/lib/iomgr/resolve_address_impl.h +3 -3
  478. data/src/core/lib/iomgr/resolve_address_posix.h +3 -3
  479. data/src/core/lib/iomgr/resolve_address_windows.h +3 -3
  480. data/src/core/lib/iomgr/resolved_address.h +3 -3
  481. data/src/core/lib/iomgr/sockaddr.h +3 -3
  482. data/src/core/lib/iomgr/sockaddr_posix.h +3 -3
  483. data/src/core/lib/iomgr/sockaddr_windows.h +3 -3
  484. data/src/core/lib/iomgr/socket_factory_posix.h +3 -3
  485. data/src/core/lib/iomgr/socket_mutator.h +3 -3
  486. data/src/core/lib/iomgr/socket_utils.h +3 -3
  487. data/src/core/lib/iomgr/socket_utils_posix.h +3 -3
  488. data/src/core/lib/iomgr/socket_windows.h +3 -3
  489. data/src/core/lib/iomgr/systemd_utils.cc +19 -19
  490. data/src/core/lib/iomgr/systemd_utils.h +24 -24
  491. data/src/core/lib/iomgr/tcp_client.h +3 -3
  492. data/src/core/lib/iomgr/tcp_client_posix.cc +12 -0
  493. data/src/core/lib/iomgr/tcp_client_posix.h +3 -3
  494. data/src/core/lib/iomgr/tcp_client_windows.cc +13 -1
  495. data/src/core/lib/iomgr/tcp_posix.cc +49 -65
  496. data/src/core/lib/iomgr/tcp_posix.h +3 -3
  497. data/src/core/lib/iomgr/tcp_server.h +3 -3
  498. data/src/core/lib/iomgr/tcp_server_posix.cc +219 -4
  499. data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -3
  500. data/src/core/lib/iomgr/tcp_server_windows.cc +4 -6
  501. data/src/core/lib/iomgr/tcp_windows.h +3 -3
  502. data/src/core/lib/iomgr/timer.h +3 -3
  503. data/src/core/lib/iomgr/timer_generic.h +3 -3
  504. data/src/core/lib/iomgr/timer_heap.h +3 -3
  505. data/src/core/lib/iomgr/timer_manager.h +3 -3
  506. data/src/core/lib/iomgr/unix_sockets_posix.h +3 -3
  507. data/src/core/lib/iomgr/wakeup_fd_pipe.h +3 -3
  508. data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -3
  509. data/src/core/lib/json/json.h +3 -3
  510. data/src/core/lib/json/json_args.h +3 -3
  511. data/src/core/lib/json/json_channel_args.h +3 -3
  512. data/src/core/lib/json/json_object_loader.h +3 -3
  513. data/src/core/lib/json/json_reader.cc +1 -0
  514. data/src/core/lib/json/json_util.h +3 -3
  515. data/src/core/lib/load_balancing/lb_policy.cc +9 -0
  516. data/src/core/lib/load_balancing/lb_policy.h +9 -5
  517. data/src/core/lib/load_balancing/lb_policy_factory.h +3 -3
  518. data/src/core/lib/load_balancing/lb_policy_registry.cc +1 -0
  519. data/src/core/lib/load_balancing/lb_policy_registry.h +3 -3
  520. data/src/core/lib/load_balancing/subchannel_interface.h +8 -6
  521. data/src/core/lib/matchers/matchers.cc +1 -0
  522. data/src/core/lib/matchers/matchers.h +3 -3
  523. data/src/core/lib/promise/activity.cc +8 -6
  524. data/src/core/lib/promise/activity.h +52 -66
  525. data/src/core/lib/promise/arena_promise.h +3 -3
  526. data/src/core/lib/promise/context.h +3 -3
  527. data/src/core/lib/promise/detail/basic_join.h +197 -0
  528. data/src/core/lib/promise/detail/basic_seq.h +10 -16
  529. data/src/core/lib/promise/detail/promise_factory.h +3 -3
  530. data/src/core/lib/promise/detail/promise_like.h +3 -3
  531. data/src/core/lib/promise/detail/status.h +3 -3
  532. data/src/core/lib/promise/detail/switch.h +3 -3
  533. data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +3 -3
  534. data/src/core/lib/promise/if.h +195 -0
  535. data/src/core/lib/promise/interceptor_list.h +308 -0
  536. data/src/core/lib/promise/intra_activity_waiter.h +9 -3
  537. data/src/core/lib/promise/latch.h +99 -5
  538. data/src/core/lib/promise/loop.h +4 -4
  539. data/src/core/lib/promise/map.h +4 -6
  540. data/src/core/lib/promise/pipe.h +296 -193
  541. data/src/core/lib/promise/poll.h +113 -14
  542. data/src/core/lib/promise/promise.h +4 -5
  543. data/src/core/lib/promise/race.h +6 -9
  544. data/src/core/lib/promise/seq.h +3 -3
  545. data/src/core/lib/promise/sleep.h +3 -3
  546. data/src/core/lib/promise/{pipe.cc → trace.cc} +3 -2
  547. data/src/core/lib/promise/trace.h +24 -0
  548. data/src/core/lib/promise/try_join.h +82 -0
  549. data/src/core/lib/promise/try_seq.h +3 -3
  550. data/src/core/lib/resolver/resolver.h +3 -3
  551. data/src/core/lib/resolver/resolver_factory.h +4 -4
  552. data/src/core/lib/resolver/resolver_registry.cc +15 -0
  553. data/src/core/lib/resolver/resolver_registry.h +3 -3
  554. data/src/core/lib/resolver/server_address.cc +1 -0
  555. data/src/core/lib/resolver/server_address.h +3 -3
  556. data/src/core/lib/resource_quota/api.h +3 -3
  557. data/src/core/lib/resource_quota/arena.cc +36 -9
  558. data/src/core/lib/resource_quota/arena.h +84 -22
  559. data/src/core/lib/resource_quota/memory_quota.h +3 -3
  560. data/src/core/lib/resource_quota/periodic_update.h +3 -3
  561. data/src/core/lib/resource_quota/resource_quota.h +3 -3
  562. data/src/core/lib/resource_quota/thread_quota.h +3 -3
  563. data/src/core/lib/resource_quota/trace.h +3 -3
  564. data/src/core/lib/security/authorization/authorization_engine.h +3 -3
  565. data/src/core/lib/security/authorization/authorization_policy_provider.h +3 -3
  566. data/src/core/lib/security/authorization/evaluate_args.h +3 -3
  567. data/src/core/lib/security/authorization/grpc_authorization_engine.h +3 -3
  568. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +3 -3
  569. data/src/core/lib/security/authorization/matchers.h +3 -3
  570. data/src/core/lib/security/authorization/rbac_policy.cc +1 -0
  571. data/src/core/lib/security/authorization/rbac_policy.h +3 -3
  572. data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +3 -3
  573. data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +3 -3
  574. data/src/core/lib/security/context/security_context.h +3 -3
  575. data/src/core/lib/security/credentials/alts/alts_credentials.h +3 -3
  576. data/src/core/lib/security/credentials/alts/check_gcp_environment.h +3 -3
  577. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +3 -3
  578. data/src/core/lib/security/credentials/call_creds_util.h +3 -3
  579. data/src/core/lib/security/credentials/channel_creds_registry.h +3 -3
  580. data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -3
  581. data/src/core/lib/security/credentials/credentials.h +3 -3
  582. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +1 -0
  583. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +3 -3
  584. data/src/core/lib/security/credentials/external/aws_request_signer.cc +1 -0
  585. data/src/core/lib/security/credentials/external/aws_request_signer.h +3 -3
  586. data/src/core/lib/security/credentials/external/external_account_credentials.cc +1 -0
  587. data/src/core/lib/security/credentials/external/external_account_credentials.h +3 -3
  588. data/src/core/lib/security/credentials/external/file_external_account_credentials.h +3 -3
  589. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
  590. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +3 -3
  591. data/src/core/lib/security/credentials/fake/fake_credentials.h +3 -3
  592. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +3 -3
  593. data/src/core/lib/security/credentials/iam/iam_credentials.cc +1 -0
  594. data/src/core/lib/security/credentials/iam/iam_credentials.h +3 -3
  595. data/src/core/lib/security/credentials/insecure/insecure_credentials.h +3 -3
  596. data/src/core/lib/security/credentials/jwt/json_token.h +3 -3
  597. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +4 -3
  598. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +3 -3
  599. data/src/core/lib/security/credentials/local/local_credentials.h +3 -3
  600. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +4 -3
  601. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +3 -3
  602. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +3 -3
  603. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +3 -3
  604. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +1 -1
  605. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +3 -3
  606. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +3 -3
  607. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -3
  608. data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -3
  609. data/src/core/lib/security/credentials/tls/tls_utils.h +3 -3
  610. data/src/core/lib/security/credentials/xds/xds_credentials.h +3 -3
  611. data/src/core/lib/security/security_connector/alts/alts_security_connector.h +3 -3
  612. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -0
  613. data/src/core/lib/security/security_connector/fake/fake_security_connector.h +3 -3
  614. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +3 -3
  615. data/src/core/lib/security/security_connector/load_system_roots.h +3 -3
  616. data/src/core/lib/security/security_connector/load_system_roots_supported.h +3 -3
  617. data/src/core/lib/security/security_connector/local/local_security_connector.h +3 -3
  618. data/src/core/lib/security/security_connector/security_connector.h +3 -3
  619. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +1 -0
  620. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +3 -3
  621. data/src/core/lib/security/security_connector/ssl_utils.h +3 -3
  622. data/src/core/lib/security/security_connector/ssl_utils_config.h +3 -3
  623. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +3 -3
  624. data/src/core/lib/security/transport/auth_filters.h +27 -5
  625. data/src/core/lib/security/transport/secure_endpoint.h +3 -3
  626. data/src/core/lib/security/transport/security_handshaker.cc +9 -0
  627. data/src/core/lib/security/transport/security_handshaker.h +3 -3
  628. data/src/core/lib/security/transport/server_auth_filter.cc +120 -251
  629. data/src/core/lib/security/transport/tsi_error.h +3 -3
  630. data/src/core/lib/security/util/json_util.h +3 -3
  631. data/src/core/lib/service_config/service_config.h +3 -3
  632. data/src/core/lib/service_config/service_config_call_data.h +3 -3
  633. data/src/core/lib/service_config/service_config_impl.h +3 -3
  634. data/src/core/lib/service_config/service_config_parser.h +3 -3
  635. data/src/core/lib/slice/b64.h +3 -3
  636. data/src/core/lib/slice/percent_encoding.h +3 -3
  637. data/src/core/lib/slice/slice.cc +3 -3
  638. data/src/core/lib/slice/slice.h +14 -21
  639. data/src/core/lib/slice/slice_buffer.h +10 -4
  640. data/src/core/lib/slice/slice_internal.h +3 -3
  641. data/src/core/lib/slice/slice_refcount.cc +20 -0
  642. data/src/core/lib/slice/slice_refcount.h +26 -6
  643. data/src/core/lib/slice/slice_string_helpers.h +3 -3
  644. data/src/core/lib/surface/api_trace.h +3 -3
  645. data/src/core/lib/surface/builtins.h +3 -3
  646. data/src/core/lib/surface/call.cc +866 -252
  647. data/src/core/lib/surface/call.h +31 -3
  648. data/src/core/lib/surface/call_log_batch.cc +1 -0
  649. data/src/core/lib/surface/call_test_only.h +3 -3
  650. data/src/core/lib/surface/call_trace.cc +21 -11
  651. data/src/core/lib/surface/call_trace.h +3 -3
  652. data/src/core/lib/surface/channel.h +3 -3
  653. data/src/core/lib/surface/channel_init.h +3 -3
  654. data/src/core/lib/surface/channel_stack_type.h +3 -3
  655. data/src/core/lib/surface/completion_queue.cc +1 -0
  656. data/src/core/lib/surface/completion_queue.h +3 -3
  657. data/src/core/lib/surface/completion_queue_factory.h +3 -3
  658. data/src/core/lib/surface/event_string.cc +1 -0
  659. data/src/core/lib/surface/event_string.h +3 -3
  660. data/src/core/lib/surface/init.cc +1 -1
  661. data/src/core/lib/surface/init.h +3 -3
  662. data/src/core/lib/surface/init_internally.h +3 -3
  663. data/src/core/lib/surface/lame_client.cc +3 -1
  664. data/src/core/lib/surface/lame_client.h +3 -3
  665. data/src/core/lib/surface/server.cc +273 -27
  666. data/src/core/lib/surface/server.h +6 -3
  667. data/src/core/lib/surface/validate_metadata.h +3 -3
  668. data/src/core/lib/surface/version.cc +2 -2
  669. data/src/core/lib/transport/bdp_estimator.h +3 -3
  670. data/src/core/lib/transport/connectivity_state.h +3 -3
  671. data/src/core/lib/transport/error_utils.h +3 -3
  672. data/src/core/lib/transport/handshaker.cc +11 -0
  673. data/src/core/lib/transport/handshaker.h +4 -4
  674. data/src/core/lib/transport/handshaker_factory.h +3 -3
  675. data/src/core/lib/transport/handshaker_registry.h +3 -3
  676. data/src/core/lib/transport/http2_errors.h +3 -3
  677. data/src/core/lib/transport/http_connect_handshaker.h +3 -3
  678. data/src/core/lib/transport/metadata_batch.cc +11 -0
  679. data/src/core/lib/transport/metadata_batch.h +24 -3
  680. data/src/core/lib/transport/parsed_metadata.h +3 -3
  681. data/src/core/lib/transport/pid_controller.h +3 -3
  682. data/src/core/lib/transport/status_conversion.h +3 -3
  683. data/src/core/lib/transport/tcp_connect_handshaker.cc +0 -1
  684. data/src/core/lib/transport/tcp_connect_handshaker.h +3 -3
  685. data/src/core/lib/transport/timeout_encoding.h +3 -3
  686. data/src/core/lib/transport/transport.cc +3 -8
  687. data/src/core/lib/transport/transport.h +16 -8
  688. data/src/core/lib/transport/transport_fwd.h +3 -3
  689. data/src/core/lib/transport/transport_impl.h +3 -3
  690. data/src/core/lib/transport/transport_op_string.cc +1 -0
  691. data/src/core/lib/uri/uri_parser.cc +1 -1
  692. data/src/core/lib/uri/uri_parser.h +3 -3
  693. data/src/core/plugin_registry/grpc_plugin_registry.cc +5 -0
  694. data/src/core/tsi/alts/crypt/gsec.h +3 -3
  695. data/src/core/tsi/alts/frame_protector/alts_counter.h +3 -3
  696. data/src/core/tsi/alts/frame_protector/alts_crypter.h +3 -3
  697. data/src/core/tsi/alts/frame_protector/alts_frame_protector.h +3 -3
  698. data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h +3 -3
  699. data/src/core/tsi/alts/frame_protector/frame_handler.h +3 -3
  700. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +3 -3
  701. data/src/core/tsi/alts/handshaker/alts_shared_resource.h +3 -3
  702. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -3
  703. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +3 -3
  704. data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +3 -3
  705. data/src/core/tsi/alts/handshaker/transport_security_common_api.h +3 -3
  706. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -3
  707. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h +3 -3
  708. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h +3 -3
  709. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +3 -3
  710. data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h +3 -3
  711. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +3 -3
  712. data/src/core/tsi/fake_transport_security.h +3 -3
  713. data/src/core/tsi/local_transport_security.h +3 -3
  714. data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +1 -1
  715. data/src/core/tsi/ssl/key_logging/ssl_key_logging.h +3 -3
  716. data/src/core/tsi/ssl/session_cache/ssl_session.h +3 -3
  717. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -3
  718. data/src/core/tsi/ssl_transport_security.cc +113 -24
  719. data/src/core/tsi/ssl_transport_security.h +5 -3
  720. data/src/core/tsi/ssl_transport_security_utils.h +3 -3
  721. data/src/core/tsi/ssl_types.h +3 -3
  722. data/src/core/tsi/transport_security.h +3 -3
  723. data/src/core/tsi/transport_security_grpc.h +3 -3
  724. data/src/core/tsi/transport_security_interface.h +3 -3
  725. data/src/ruby/lib/grpc/version.rb +1 -1
  726. data/src/ruby/pb/generate_proto_ruby.sh +0 -6
  727. data/third_party/abseil-cpp/absl/algorithm/container.h +56 -57
  728. data/third_party/abseil-cpp/absl/base/attributes.h +39 -19
  729. data/third_party/abseil-cpp/absl/base/config.h +44 -3
  730. data/third_party/abseil-cpp/absl/base/internal/cycleclock.h +3 -18
  731. data/third_party/abseil-cpp/absl/base/internal/cycleclock_config.h +55 -0
  732. data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +2 -1
  733. data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +3 -3
  734. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +2 -2
  735. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +1 -1
  736. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +10 -6
  737. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +23 -24
  738. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +3 -3
  739. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +2 -6
  740. data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +4 -1
  741. data/third_party/abseil-cpp/absl/base/internal/strerror.cc +4 -4
  742. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +14 -10
  743. data/third_party/abseil-cpp/absl/base/internal/thread_annotations.h +9 -0
  744. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +4 -0
  745. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +3 -40
  746. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +62 -0
  747. data/third_party/abseil-cpp/absl/base/macros.h +4 -21
  748. data/third_party/abseil-cpp/absl/base/optimization.h +58 -6
  749. data/third_party/abseil-cpp/absl/base/options.h +1 -7
  750. data/third_party/abseil-cpp/absl/base/policy_checks.h +15 -13
  751. data/third_party/abseil-cpp/absl/container/fixed_array.h +7 -5
  752. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -7
  753. data/third_party/abseil-cpp/absl/container/inlined_vector.h +66 -18
  754. data/third_party/abseil-cpp/absl/container/internal/common.h +3 -3
  755. data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +132 -0
  756. data/third_party/abseil-cpp/absl/container/internal/container_memory.h +13 -1
  757. data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +4 -55
  758. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +50 -5
  759. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +14 -46
  760. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +110 -32
  761. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +155 -4
  762. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +661 -341
  763. data/third_party/abseil-cpp/absl/crc/crc32c.cc +99 -0
  764. data/third_party/abseil-cpp/absl/crc/crc32c.h +183 -0
  765. data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +256 -0
  766. data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.h +57 -0
  767. data/third_party/abseil-cpp/absl/crc/internal/crc.cc +468 -0
  768. data/third_party/abseil-cpp/absl/crc/internal/crc.h +91 -0
  769. data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +269 -0
  770. data/third_party/abseil-cpp/absl/crc/internal/crc32c.h +39 -0
  771. data/third_party/abseil-cpp/absl/crc/internal/crc32c_inline.h +72 -0
  772. data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.cc +130 -0
  773. data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.h +159 -0
  774. data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +179 -0
  775. data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy.h +119 -0
  776. data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_fallback.cc +75 -0
  777. data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_64.cc +434 -0
  778. data/third_party/abseil-cpp/absl/crc/internal/crc_non_temporal_memcpy.cc +93 -0
  779. data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +725 -0
  780. data/third_party/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +79 -0
  781. data/third_party/abseil-cpp/absl/crc/internal/non_temporal_memcpy.h +180 -0
  782. data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +1 -1
  783. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +67 -38
  784. data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +1 -1
  785. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +12 -13
  786. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +11 -9
  787. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +1 -1
  788. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +40 -85
  789. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +5 -4
  790. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +33 -8
  791. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +3 -2
  792. data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +3 -2
  793. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +118 -94
  794. data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +7 -6
  795. data/third_party/abseil-cpp/absl/functional/any_invocable.h +5 -2
  796. data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +47 -26
  797. data/third_party/abseil-cpp/absl/hash/internal/city.cc +10 -10
  798. data/third_party/abseil-cpp/absl/hash/internal/hash.h +18 -4
  799. data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +3 -14
  800. data/third_party/abseil-cpp/absl/memory/memory.h +26 -447
  801. data/third_party/abseil-cpp/absl/meta/type_traits.h +104 -12
  802. data/third_party/abseil-cpp/absl/numeric/bits.h +2 -3
  803. data/third_party/abseil-cpp/absl/numeric/int128.cc +10 -8
  804. data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +14 -6
  805. data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +2 -1
  806. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +1 -1
  807. data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +2 -23
  808. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +9 -9
  809. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +2 -2
  810. data/third_party/abseil-cpp/absl/random/random.h +6 -6
  811. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +1 -0
  812. data/third_party/abseil-cpp/absl/status/status.cc +19 -12
  813. data/third_party/abseil-cpp/absl/status/status.h +2 -2
  814. data/third_party/abseil-cpp/absl/strings/ascii.cc +5 -5
  815. data/third_party/abseil-cpp/absl/strings/charconv.cc +534 -96
  816. data/third_party/abseil-cpp/absl/strings/cord.cc +92 -40
  817. data/third_party/abseil-cpp/absl/strings/cord.h +71 -80
  818. data/third_party/abseil-cpp/absl/strings/cord_buffer.h +8 -5
  819. data/third_party/abseil-cpp/absl/strings/escaping.cc +73 -62
  820. data/third_party/abseil-cpp/absl/strings/escaping.h +24 -19
  821. data/third_party/abseil-cpp/absl/strings/internal/char_map.h +14 -12
  822. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +4 -4
  823. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +2 -2
  824. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +326 -70
  825. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +8 -4
  826. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +26 -14
  827. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +5 -5
  828. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc +9 -7
  829. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.h +5 -4
  830. data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.h +7 -15
  831. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +3 -3
  832. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +8 -5
  833. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +7 -7
  834. data/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +4 -4
  835. data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc +93 -0
  836. data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.h +34 -0
  837. data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +12 -10
  838. data/third_party/abseil-cpp/absl/strings/internal/escaping.h +7 -9
  839. data/third_party/abseil-cpp/absl/strings/internal/has_absl_stringify.h +55 -0
  840. data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +9 -6
  841. data/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +14 -7
  842. data/third_party/abseil-cpp/absl/strings/internal/ostringstream.h +35 -10
  843. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +113 -46
  844. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +126 -29
  845. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +3 -2
  846. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +4 -3
  847. data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +49 -287
  848. data/third_party/abseil-cpp/absl/strings/internal/str_format/constexpr_parser.h +351 -0
  849. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +2 -1
  850. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +4 -2
  851. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +215 -181
  852. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +10 -209
  853. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +10 -101
  854. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +2 -1
  855. data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.cc +28 -0
  856. data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.h +57 -0
  857. data/third_party/abseil-cpp/absl/strings/numbers.cc +34 -31
  858. data/third_party/abseil-cpp/absl/strings/str_cat.cc +9 -6
  859. data/third_party/abseil-cpp/absl/strings/str_cat.h +50 -3
  860. data/third_party/abseil-cpp/absl/strings/str_format.h +71 -9
  861. data/third_party/abseil-cpp/absl/strings/string_view.cc +6 -6
  862. data/third_party/abseil-cpp/absl/strings/string_view.h +3 -10
  863. data/third_party/abseil-cpp/absl/strings/substitute.cc +8 -6
  864. data/third_party/abseil-cpp/absl/strings/substitute.h +46 -20
  865. data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +20 -17
  866. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +37 -31
  867. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +22 -8
  868. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +104 -55
  869. data/third_party/abseil-cpp/absl/synchronization/mutex.h +85 -46
  870. data/third_party/abseil-cpp/absl/synchronization/notification.cc +0 -1
  871. data/third_party/abseil-cpp/absl/synchronization/notification.h +0 -1
  872. data/third_party/abseil-cpp/absl/time/civil_time.cc +26 -0
  873. data/third_party/abseil-cpp/absl/time/civil_time.h +25 -0
  874. data/third_party/abseil-cpp/absl/time/clock.cc +17 -11
  875. data/third_party/abseil-cpp/absl/time/duration.cc +7 -7
  876. data/third_party/abseil-cpp/absl/time/format.cc +2 -1
  877. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +1 -1
  878. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +26 -5
  879. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +7 -6
  880. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +36 -35
  881. data/third_party/abseil-cpp/absl/time/time.cc +2 -2
  882. data/third_party/abseil-cpp/absl/time/time.h +253 -158
  883. data/third_party/abseil-cpp/absl/types/internal/span.h +30 -19
  884. data/third_party/abseil-cpp/absl/types/internal/variant.h +28 -40
  885. data/third_party/abseil-cpp/absl/types/span.h +29 -7
  886. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +1 -1
  887. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +1 -2
  888. metadata +75 -10
  889. data/src/core/lib/event_engine/socket_notifier.h +0 -55
  890. data/src/core/lib/promise/for_each.h +0 -155
  891. data/src/core/lib/promise/map_pipe.h +0 -88
  892. data/src/core/lib/promise/try_concurrently.h +0 -342
@@ -17,16 +17,18 @@
17
17
  #include "src/core/lib/channel/promise_based_filter.h"
18
18
 
19
19
  #include <algorithm>
20
+ #include <initializer_list>
20
21
  #include <memory>
21
22
  #include <string>
23
+ #include <utility>
22
24
  #include <vector>
23
25
 
24
26
  #include "absl/base/attributes.h"
25
27
  #include "absl/functional/function_ref.h"
28
+ #include "absl/status/status.h"
26
29
  #include "absl/strings/str_cat.h"
27
30
  #include "absl/strings/str_format.h"
28
31
  #include "absl/strings/str_join.h"
29
- #include "absl/types/variant.h"
30
32
 
31
33
  #include <grpc/status.h>
32
34
 
@@ -36,6 +38,7 @@
36
38
  #include "src/core/lib/gprpp/manual_constructor.h"
37
39
  #include "src/core/lib/gprpp/status_helper.h"
38
40
  #include "src/core/lib/iomgr/error.h"
41
+ #include "src/core/lib/promise/detail/basic_seq.h"
39
42
  #include "src/core/lib/slice/slice.h"
40
43
 
41
44
  extern grpc_core::TraceFlag grpc_trace_channel;
@@ -46,14 +49,21 @@ namespace promise_filter_detail {
46
49
  namespace {
47
50
  class FakeActivity final : public Activity {
48
51
  public:
52
+ explicit FakeActivity(Activity* wake_activity)
53
+ : wake_activity_(wake_activity) {}
49
54
  void Orphan() override {}
50
55
  void ForceImmediateRepoll() override {}
51
- Waker MakeOwningWaker() override { abort(); }
52
- Waker MakeNonOwningWaker() override { abort(); }
56
+ Waker MakeOwningWaker() override { return wake_activity_->MakeOwningWaker(); }
57
+ Waker MakeNonOwningWaker() override {
58
+ return wake_activity_->MakeNonOwningWaker();
59
+ }
53
60
  void Run(absl::FunctionRef<void()> f) {
54
61
  ScopedActivity activity(this);
55
62
  f();
56
63
  }
64
+
65
+ private:
66
+ Activity* const wake_activity_;
57
67
  };
58
68
 
59
69
  absl::Status StatusFromMetadata(const ServerMetadata& md) {
@@ -72,39 +82,43 @@ absl::Status StatusFromMetadata(const ServerMetadata& md) {
72
82
  ///////////////////////////////////////////////////////////////////////////////
73
83
  // BaseCallData
74
84
 
75
- BaseCallData::BaseCallData(grpc_call_element* elem,
76
- const grpc_call_element_args* args, uint8_t flags)
85
+ BaseCallData::BaseCallData(
86
+ grpc_call_element* elem, const grpc_call_element_args* args, uint8_t flags,
87
+ absl::FunctionRef<Interceptor*()> make_send_interceptor,
88
+ absl::FunctionRef<Interceptor*()> make_recv_interceptor)
77
89
  : call_stack_(args->call_stack),
78
90
  elem_(elem),
79
91
  arena_(args->arena),
80
92
  call_combiner_(args->call_combiner),
81
93
  deadline_(args->deadline),
82
94
  context_(args->context),
83
- server_initial_metadata_latch_(
95
+ server_initial_metadata_pipe_(
84
96
  flags & kFilterExaminesServerInitialMetadata
85
- ? arena_->New<Latch<ServerMetadata*>>()
97
+ ? arena_->New<Pipe<ServerMetadataHandle>>(arena_)
98
+ : nullptr),
99
+ send_message_(
100
+ flags & kFilterExaminesOutboundMessages
101
+ ? arena_->New<SendMessage>(this, make_send_interceptor())
102
+ : nullptr),
103
+ receive_message_(
104
+ flags & kFilterExaminesInboundMessages
105
+ ? arena_->New<ReceiveMessage>(this, make_recv_interceptor())
86
106
  : nullptr),
87
- send_message_(flags & kFilterExaminesOutboundMessages
88
- ? arena_->New<SendMessage>(this)
89
- : nullptr),
90
- receive_message_(flags & kFilterExaminesInboundMessages
91
- ? arena_->New<ReceiveMessage>(this)
92
- : nullptr),
93
107
  event_engine_(
94
108
  static_cast<ChannelFilter*>(elem->channel_data)
95
109
  ->hack_until_per_channel_stack_event_engines_land_get_event_engine()) {
96
110
  }
97
111
 
98
112
  BaseCallData::~BaseCallData() {
99
- FakeActivity().Run([this] {
113
+ FakeActivity(this).Run([this] {
100
114
  if (send_message_ != nullptr) {
101
115
  send_message_->~SendMessage();
102
116
  }
103
117
  if (receive_message_ != nullptr) {
104
118
  receive_message_->~ReceiveMessage();
105
119
  }
106
- if (server_initial_metadata_latch_ != nullptr) {
107
- server_initial_metadata_latch_->~Latch();
120
+ if (server_initial_metadata_pipe_ != nullptr) {
121
+ server_initial_metadata_pipe_->~Pipe();
108
122
  }
109
123
  });
110
124
  }
@@ -119,20 +133,20 @@ Waker BaseCallData::MakeNonOwningWaker() { return MakeOwningWaker(); }
119
133
 
120
134
  Waker BaseCallData::MakeOwningWaker() {
121
135
  GRPC_CALL_STACK_REF(call_stack_, "waker");
122
- return Waker(this);
136
+ return Waker(this, nullptr);
123
137
  }
124
138
 
125
- void BaseCallData::Wakeup() {
139
+ void BaseCallData::Wakeup(void*) {
126
140
  auto wakeup = [](void* p, grpc_error_handle) {
127
141
  auto* self = static_cast<BaseCallData*>(p);
128
142
  self->OnWakeup();
129
- self->Drop();
143
+ self->Drop(nullptr);
130
144
  };
131
145
  auto* closure = GRPC_CLOSURE_CREATE(wakeup, this, nullptr);
132
146
  GRPC_CALL_COMBINER_START(call_combiner_, closure, absl::OkStatus(), "wakeup");
133
147
  }
134
148
 
135
- void BaseCallData::Drop() { GRPC_CALL_STACK_UNREF(call_stack_, "waker"); }
149
+ void BaseCallData::Drop(void*) { GRPC_CALL_STACK_UNREF(call_stack_, "waker"); }
136
150
 
137
151
  std::string BaseCallData::LogTag() const {
138
152
  return absl::StrCat(
@@ -196,7 +210,14 @@ void BaseCallData::CapturedBatch::ResumeWith(Flusher* releaser) {
196
210
  auto* batch = std::exchange(batch_, nullptr);
197
211
  GPR_ASSERT(batch != nullptr);
198
212
  uintptr_t& refcnt = *RefCountField(batch);
199
- if (refcnt == 0) return; // refcnt==0 ==> cancelled
213
+ if (refcnt == 0) {
214
+ // refcnt==0 ==> cancelled
215
+ if (grpc_trace_channel.enabled()) {
216
+ gpr_log(GPR_INFO, "%sRESUME BATCH REQUEST CANCELLED",
217
+ Activity::current()->DebugTag().c_str());
218
+ }
219
+ return;
220
+ }
200
221
  if (--refcnt == 0) {
201
222
  releaser->Resume(batch);
202
223
  }
@@ -219,6 +240,10 @@ void BaseCallData::CapturedBatch::CancelWith(grpc_error_handle error,
219
240
  uintptr_t& refcnt = *RefCountField(batch);
220
241
  if (refcnt == 0) {
221
242
  // refcnt==0 ==> cancelled
243
+ if (grpc_trace_channel.enabled()) {
244
+ gpr_log(GPR_INFO, "%sCANCEL BATCH REQUEST ALREADY CANCELLED",
245
+ Activity::current()->DebugTag().c_str());
246
+ }
222
247
  return;
223
248
  }
224
249
  refcnt = 0;
@@ -329,12 +354,13 @@ void BaseCallData::SendMessage::StartOp(CapturedBatch batch) {
329
354
  intercepted_on_complete_ = std::exchange(batch_->on_complete, &on_complete_);
330
355
  }
331
356
 
332
- void BaseCallData::SendMessage::GotPipe(PipeReceiver<MessageHandle>* receiver) {
357
+ template <typename T>
358
+ void BaseCallData::SendMessage::GotPipe(T* pipe_end) {
333
359
  if (grpc_trace_channel.enabled()) {
334
360
  gpr_log(GPR_INFO, "%s SendMessage.GotPipe st=%s", base_->LogTag().c_str(),
335
361
  StateString(state_));
336
362
  }
337
- GPR_ASSERT(receiver != nullptr);
363
+ GPR_ASSERT(pipe_end != nullptr);
338
364
  switch (state_) {
339
365
  case State::kInitial:
340
366
  state_ = State::kIdle;
@@ -354,7 +380,7 @@ void BaseCallData::SendMessage::GotPipe(PipeReceiver<MessageHandle>* receiver) {
354
380
  case State::kCancelledButNotYetPolled:
355
381
  return;
356
382
  }
357
- receiver_ = receiver;
383
+ interceptor_->GotPipe(pipe_end);
358
384
  }
359
385
 
360
386
  bool BaseCallData::SendMessage::IsIdle() const {
@@ -398,12 +424,14 @@ void BaseCallData::SendMessage::OnComplete(absl::Status status) {
398
424
  case State::kForwardedBatch:
399
425
  completed_status_ = status;
400
426
  state_ = State::kBatchCompleted;
427
+ ScopedContext ctx(base_);
401
428
  base_->WakeInsideCombiner(&flusher);
402
429
  break;
403
430
  }
404
431
  }
405
432
 
406
- void BaseCallData::SendMessage::Done(const ServerMetadata& metadata) {
433
+ void BaseCallData::SendMessage::Done(const ServerMetadata& metadata,
434
+ Flusher* flusher) {
407
435
  if (grpc_trace_channel.enabled()) {
408
436
  gpr_log(GPR_INFO, "%s SendMessage.Done st=%s md=%s",
409
437
  base_->LogTag().c_str(), StateString(state_),
@@ -419,7 +447,16 @@ void BaseCallData::SendMessage::Done(const ServerMetadata& metadata) {
419
447
  state_ = State::kCancelledButNotYetPolled;
420
448
  break;
421
449
  case State::kGotBatchNoPipe:
422
- case State::kGotBatch:
450
+ case State::kGotBatch: {
451
+ std::string temp;
452
+ batch_.CancelWith(
453
+ absl::Status(
454
+ static_cast<absl::StatusCode>(metadata.get(GrpcStatusMetadata())
455
+ .value_or(GRPC_STATUS_UNKNOWN)),
456
+ metadata.GetStringValue("grpc-message", &temp).value_or("")),
457
+ flusher);
458
+ state_ = State::kCancelledButNotYetPolled;
459
+ } break;
423
460
  case State::kBatchCompleted:
424
461
  Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_)));
425
462
  break;
@@ -431,7 +468,8 @@ void BaseCallData::SendMessage::Done(const ServerMetadata& metadata) {
431
468
  }
432
469
  }
433
470
 
434
- void BaseCallData::SendMessage::WakeInsideCombiner(Flusher* flusher) {
471
+ void BaseCallData::SendMessage::WakeInsideCombiner(Flusher* flusher,
472
+ bool allow_push_to_pipe) {
435
473
  if (grpc_trace_channel.enabled()) {
436
474
  gpr_log(GPR_INFO, "%s SendMessage.WakeInsideCombiner st=%s%s",
437
475
  base_->LogTag().c_str(), StateString(state_),
@@ -443,26 +481,28 @@ void BaseCallData::SendMessage::WakeInsideCombiner(Flusher* flusher) {
443
481
  case State::kInitial:
444
482
  case State::kIdle:
445
483
  case State::kGotBatchNoPipe:
446
- case State::kForwardedBatch:
447
484
  case State::kCancelled:
448
485
  break;
449
486
  case State::kCancelledButNotYetPolled:
450
- pipe_.sender.Close();
487
+ interceptor()->Push()->Close();
451
488
  state_ = State::kCancelled;
452
489
  break;
453
- case State::kGotBatch: {
454
- state_ = State::kPushedToPipe;
455
- auto message = GetContext<Arena>()->MakePooled<Message>();
456
- message->payload()->Swap(batch_->payload->send_message.send_message);
457
- message->mutable_flags() = batch_->payload->send_message.flags;
458
- push_ = pipe_.sender.Push(std::move(message));
459
- next_ = receiver_->Next();
460
- }
490
+ case State::kGotBatch:
491
+ if (allow_push_to_pipe) {
492
+ state_ = State::kPushedToPipe;
493
+ auto message = GetContext<Arena>()->MakePooled<Message>();
494
+ message->payload()->Swap(batch_->payload->send_message.send_message);
495
+ message->mutable_flags() = batch_->payload->send_message.flags;
496
+ push_ = interceptor()->Push()->Push(std::move(message));
497
+ next_.emplace(interceptor()->Pull()->Next());
498
+ } else {
499
+ break;
500
+ }
461
501
  ABSL_FALLTHROUGH_INTENDED;
462
502
  case State::kPushedToPipe: {
463
503
  GPR_ASSERT(push_.has_value());
464
504
  auto r_push = (*push_)();
465
- if (auto* p = absl::get_if<bool>(&r_push)) {
505
+ if (auto* p = r_push.value_if_ready()) {
466
506
  if (grpc_trace_channel.enabled()) {
467
507
  gpr_log(GPR_INFO,
468
508
  "%s SendMessage.WakeInsideCombiner push complete, result=%s",
@@ -476,7 +516,7 @@ void BaseCallData::SendMessage::WakeInsideCombiner(Flusher* flusher) {
476
516
  }
477
517
  GPR_ASSERT(next_.has_value());
478
518
  auto r_next = (*next_)();
479
- if (auto* p = absl::get_if<NextResult<MessageHandle>>(&r_next)) {
519
+ if (auto* p = r_next.value_if_ready()) {
480
520
  if (grpc_trace_channel.enabled()) {
481
521
  gpr_log(GPR_INFO,
482
522
  "%s SendMessage.WakeInsideCombiner next complete, "
@@ -488,25 +528,25 @@ void BaseCallData::SendMessage::WakeInsideCombiner(Flusher* flusher) {
488
528
  batch_->payload->send_message.flags = (**p)->flags();
489
529
  state_ = State::kForwardedBatch;
490
530
  batch_.ResumeWith(flusher);
491
- next_result_ = std::move(*p);
492
531
  next_.reset();
532
+ if ((*push_)().ready()) push_.reset();
493
533
  }
494
534
  } break;
535
+ case State::kForwardedBatch:
536
+ if (push_.has_value() && (*push_)().ready()) {
537
+ push_.reset();
538
+ }
539
+ break;
495
540
  case State::kBatchCompleted:
496
- next_result_.reset();
497
- // We've cleared out the NextResult on the pipe from promise to us, but
498
- // there's also the pipe from us to the promise (so that the promise can
499
- // intercept the sent messages). The push promise here is pushing into the
500
- // latter pipe, and so we need to keep polling it until it's done, which
501
- // depending on what happens inside the promise may take some time.
502
- if (absl::holds_alternative<Pending>((*push_)())) break;
541
+ if (push_.has_value() && (*push_)().pending()) {
542
+ break;
543
+ }
503
544
  if (completed_status_.ok()) {
504
545
  state_ = State::kIdle;
505
546
  Activity::current()->ForceImmediateRepoll();
506
547
  } else {
507
548
  state_ = State::kCancelled;
508
549
  }
509
- push_.reset();
510
550
  flusher->AddClosure(intercepted_on_complete_, completed_status_,
511
551
  "batch_completed");
512
552
  break;
@@ -538,14 +578,20 @@ const char* BaseCallData::ReceiveMessage::StateString(State state) {
538
578
  return "CANCELLED";
539
579
  case State::kCancelledWhilstForwarding:
540
580
  return "CANCELLED_WHILST_FORWARDING";
581
+ case State::kCancelledWhilstForwardingNoPipe:
582
+ return "CANCELLED_WHILST_FORWARDING_NO_PIPE";
541
583
  case State::kBatchCompletedButCancelled:
542
584
  return "BATCH_COMPLETED_BUT_CANCELLED";
585
+ case State::kBatchCompletedButCancelledNoPipe:
586
+ return "BATCH_COMPLETED_BUT_CANCELLED_NO_PIPE";
543
587
  case State::kCancelledWhilstIdle:
544
588
  return "CANCELLED_WHILST_IDLE";
545
589
  case State::kCompletedWhilePulledFromPipe:
546
590
  return "COMPLETED_WHILE_PULLED_FROM_PIPE";
547
591
  case State::kCompletedWhilePushedToPipe:
548
592
  return "COMPLETED_WHILE_PUSHED_TO_PIPE";
593
+ case State::kCompletedWhileBatchCompleted:
594
+ return "COMPLETED_WHILE_BATCH_COMPLETED";
549
595
  }
550
596
  return "UNKNOWN";
551
597
  }
@@ -563,11 +609,14 @@ void BaseCallData::ReceiveMessage::StartOp(CapturedBatch& batch) {
563
609
  state_ = State::kForwardedBatch;
564
610
  break;
565
611
  case State::kCancelledWhilstForwarding:
612
+ case State::kCancelledWhilstForwardingNoPipe:
566
613
  case State::kBatchCompletedButCancelled:
614
+ case State::kBatchCompletedButCancelledNoPipe:
567
615
  case State::kForwardedBatch:
568
616
  case State::kForwardedBatchNoPipe:
569
617
  case State::kBatchCompleted:
570
618
  case State::kBatchCompletedNoPipe:
619
+ case State::kCompletedWhileBatchCompleted:
571
620
  case State::kPushedToPipe:
572
621
  case State::kPulledFromPipe:
573
622
  case State::kCompletedWhilePulledFromPipe:
@@ -587,7 +636,8 @@ void BaseCallData::ReceiveMessage::StartOp(CapturedBatch& batch) {
587
636
  batch->payload->recv_message.recv_message_ready, &on_complete_);
588
637
  }
589
638
 
590
- void BaseCallData::ReceiveMessage::GotPipe(PipeSender<MessageHandle>* sender) {
639
+ template <typename T>
640
+ void BaseCallData::ReceiveMessage::GotPipe(T* pipe_end) {
591
641
  if (grpc_trace_channel.enabled()) {
592
642
  gpr_log(GPR_INFO, "%s ReceiveMessage.GotPipe st=%s",
593
643
  base_->LogTag().c_str(), StateString(state_));
@@ -610,14 +660,17 @@ void BaseCallData::ReceiveMessage::GotPipe(PipeSender<MessageHandle>* sender) {
610
660
  case State::kPulledFromPipe:
611
661
  case State::kCompletedWhilePulledFromPipe:
612
662
  case State::kCompletedWhilePushedToPipe:
663
+ case State::kCompletedWhileBatchCompleted:
613
664
  case State::kCancelledWhilstForwarding:
665
+ case State::kCancelledWhilstForwardingNoPipe:
614
666
  case State::kCancelledWhilstIdle:
615
667
  case State::kBatchCompletedButCancelled:
668
+ case State::kBatchCompletedButCancelledNoPipe:
616
669
  Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_)));
617
670
  case State::kCancelled:
618
671
  return;
619
672
  }
620
- sender_ = sender;
673
+ interceptor()->GotPipe(pipe_end);
621
674
  }
622
675
 
623
676
  void BaseCallData::ReceiveMessage::OnComplete(absl::Status status) {
@@ -632,9 +685,11 @@ void BaseCallData::ReceiveMessage::OnComplete(absl::Status status) {
632
685
  case State::kPushedToPipe:
633
686
  case State::kPulledFromPipe:
634
687
  case State::kBatchCompleted:
688
+ case State::kCompletedWhileBatchCompleted:
635
689
  case State::kBatchCompletedNoPipe:
636
690
  case State::kCancelled:
637
691
  case State::kBatchCompletedButCancelled:
692
+ case State::kBatchCompletedButCancelledNoPipe:
638
693
  case State::kCancelledWhilstIdle:
639
694
  case State::kCompletedWhilePulledFromPipe:
640
695
  case State::kCompletedWhilePushedToPipe:
@@ -648,6 +703,9 @@ void BaseCallData::ReceiveMessage::OnComplete(absl::Status status) {
648
703
  case State::kCancelledWhilstForwarding:
649
704
  state_ = State::kBatchCompletedButCancelled;
650
705
  break;
706
+ case State::kCancelledWhilstForwardingNoPipe:
707
+ state_ = State::kBatchCompletedButCancelledNoPipe;
708
+ break;
651
709
  }
652
710
  completed_status_ = status;
653
711
  Flusher flusher(base_);
@@ -670,9 +728,15 @@ void BaseCallData::ReceiveMessage::Done(const ServerMetadata& metadata,
670
728
  state_ = State::kCancelledWhilstIdle;
671
729
  break;
672
730
  case State::kForwardedBatch:
673
- case State::kForwardedBatchNoPipe:
674
731
  state_ = State::kCancelledWhilstForwarding;
675
732
  break;
733
+ case State::kForwardedBatchNoPipe:
734
+ state_ = State::kCancelledWhilstForwardingNoPipe;
735
+ break;
736
+ case State::kCompletedWhileBatchCompleted:
737
+ case State::kBatchCompleted:
738
+ state_ = State::kCompletedWhileBatchCompleted;
739
+ break;
676
740
  case State::kCompletedWhilePulledFromPipe:
677
741
  case State::kCompletedWhilePushedToPipe:
678
742
  case State::kPulledFromPipe:
@@ -694,23 +758,27 @@ void BaseCallData::ReceiveMessage::Done(const ServerMetadata& metadata,
694
758
  state_ = State::kCancelled;
695
759
  }
696
760
  } break;
697
- case State::kBatchCompleted:
698
761
  case State::kBatchCompletedNoPipe:
699
762
  case State::kBatchCompletedButCancelled:
763
+ case State::kBatchCompletedButCancelledNoPipe:
700
764
  Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_)));
701
765
  case State::kCancelledWhilstIdle:
702
766
  case State::kCancelledWhilstForwarding:
767
+ case State::kCancelledWhilstForwardingNoPipe:
703
768
  case State::kCancelled:
704
769
  break;
705
770
  }
706
771
  }
707
772
 
708
- void BaseCallData::ReceiveMessage::WakeInsideCombiner(Flusher* flusher) {
773
+ void BaseCallData::ReceiveMessage::WakeInsideCombiner(Flusher* flusher,
774
+ bool allow_push_to_pipe) {
709
775
  if (grpc_trace_channel.enabled()) {
710
776
  gpr_log(GPR_INFO,
711
- "%s ReceiveMessage.WakeInsideCombiner st=%s push?=%s next?=%s",
777
+ "%s ReceiveMessage.WakeInsideCombiner st=%s push?=%s next?=%s "
778
+ "allow_push_to_pipe=%s",
712
779
  base_->LogTag().c_str(), StateString(state_),
713
- push_.has_value() ? "yes" : "no", next_.has_value() ? "yes" : "no");
780
+ push_.has_value() ? "yes" : "no", next_.has_value() ? "yes" : "no",
781
+ allow_push_to_pipe ? "yes" : "no");
714
782
  }
715
783
  switch (state_) {
716
784
  case State::kInitial:
@@ -719,40 +787,53 @@ void BaseCallData::ReceiveMessage::WakeInsideCombiner(Flusher* flusher) {
719
787
  case State::kForwardedBatch:
720
788
  case State::kCancelled:
721
789
  case State::kCancelledWhilstForwarding:
790
+ case State::kCancelledWhilstForwardingNoPipe:
722
791
  case State::kBatchCompletedNoPipe:
723
792
  break;
724
793
  case State::kCancelledWhilstIdle:
725
- sender_->Close();
794
+ interceptor()->Push()->Close();
726
795
  state_ = State::kCancelled;
727
796
  break;
728
797
  case State::kBatchCompletedButCancelled:
729
- sender_->Close();
798
+ case State::kCompletedWhileBatchCompleted:
799
+ interceptor()->Push()->Close();
800
+ state_ = State::kCancelled;
801
+ flusher->AddClosure(std::exchange(intercepted_on_complete_, nullptr),
802
+ completed_status_, "recv_message");
803
+ break;
804
+ case State::kBatchCompletedButCancelledNoPipe:
730
805
  state_ = State::kCancelled;
731
806
  flusher->AddClosure(std::exchange(intercepted_on_complete_, nullptr),
732
807
  completed_status_, "recv_message");
733
808
  break;
734
809
  case State::kBatchCompleted:
735
810
  if (completed_status_.ok() && intercepted_slice_buffer_->has_value()) {
736
- state_ = State::kPushedToPipe;
811
+ if (!allow_push_to_pipe) break;
812
+ if (state_ == State::kBatchCompleted) {
813
+ state_ = State::kPushedToPipe;
814
+ } else {
815
+ state_ = State::kCompletedWhilePushedToPipe;
816
+ }
737
817
  auto message = GetContext<Arena>()->MakePooled<Message>();
738
818
  message->payload()->Swap(&**intercepted_slice_buffer_);
739
819
  message->mutable_flags() = *intercepted_flags_;
740
- push_ = sender_->Push(std::move(message));
741
- next_ = pipe_.receiver.Next();
820
+ push_ = interceptor()->Push()->Push(std::move(message));
821
+ next_.emplace(interceptor()->Pull()->Next());
742
822
  } else {
743
- sender_->Close();
823
+ interceptor()->Push()->Close();
744
824
  state_ = State::kCancelled;
745
825
  flusher->AddClosure(std::exchange(intercepted_on_complete_, nullptr),
746
826
  completed_status_, "recv_message");
747
827
  break;
748
828
  }
749
- GPR_ASSERT(state_ == State::kPushedToPipe);
829
+ GPR_ASSERT(state_ == State::kPushedToPipe ||
830
+ state_ == State::kCompletedWhilePushedToPipe);
750
831
  ABSL_FALLTHROUGH_INTENDED;
751
832
  case State::kCompletedWhilePushedToPipe:
752
833
  case State::kPushedToPipe: {
753
834
  GPR_ASSERT(push_.has_value());
754
835
  auto r_push = (*push_)();
755
- if (auto* p = absl::get_if<bool>(&r_push)) {
836
+ if (auto* p = r_push.value_if_ready()) {
756
837
  if (grpc_trace_channel.enabled()) {
757
838
  gpr_log(GPR_INFO,
758
839
  "%s ReceiveMessage.WakeInsideCombiner push complete: %s",
@@ -765,13 +846,7 @@ void BaseCallData::ReceiveMessage::WakeInsideCombiner(Flusher* flusher) {
765
846
  }
766
847
  GPR_ASSERT(next_.has_value());
767
848
  auto r_next = (*next_)();
768
- if (auto* p = absl::get_if<NextResult<MessageHandle>>(&r_next)) {
769
- if (grpc_trace_channel.enabled()) {
770
- gpr_log(GPR_INFO,
771
- "%s ReceiveMessage.WakeInsideCombiner next complete: %s",
772
- base_->LogTag().c_str(),
773
- p->has_value() ? "got message" : "end of stream");
774
- }
849
+ if (auto* p = r_next.value_if_ready()) {
775
850
  next_.reset();
776
851
  if (p->has_value()) {
777
852
  *intercepted_slice_buffer_ = std::move(*(**p)->payload());
@@ -785,25 +860,37 @@ void BaseCallData::ReceiveMessage::WakeInsideCombiner(Flusher* flusher) {
785
860
  *intercepted_slice_buffer_ = absl::nullopt;
786
861
  *intercepted_flags_ = 0;
787
862
  state_ = State::kCancelled;
863
+ flusher->AddClosure(
864
+ std::exchange(intercepted_on_complete_, nullptr),
865
+ p->cancelled() ? absl::CancelledError() : absl::OkStatus(),
866
+ "recv_message");
867
+ }
868
+ if (grpc_trace_channel.enabled()) {
869
+ gpr_log(GPR_INFO,
870
+ "%s ReceiveMessage.WakeInsideCombiner next complete: %s "
871
+ "new_state=%s",
872
+ base_->LogTag().c_str(),
873
+ p->has_value() ? "got message" : "end of stream",
874
+ StateString(state_));
788
875
  }
789
876
  }
790
- }
791
877
  if (state_ != State::kPulledFromPipe &&
792
878
  state_ != State::kCompletedWhilePulledFromPipe) {
793
879
  break;
794
880
  }
881
+ }
795
882
  ABSL_FALLTHROUGH_INTENDED;
796
883
  case State::kCompletedWhilePulledFromPipe:
797
884
  case State::kPulledFromPipe: {
798
885
  GPR_ASSERT(push_.has_value());
799
- if (!absl::holds_alternative<Pending>((*push_)())) {
886
+ if ((*push_)().ready()) {
800
887
  if (grpc_trace_channel.enabled()) {
801
888
  gpr_log(GPR_INFO,
802
889
  "%s ReceiveMessage.WakeInsideCombiner push complete",
803
890
  base_->LogTag().c_str());
804
891
  }
805
892
  if (state_ == State::kCompletedWhilePulledFromPipe) {
806
- sender_->Close();
893
+ interceptor()->Push()->Close();
807
894
  state_ = State::kCancelled;
808
895
  } else {
809
896
  state_ = State::kIdle;
@@ -825,56 +912,76 @@ struct ClientCallData::RecvInitialMetadata final {
825
912
  // Initial state; no op seen
826
913
  kInitial,
827
914
  // No op seen, but we have a latch that would like to modify it when we do
828
- kGotLatch,
915
+ kGotPipe,
829
916
  // Responded to trailing metadata prior to getting a recv_initial_metadata
830
917
  kRespondedToTrailingMetadataPriorToHook,
831
918
  // Hooked, no latch yet
832
- kHookedWaitingForLatch,
919
+ kHookedWaitingForPipe,
833
920
  // Hooked, latch seen
834
- kHookedAndGotLatch,
921
+ kHookedAndGotPipe,
835
922
  // Got the callback, haven't set latch yet
836
- kCompleteWaitingForLatch,
923
+ kCompleteWaitingForPipe,
837
924
  // Got the callback and got the latch
838
- kCompleteAndGotLatch,
925
+ kCompleteAndGotPipe,
839
926
  // Got the callback and set the latch
840
- kCompleteAndSetLatch,
927
+ kCompleteAndPushedToPipe,
841
928
  // Called the original callback
842
929
  kResponded,
843
930
  // Called the original callback with an error: still need to set the latch
844
- kRespondedButNeedToSetLatch,
931
+ kRespondedButNeedToClosePipe,
845
932
  };
846
933
 
847
934
  State state = kInitial;
848
935
  grpc_closure* original_on_ready = nullptr;
849
936
  grpc_closure on_ready;
850
937
  grpc_metadata_batch* metadata = nullptr;
851
- Latch<ServerMetadata*>* server_initial_metadata_publisher = nullptr;
938
+ PipeSender<ServerMetadataHandle>* server_initial_metadata_publisher = nullptr;
939
+ absl::optional<PipeSender<ServerMetadataHandle>::PushType> metadata_push_;
940
+ absl::optional<PipeReceiverNextType<ServerMetadataHandle>> metadata_next_;
852
941
 
853
942
  static const char* StateString(State state) {
854
943
  switch (state) {
855
944
  case kInitial:
856
945
  return "INITIAL";
857
- case kGotLatch:
858
- return "GOT_LATCH";
946
+ case kGotPipe:
947
+ return "GOT_PIPE";
859
948
  case kRespondedToTrailingMetadataPriorToHook:
860
949
  return "RESPONDED_TO_TRAILING_METADATA_PRIOR_TO_HOOK";
861
- case kHookedWaitingForLatch:
862
- return "HOOKED_WAITING_FOR_LATCH";
863
- case kHookedAndGotLatch:
864
- return "HOOKED_AND_GOT_LATCH";
865
- case kCompleteWaitingForLatch:
866
- return "COMPLETE_WAITING_FOR_LATCH";
867
- case kCompleteAndGotLatch:
868
- return "COMPLETE_AND_GOT_LATCH";
869
- case kCompleteAndSetLatch:
870
- return "COMPLETE_AND_SET_LATCH";
950
+ case kHookedWaitingForPipe:
951
+ return "HOOKED_WAITING_FOR_PIPE";
952
+ case kHookedAndGotPipe:
953
+ return "HOOKED_AND_GOT_PIPE";
954
+ case kCompleteWaitingForPipe:
955
+ return "COMPLETE_WAITING_FOR_PIPE";
956
+ case kCompleteAndGotPipe:
957
+ return "COMPLETE_AND_GOT_PIPE";
958
+ case kCompleteAndPushedToPipe:
959
+ return "COMPLETE_AND_PUSHED_TO_PIPE";
871
960
  case kResponded:
872
961
  return "RESPONDED";
873
- case kRespondedButNeedToSetLatch:
874
- return "RESPONDED_BUT_NEED_TO_SET_LATCH";
962
+ case kRespondedButNeedToClosePipe:
963
+ return "RESPONDED_BUT_NEED_TO_CLOSE_PIPE";
875
964
  }
876
965
  return "UNKNOWN";
877
966
  }
967
+
968
+ bool AllowRecvMessage() const {
969
+ switch (state) {
970
+ case kInitial:
971
+ case kGotPipe:
972
+ case kHookedWaitingForPipe:
973
+ case kHookedAndGotPipe:
974
+ case kCompleteWaitingForPipe:
975
+ case kCompleteAndGotPipe:
976
+ case kCompleteAndPushedToPipe:
977
+ case kRespondedToTrailingMetadataPriorToHook:
978
+ return false;
979
+ case kResponded:
980
+ case kRespondedButNeedToClosePipe:
981
+ return true;
982
+ }
983
+ GPR_UNREACHABLE_CODE(return false);
984
+ }
878
985
  };
879
986
 
880
987
  class ClientCallData::PollContext {
@@ -892,6 +999,7 @@ class ClientCallData::PollContext {
892
999
  PollContext& operator=(const PollContext&) = delete;
893
1000
 
894
1001
  void Run() {
1002
+ GPR_DEBUG_ASSERT(HasContext<Arena>());
895
1003
  if (grpc_trace_channel.enabled()) {
896
1004
  gpr_log(GPR_INFO, "%s ClientCallData.PollContext.Run %s",
897
1005
  self_->LogTag().c_str(), self_->DebugString().c_str());
@@ -899,43 +1007,67 @@ class ClientCallData::PollContext {
899
1007
  GPR_ASSERT(have_scoped_activity_);
900
1008
  repoll_ = false;
901
1009
  if (self_->send_message() != nullptr) {
902
- self_->send_message()->WakeInsideCombiner(flusher_);
1010
+ self_->send_message()->WakeInsideCombiner(flusher_, true);
903
1011
  }
904
1012
  if (self_->receive_message() != nullptr) {
905
- self_->receive_message()->WakeInsideCombiner(flusher_);
1013
+ self_->receive_message()->WakeInsideCombiner(
1014
+ flusher_, self_->recv_initial_metadata_ == nullptr
1015
+ ? true
1016
+ : self_->recv_initial_metadata_->AllowRecvMessage());
906
1017
  }
907
- if (self_->server_initial_metadata_latch() != nullptr) {
1018
+ if (self_->server_initial_metadata_pipe() != nullptr) {
1019
+ if (self_->recv_initial_metadata_->metadata_push_.has_value()) {
1020
+ if ((*self_->recv_initial_metadata_->metadata_push_)().ready()) {
1021
+ self_->recv_initial_metadata_->metadata_push_.reset();
1022
+ }
1023
+ }
908
1024
  switch (self_->recv_initial_metadata_->state) {
909
1025
  case RecvInitialMetadata::kInitial:
910
- case RecvInitialMetadata::kGotLatch:
911
- case RecvInitialMetadata::kHookedWaitingForLatch:
912
- case RecvInitialMetadata::kHookedAndGotLatch:
913
- case RecvInitialMetadata::kCompleteWaitingForLatch:
1026
+ case RecvInitialMetadata::kGotPipe:
1027
+ case RecvInitialMetadata::kHookedWaitingForPipe:
1028
+ case RecvInitialMetadata::kHookedAndGotPipe:
1029
+ case RecvInitialMetadata::kCompleteWaitingForPipe:
914
1030
  case RecvInitialMetadata::kResponded:
915
1031
  case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook:
916
1032
  break;
917
- case RecvInitialMetadata::kRespondedButNeedToSetLatch:
918
- self_->recv_initial_metadata_->server_initial_metadata_publisher->Set(
919
- nullptr);
1033
+ case RecvInitialMetadata::kRespondedButNeedToClosePipe:
1034
+ self_->recv_initial_metadata_->server_initial_metadata_publisher
1035
+ ->Close();
920
1036
  self_->recv_initial_metadata_->state =
921
1037
  RecvInitialMetadata::kResponded;
922
1038
  break;
923
- case RecvInitialMetadata::kCompleteAndGotLatch:
1039
+ case RecvInitialMetadata::kCompleteAndGotPipe:
924
1040
  self_->recv_initial_metadata_->state =
925
- RecvInitialMetadata::kCompleteAndSetLatch;
926
- self_->recv_initial_metadata_->server_initial_metadata_publisher->Set(
927
- self_->recv_initial_metadata_->metadata);
1041
+ RecvInitialMetadata::kCompleteAndPushedToPipe;
1042
+ GPR_ASSERT(
1043
+ !self_->recv_initial_metadata_->metadata_push_.has_value());
1044
+ GPR_ASSERT(
1045
+ !self_->recv_initial_metadata_->metadata_next_.has_value());
1046
+ self_->recv_initial_metadata_->metadata_push_.emplace(
1047
+ self_->recv_initial_metadata_->server_initial_metadata_publisher
1048
+ ->Push(ServerMetadataHandle(
1049
+ self_->recv_initial_metadata_->metadata,
1050
+ Arena::PooledDeleter(nullptr))));
1051
+ repoll_ = true; // ensure Push() gets polled.
1052
+ self_->recv_initial_metadata_->metadata_next_.emplace(
1053
+ self_->server_initial_metadata_pipe()->receiver.Next());
928
1054
  ABSL_FALLTHROUGH_INTENDED;
929
- case RecvInitialMetadata::kCompleteAndSetLatch: {
930
- Poll<ServerMetadata**> p =
931
- self_->server_initial_metadata_latch()->Wait()();
932
- if (ServerMetadata*** ppp = absl::get_if<ServerMetadata**>(&p)) {
933
- ServerMetadata* md = **ppp;
934
- if (self_->recv_initial_metadata_->metadata != md) {
935
- *self_->recv_initial_metadata_->metadata = std::move(*md);
1055
+ case RecvInitialMetadata::kCompleteAndPushedToPipe: {
1056
+ GPR_ASSERT(self_->recv_initial_metadata_->metadata_next_.has_value());
1057
+ Poll<NextResult<ServerMetadataHandle>> p =
1058
+ (*self_->recv_initial_metadata_->metadata_next_)();
1059
+ if (NextResult<ServerMetadataHandle>* nr = p.value_if_ready()) {
1060
+ if (nr->has_value()) {
1061
+ ServerMetadataHandle md = std::move(nr->value());
1062
+ if (self_->recv_initial_metadata_->metadata != md.get()) {
1063
+ *self_->recv_initial_metadata_->metadata = std::move(*md);
1064
+ }
1065
+ } else {
1066
+ self_->recv_initial_metadata_->metadata->Clear();
936
1067
  }
937
1068
  self_->recv_initial_metadata_->state =
938
1069
  RecvInitialMetadata::kResponded;
1070
+ repoll_ = true;
939
1071
  flusher_->AddClosure(
940
1072
  std::exchange(self_->recv_initial_metadata_->original_on_ready,
941
1073
  nullptr),
@@ -961,10 +1093,10 @@ class ClientCallData::PollContext {
961
1093
  return h->DebugString();
962
1094
  }).c_str());
963
1095
  }
964
- if (auto* r = absl::get_if<ServerMetadataHandle>(&poll)) {
1096
+ if (auto* r = poll.value_if_ready()) {
965
1097
  auto md = std::move(*r);
966
1098
  if (self_->send_message() != nullptr) {
967
- self_->send_message()->Done(*md);
1099
+ self_->send_message()->Done(*md, flusher_);
968
1100
  }
969
1101
  if (self_->receive_message() != nullptr) {
970
1102
  self_->receive_message()->Done(*md, flusher_);
@@ -981,25 +1113,25 @@ class ClientCallData::PollContext {
981
1113
  if (self_->recv_initial_metadata_ != nullptr) {
982
1114
  switch (self_->recv_initial_metadata_->state) {
983
1115
  case RecvInitialMetadata::kInitial:
984
- case RecvInitialMetadata::kGotLatch:
1116
+ case RecvInitialMetadata::kGotPipe:
985
1117
  self_->recv_initial_metadata_->state = RecvInitialMetadata::
986
1118
  kRespondedToTrailingMetadataPriorToHook;
987
1119
  break;
988
1120
  case RecvInitialMetadata::
989
1121
  kRespondedToTrailingMetadataPriorToHook:
990
- case RecvInitialMetadata::kRespondedButNeedToSetLatch:
1122
+ case RecvInitialMetadata::kRespondedButNeedToClosePipe:
991
1123
  Crash(absl::StrFormat("ILLEGAL STATE: %s",
992
1124
  RecvInitialMetadata::StateString(
993
1125
  self_->recv_initial_metadata_
994
1126
  ->state))); // not reachable
995
1127
  break;
996
- case RecvInitialMetadata::kHookedWaitingForLatch:
997
- case RecvInitialMetadata::kHookedAndGotLatch:
1128
+ case RecvInitialMetadata::kHookedWaitingForPipe:
1129
+ case RecvInitialMetadata::kHookedAndGotPipe:
998
1130
  case RecvInitialMetadata::kResponded:
999
- case RecvInitialMetadata::kCompleteAndGotLatch:
1000
- case RecvInitialMetadata::kCompleteAndSetLatch:
1131
+ case RecvInitialMetadata::kCompleteAndGotPipe:
1132
+ case RecvInitialMetadata::kCompleteAndPushedToPipe:
1001
1133
  break;
1002
- case RecvInitialMetadata::kCompleteWaitingForLatch:
1134
+ case RecvInitialMetadata::kCompleteWaitingForPipe:
1003
1135
  self_->recv_initial_metadata_->state =
1004
1136
  RecvInitialMetadata::kResponded;
1005
1137
  flusher_->AddClosure(
@@ -1016,25 +1148,25 @@ class ClientCallData::PollContext {
1016
1148
  if (self_->recv_initial_metadata_ != nullptr) {
1017
1149
  switch (self_->recv_initial_metadata_->state) {
1018
1150
  case RecvInitialMetadata::kInitial:
1019
- case RecvInitialMetadata::kGotLatch:
1151
+ case RecvInitialMetadata::kGotPipe:
1020
1152
  self_->recv_initial_metadata_->state = RecvInitialMetadata::
1021
1153
  kRespondedToTrailingMetadataPriorToHook;
1022
1154
  break;
1023
- case RecvInitialMetadata::kHookedWaitingForLatch:
1024
- case RecvInitialMetadata::kHookedAndGotLatch:
1155
+ case RecvInitialMetadata::kHookedWaitingForPipe:
1156
+ case RecvInitialMetadata::kHookedAndGotPipe:
1025
1157
  case RecvInitialMetadata::kResponded:
1026
1158
  break;
1027
1159
  case RecvInitialMetadata::
1028
1160
  kRespondedToTrailingMetadataPriorToHook:
1029
- case RecvInitialMetadata::kRespondedButNeedToSetLatch:
1161
+ case RecvInitialMetadata::kRespondedButNeedToClosePipe:
1030
1162
  Crash(absl::StrFormat("ILLEGAL STATE: %s",
1031
1163
  RecvInitialMetadata::StateString(
1032
1164
  self_->recv_initial_metadata_
1033
1165
  ->state))); // not reachable
1034
1166
  break;
1035
- case RecvInitialMetadata::kCompleteWaitingForLatch:
1036
- case RecvInitialMetadata::kCompleteAndGotLatch:
1037
- case RecvInitialMetadata::kCompleteAndSetLatch:
1167
+ case RecvInitialMetadata::kCompleteWaitingForPipe:
1168
+ case RecvInitialMetadata::kCompleteAndGotPipe:
1169
+ case RecvInitialMetadata::kCompleteAndPushedToPipe:
1038
1170
  self_->recv_initial_metadata_->state =
1039
1171
  RecvInitialMetadata::kResponded;
1040
1172
  flusher_->AddClosure(
@@ -1099,6 +1231,7 @@ class ClientCallData::PollContext {
1099
1231
  auto run = [](void* p, grpc_error_handle) {
1100
1232
  auto* next_poll = static_cast<NextPoll*>(p);
1101
1233
  {
1234
+ ScopedContext ctx(next_poll->call_data);
1102
1235
  Flusher flusher(next_poll->call_data);
1103
1236
  next_poll->call_data->WakeInsideCombiner(&flusher);
1104
1237
  }
@@ -1133,11 +1266,16 @@ class ClientCallData::PollContext {
1133
1266
  ClientCallData::ClientCallData(grpc_call_element* elem,
1134
1267
  const grpc_call_element_args* args,
1135
1268
  uint8_t flags)
1136
- : BaseCallData(elem, args, flags) {
1269
+ : BaseCallData(
1270
+ elem, args, flags,
1271
+ [args]() {
1272
+ return args->arena->New<ReceiveInterceptor>(args->arena);
1273
+ },
1274
+ [args]() { return args->arena->New<SendInterceptor>(args->arena); }) {
1137
1275
  GRPC_CLOSURE_INIT(&recv_trailing_metadata_ready_,
1138
1276
  RecvTrailingMetadataReadyCallback, this,
1139
1277
  grpc_schedule_on_exec_ctx);
1140
- if (server_initial_metadata_latch() != nullptr) {
1278
+ if (server_initial_metadata_pipe() != nullptr) {
1141
1279
  recv_initial_metadata_ = arena()->New<RecvInitialMetadata>();
1142
1280
  }
1143
1281
  }
@@ -1200,7 +1338,7 @@ std::string ClientCallData::DebugString() const {
1200
1338
  " sent_initial_state=", StateString(send_initial_state_),
1201
1339
  " recv_trailing_state=", StateString(recv_trailing_state_), " captured={",
1202
1340
  absl::StrJoin(captured, ","), "}",
1203
- server_initial_metadata_latch() == nullptr
1341
+ server_initial_metadata_pipe() == nullptr
1204
1342
  ? ""
1205
1343
  : absl::StrCat(" recv_initial_metadata=",
1206
1344
  RecvInitialMetadata::StateString(
@@ -1242,21 +1380,21 @@ void ClientCallData::StartBatch(grpc_transport_stream_op_batch* b) {
1242
1380
  switch (recv_initial_metadata_->state) {
1243
1381
  case RecvInitialMetadata::kInitial:
1244
1382
  recv_initial_metadata_->state =
1245
- RecvInitialMetadata::kHookedWaitingForLatch;
1383
+ RecvInitialMetadata::kHookedWaitingForPipe;
1246
1384
  break;
1247
- case RecvInitialMetadata::kGotLatch:
1248
- recv_initial_metadata_->state = RecvInitialMetadata::kHookedAndGotLatch;
1385
+ case RecvInitialMetadata::kGotPipe:
1386
+ recv_initial_metadata_->state = RecvInitialMetadata::kHookedAndGotPipe;
1249
1387
  break;
1250
1388
  case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook:
1251
1389
  hook = false;
1252
1390
  break;
1253
- case RecvInitialMetadata::kHookedWaitingForLatch:
1254
- case RecvInitialMetadata::kHookedAndGotLatch:
1255
- case RecvInitialMetadata::kCompleteWaitingForLatch:
1256
- case RecvInitialMetadata::kCompleteAndGotLatch:
1257
- case RecvInitialMetadata::kCompleteAndSetLatch:
1391
+ case RecvInitialMetadata::kHookedWaitingForPipe:
1392
+ case RecvInitialMetadata::kHookedAndGotPipe:
1393
+ case RecvInitialMetadata::kCompleteWaitingForPipe:
1394
+ case RecvInitialMetadata::kCompleteAndGotPipe:
1395
+ case RecvInitialMetadata::kCompleteAndPushedToPipe:
1258
1396
  case RecvInitialMetadata::kResponded:
1259
- case RecvInitialMetadata::kRespondedButNeedToSetLatch:
1397
+ case RecvInitialMetadata::kRespondedButNeedToClosePipe:
1260
1398
  Crash(absl::StrFormat(
1261
1399
  "ILLEGAL STATE: %s",
1262
1400
  RecvInitialMetadata::StateString(
@@ -1360,9 +1498,9 @@ void ClientCallData::Cancel(grpc_error_handle error, Flusher* flusher) {
1360
1498
  }
1361
1499
  if (recv_initial_metadata_ != nullptr) {
1362
1500
  switch (recv_initial_metadata_->state) {
1363
- case RecvInitialMetadata::kCompleteWaitingForLatch:
1364
- case RecvInitialMetadata::kCompleteAndGotLatch:
1365
- case RecvInitialMetadata::kCompleteAndSetLatch:
1501
+ case RecvInitialMetadata::kCompleteWaitingForPipe:
1502
+ case RecvInitialMetadata::kCompleteAndGotPipe:
1503
+ case RecvInitialMetadata::kCompleteAndPushedToPipe:
1366
1504
  recv_initial_metadata_->state = RecvInitialMetadata::kResponded;
1367
1505
  GRPC_CALL_COMBINER_START(
1368
1506
  call_combiner(),
@@ -1370,13 +1508,13 @@ void ClientCallData::Cancel(grpc_error_handle error, Flusher* flusher) {
1370
1508
  error, "propagate cancellation");
1371
1509
  break;
1372
1510
  case RecvInitialMetadata::kInitial:
1373
- case RecvInitialMetadata::kGotLatch:
1511
+ case RecvInitialMetadata::kGotPipe:
1374
1512
  case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook:
1375
- case RecvInitialMetadata::kHookedWaitingForLatch:
1376
- case RecvInitialMetadata::kHookedAndGotLatch:
1513
+ case RecvInitialMetadata::kHookedWaitingForPipe:
1514
+ case RecvInitialMetadata::kHookedAndGotPipe:
1377
1515
  case RecvInitialMetadata::kResponded:
1378
1516
  break;
1379
- case RecvInitialMetadata::kRespondedButNeedToSetLatch:
1517
+ case RecvInitialMetadata::kRespondedButNeedToClosePipe:
1380
1518
  Crash(absl::StrFormat(
1381
1519
  "ILLEGAL STATE: %s",
1382
1520
  RecvInitialMetadata::StateString(recv_initial_metadata_->state)));
@@ -1384,7 +1522,7 @@ void ClientCallData::Cancel(grpc_error_handle error, Flusher* flusher) {
1384
1522
  }
1385
1523
  }
1386
1524
  if (send_message() != nullptr) {
1387
- send_message()->Done(*ServerMetadataFromStatus(error));
1525
+ send_message()->Done(*ServerMetadataFromStatus(error), flusher);
1388
1526
  }
1389
1527
  if (receive_message() != nullptr) {
1390
1528
  receive_message()->Done(*ServerMetadataFromStatus(error), flusher);
@@ -1402,8 +1540,15 @@ void ClientCallData::StartPromise(Flusher* flusher) {
1402
1540
  promise_ = filter->MakeCallPromise(
1403
1541
  CallArgs{WrapMetadata(send_initial_metadata_batch_->payload
1404
1542
  ->send_initial_metadata.send_initial_metadata),
1405
- server_initial_metadata_latch(), outgoing_messages_pipe(),
1406
- incoming_messages_pipe()},
1543
+ server_initial_metadata_pipe() == nullptr
1544
+ ? nullptr
1545
+ : &server_initial_metadata_pipe()->sender,
1546
+ send_message() == nullptr
1547
+ ? nullptr
1548
+ : send_message()->interceptor()->original_receiver(),
1549
+ receive_message() == nullptr
1550
+ ? nullptr
1551
+ : receive_message()->interceptor()->original_sender()},
1407
1552
  [this](CallArgs call_args) {
1408
1553
  return MakeNextPromise(std::move(call_args));
1409
1554
  });
@@ -1412,28 +1557,30 @@ void ClientCallData::StartPromise(Flusher* flusher) {
1412
1557
 
1413
1558
  void ClientCallData::RecvInitialMetadataReady(grpc_error_handle error) {
1414
1559
  if (grpc_trace_channel.enabled()) {
1415
- gpr_log(GPR_INFO, "%s ClientCallData.RecvInitialMetadataReady %s",
1416
- LogTag().c_str(), DebugString().c_str());
1560
+ gpr_log(GPR_INFO,
1561
+ "%s ClientCallData.RecvInitialMetadataReady %s error:%s md:%s",
1562
+ LogTag().c_str(), DebugString().c_str(), error.ToString().c_str(),
1563
+ recv_initial_metadata_->metadata->DebugString().c_str());
1417
1564
  }
1418
1565
  ScopedContext context(this);
1419
1566
  Flusher flusher(this);
1420
1567
  if (!error.ok()) {
1421
1568
  switch (recv_initial_metadata_->state) {
1422
- case RecvInitialMetadata::kHookedWaitingForLatch:
1569
+ case RecvInitialMetadata::kHookedWaitingForPipe:
1423
1570
  recv_initial_metadata_->state = RecvInitialMetadata::kResponded;
1424
1571
  break;
1425
- case RecvInitialMetadata::kHookedAndGotLatch:
1572
+ case RecvInitialMetadata::kHookedAndGotPipe:
1426
1573
  recv_initial_metadata_->state =
1427
- RecvInitialMetadata::kRespondedButNeedToSetLatch;
1574
+ RecvInitialMetadata::kRespondedButNeedToClosePipe;
1428
1575
  break;
1429
1576
  case RecvInitialMetadata::kInitial:
1430
- case RecvInitialMetadata::kGotLatch:
1431
- case RecvInitialMetadata::kCompleteWaitingForLatch:
1432
- case RecvInitialMetadata::kCompleteAndGotLatch:
1433
- case RecvInitialMetadata::kCompleteAndSetLatch:
1577
+ case RecvInitialMetadata::kGotPipe:
1578
+ case RecvInitialMetadata::kCompleteWaitingForPipe:
1579
+ case RecvInitialMetadata::kCompleteAndGotPipe:
1580
+ case RecvInitialMetadata::kCompleteAndPushedToPipe:
1434
1581
  case RecvInitialMetadata::kResponded:
1435
1582
  case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook:
1436
- case RecvInitialMetadata::kRespondedButNeedToSetLatch:
1583
+ case RecvInitialMetadata::kRespondedButNeedToClosePipe:
1437
1584
  Crash(absl::StrFormat(
1438
1585
  "ILLEGAL STATE: %s",
1439
1586
  RecvInitialMetadata::StateString(
@@ -1450,22 +1597,22 @@ void ClientCallData::RecvInitialMetadataReady(grpc_error_handle error) {
1450
1597
  cancelled_error_, "propagate cancellation");
1451
1598
  } else {
1452
1599
  switch (recv_initial_metadata_->state) {
1453
- case RecvInitialMetadata::kHookedWaitingForLatch:
1600
+ case RecvInitialMetadata::kHookedWaitingForPipe:
1454
1601
  recv_initial_metadata_->state =
1455
- RecvInitialMetadata::kCompleteWaitingForLatch;
1602
+ RecvInitialMetadata::kCompleteWaitingForPipe;
1456
1603
  break;
1457
- case RecvInitialMetadata::kHookedAndGotLatch:
1604
+ case RecvInitialMetadata::kHookedAndGotPipe:
1458
1605
  recv_initial_metadata_->state =
1459
- RecvInitialMetadata::kCompleteAndGotLatch;
1606
+ RecvInitialMetadata::kCompleteAndGotPipe;
1460
1607
  break;
1461
1608
  case RecvInitialMetadata::kInitial:
1462
- case RecvInitialMetadata::kGotLatch:
1463
- case RecvInitialMetadata::kCompleteWaitingForLatch:
1464
- case RecvInitialMetadata::kCompleteAndGotLatch:
1465
- case RecvInitialMetadata::kCompleteAndSetLatch:
1609
+ case RecvInitialMetadata::kGotPipe:
1610
+ case RecvInitialMetadata::kCompleteWaitingForPipe:
1611
+ case RecvInitialMetadata::kCompleteAndGotPipe:
1612
+ case RecvInitialMetadata::kCompleteAndPushedToPipe:
1466
1613
  case RecvInitialMetadata::kResponded:
1467
1614
  case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook:
1468
- case RecvInitialMetadata::kRespondedButNeedToSetLatch:
1615
+ case RecvInitialMetadata::kRespondedButNeedToClosePipe:
1469
1616
  Crash(absl::StrFormat(
1470
1617
  "ILLEGAL STATE: %s",
1471
1618
  RecvInitialMetadata::StateString(
@@ -1512,24 +1659,24 @@ ArenaPromise<ServerMetadataHandle> ClientCallData::MakeNextPromise(
1512
1659
  call_args.server_initial_metadata;
1513
1660
  switch (recv_initial_metadata_->state) {
1514
1661
  case RecvInitialMetadata::kInitial:
1515
- recv_initial_metadata_->state = RecvInitialMetadata::kGotLatch;
1662
+ recv_initial_metadata_->state = RecvInitialMetadata::kGotPipe;
1516
1663
  break;
1517
- case RecvInitialMetadata::kHookedWaitingForLatch:
1518
- recv_initial_metadata_->state = RecvInitialMetadata::kHookedAndGotLatch;
1664
+ case RecvInitialMetadata::kHookedWaitingForPipe:
1665
+ recv_initial_metadata_->state = RecvInitialMetadata::kHookedAndGotPipe;
1519
1666
  poll_ctx_->Repoll();
1520
1667
  break;
1521
- case RecvInitialMetadata::kCompleteWaitingForLatch:
1668
+ case RecvInitialMetadata::kCompleteWaitingForPipe:
1522
1669
  recv_initial_metadata_->state =
1523
- RecvInitialMetadata::kCompleteAndGotLatch;
1670
+ RecvInitialMetadata::kCompleteAndGotPipe;
1524
1671
  poll_ctx_->Repoll();
1525
1672
  break;
1526
- case RecvInitialMetadata::kGotLatch:
1527
- case RecvInitialMetadata::kHookedAndGotLatch:
1528
- case RecvInitialMetadata::kCompleteAndGotLatch:
1529
- case RecvInitialMetadata::kCompleteAndSetLatch:
1673
+ case RecvInitialMetadata::kGotPipe:
1674
+ case RecvInitialMetadata::kHookedAndGotPipe:
1675
+ case RecvInitialMetadata::kCompleteAndGotPipe:
1676
+ case RecvInitialMetadata::kCompleteAndPushedToPipe:
1530
1677
  case RecvInitialMetadata::kResponded:
1531
1678
  case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook:
1532
- case RecvInitialMetadata::kRespondedButNeedToSetLatch:
1679
+ case RecvInitialMetadata::kRespondedButNeedToClosePipe:
1533
1680
  Crash(absl::StrFormat(
1534
1681
  "ILLEGAL STATE: %s",
1535
1682
  RecvInitialMetadata::StateString(
@@ -1539,14 +1686,14 @@ ArenaPromise<ServerMetadataHandle> ClientCallData::MakeNextPromise(
1539
1686
  GPR_ASSERT(call_args.server_initial_metadata == nullptr);
1540
1687
  }
1541
1688
  if (send_message() != nullptr) {
1542
- send_message()->GotPipe(call_args.outgoing_messages);
1689
+ send_message()->GotPipe(call_args.client_to_server_messages);
1543
1690
  } else {
1544
- GPR_ASSERT(call_args.outgoing_messages == nullptr);
1691
+ GPR_ASSERT(call_args.client_to_server_messages == nullptr);
1545
1692
  }
1546
1693
  if (receive_message() != nullptr) {
1547
- receive_message()->GotPipe(call_args.incoming_messages);
1694
+ receive_message()->GotPipe(call_args.server_to_client_messages);
1548
1695
  } else {
1549
- GPR_ASSERT(call_args.incoming_messages == nullptr);
1696
+ GPR_ASSERT(call_args.server_to_client_messages == nullptr);
1550
1697
  }
1551
1698
  return ArenaPromise<ServerMetadataHandle>(
1552
1699
  [this]() { return PollTrailingMetadata(); });
@@ -1640,7 +1787,7 @@ void ClientCallData::RecvTrailingMetadataReady(grpc_error_handle error) {
1640
1787
  receive_message()->Done(*recv_trailing_metadata_, &flusher);
1641
1788
  }
1642
1789
  if (send_message() != nullptr) {
1643
- send_message()->Done(*recv_trailing_metadata_);
1790
+ send_message()->Done(*recv_trailing_metadata_, &flusher);
1644
1791
  }
1645
1792
  // Repoll the promise.
1646
1793
  ScopedContext context(this);
@@ -1677,29 +1824,31 @@ void ClientCallData::OnWakeup() {
1677
1824
  struct ServerCallData::SendInitialMetadata {
1678
1825
  enum State {
1679
1826
  kInitial,
1680
- kGotLatch,
1681
- kQueuedWaitingForLatch,
1682
- kQueuedAndGotLatch,
1683
- kQueuedAndSetLatch,
1827
+ kGotPipe,
1828
+ kQueuedWaitingForPipe,
1829
+ kQueuedAndGotPipe,
1830
+ kQueuedAndPushedToPipe,
1684
1831
  kForwarded,
1685
1832
  kCancelled,
1686
1833
  };
1687
1834
  State state = kInitial;
1688
1835
  CapturedBatch batch;
1689
- Latch<ServerMetadata*>* server_initial_metadata_publisher = nullptr;
1836
+ PipeSender<ServerMetadataHandle>* server_initial_metadata_publisher = nullptr;
1837
+ absl::optional<PipeSender<ServerMetadataHandle>::PushType> metadata_push_;
1838
+ absl::optional<PipeReceiverNextType<ServerMetadataHandle>> metadata_next_;
1690
1839
 
1691
1840
  static const char* StateString(State state) {
1692
1841
  switch (state) {
1693
1842
  case kInitial:
1694
1843
  return "INITIAL";
1695
- case kGotLatch:
1696
- return "GOT_LATCH";
1697
- case kQueuedWaitingForLatch:
1698
- return "QUEUED_WAITING_FOR_LATCH";
1699
- case kQueuedAndGotLatch:
1700
- return "QUEUED_AND_GOT_LATCH";
1701
- case kQueuedAndSetLatch:
1702
- return "QUEUED_AND_SET_LATCH";
1844
+ case kGotPipe:
1845
+ return "GOT_PIPE";
1846
+ case kQueuedWaitingForPipe:
1847
+ return "QUEUED_WAITING_FOR_PIPE";
1848
+ case kQueuedAndGotPipe:
1849
+ return "QUEUED_AND_GOT_PIPE";
1850
+ case kQueuedAndPushedToPipe:
1851
+ return "QUEUED_AND_PUSHED_TO_PIPE";
1703
1852
  case kForwarded:
1704
1853
  return "FORWARDED";
1705
1854
  case kCancelled:
@@ -1734,6 +1883,7 @@ class ServerCallData::PollContext {
1734
1883
  auto* next_poll = static_cast<NextPoll*>(p);
1735
1884
  {
1736
1885
  Flusher flusher(next_poll->call_data);
1886
+ ScopedContext context(next_poll->call_data);
1737
1887
  next_poll->call_data->WakeInsideCombiner(&flusher);
1738
1888
  }
1739
1889
  GRPC_CALL_STACK_UNREF(next_poll->call_stack, "re-poll");
@@ -1781,6 +1931,8 @@ const char* ServerCallData::StateString(SendTrailingState state) {
1781
1931
  return "FORWARDED";
1782
1932
  case SendTrailingState::kQueuedBehindSendMessage:
1783
1933
  return "QUEUED_BEHIND_SEND_MESSAGE";
1934
+ case SendTrailingState::kQueuedButHaventClosedSends:
1935
+ return "QUEUED_BUT_HAVENT_CLOSED_SENDS";
1784
1936
  case SendTrailingState::kQueued:
1785
1937
  return "QUEUED";
1786
1938
  case SendTrailingState::kCancelled:
@@ -1792,8 +1944,13 @@ const char* ServerCallData::StateString(SendTrailingState state) {
1792
1944
  ServerCallData::ServerCallData(grpc_call_element* elem,
1793
1945
  const grpc_call_element_args* args,
1794
1946
  uint8_t flags)
1795
- : BaseCallData(elem, args, flags) {
1796
- if (server_initial_metadata_latch() != nullptr) {
1947
+ : BaseCallData(
1948
+ elem, args, flags,
1949
+ [args]() { return args->arena->New<SendInterceptor>(args->arena); },
1950
+ [args]() {
1951
+ return args->arena->New<ReceiveInterceptor>(args->arena);
1952
+ }) {
1953
+ if (server_initial_metadata_pipe() != nullptr) {
1797
1954
  send_initial_metadata_ = arena()->New<SendInitialMetadata>();
1798
1955
  }
1799
1956
  GRPC_CLOSURE_INIT(&recv_initial_metadata_ready_,
@@ -1881,19 +2038,19 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) {
1881
2038
  switch (send_initial_metadata_->state) {
1882
2039
  case SendInitialMetadata::kInitial:
1883
2040
  send_initial_metadata_->state =
1884
- SendInitialMetadata::kQueuedWaitingForLatch;
2041
+ SendInitialMetadata::kQueuedWaitingForPipe;
1885
2042
  break;
1886
- case SendInitialMetadata::kGotLatch:
1887
- send_initial_metadata_->state = SendInitialMetadata::kQueuedAndGotLatch;
2043
+ case SendInitialMetadata::kGotPipe:
2044
+ send_initial_metadata_->state = SendInitialMetadata::kQueuedAndGotPipe;
1888
2045
  break;
1889
2046
  case SendInitialMetadata::kCancelled:
1890
2047
  batch.CancelWith(
1891
2048
  cancelled_error_.ok() ? absl::CancelledError() : cancelled_error_,
1892
2049
  &flusher);
1893
2050
  break;
1894
- case SendInitialMetadata::kQueuedAndGotLatch:
1895
- case SendInitialMetadata::kQueuedWaitingForLatch:
1896
- case SendInitialMetadata::kQueuedAndSetLatch:
2051
+ case SendInitialMetadata::kQueuedAndGotPipe:
2052
+ case SendInitialMetadata::kQueuedWaitingForPipe:
2053
+ case SendInitialMetadata::kQueuedAndPushedToPipe:
1897
2054
  case SendInitialMetadata::kForwarded:
1898
2055
  Crash(absl::StrFormat(
1899
2056
  "ILLEGAL STATE: %s",
@@ -1926,6 +2083,9 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) {
1926
2083
  }
1927
2084
  if (send_message() != nullptr && !send_message()->IsIdle()) {
1928
2085
  send_trailing_state_ = SendTrailingState::kQueuedBehindSendMessage;
2086
+ } else if (send_message() != nullptr) {
2087
+ send_trailing_state_ = SendTrailingState::kQueuedButHaventClosedSends;
2088
+ wake = true;
1929
2089
  } else {
1930
2090
  send_trailing_state_ = SendTrailingState::kQueued;
1931
2091
  wake = true;
@@ -1933,6 +2093,7 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) {
1933
2093
  break;
1934
2094
  case SendTrailingState::kQueued:
1935
2095
  case SendTrailingState::kQueuedBehindSendMessage:
2096
+ case SendTrailingState::kQueuedButHaventClosedSends:
1936
2097
  case SendTrailingState::kForwarded:
1937
2098
  Crash(
1938
2099
  absl::StrFormat("ILLEGAL STATE: %s",
@@ -1952,26 +2113,55 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) {
1952
2113
 
1953
2114
  // Handle cancellation.
1954
2115
  void ServerCallData::Completed(grpc_error_handle error, Flusher* flusher) {
2116
+ if (grpc_trace_channel.enabled()) {
2117
+ gpr_log(
2118
+ GPR_DEBUG,
2119
+ "%sServerCallData::Completed: send_trailing_state=%s "
2120
+ "send_initial_state=%s error=%s",
2121
+ LogTag().c_str(), StateString(send_trailing_state_),
2122
+ send_initial_metadata_ == nullptr
2123
+ ? "null"
2124
+ : SendInitialMetadata::StateString(send_initial_metadata_->state),
2125
+ error.ToString().c_str());
2126
+ }
1955
2127
  // Track the latest reason for cancellation.
1956
2128
  cancelled_error_ = error;
1957
2129
  // Stop running the promise.
1958
2130
  promise_ = ArenaPromise<ServerMetadataHandle>();
1959
- if (send_trailing_state_ == SendTrailingState::kQueued) {
1960
- send_trailing_state_ = SendTrailingState::kCancelled;
1961
- send_trailing_metadata_batch_.CancelWith(error, flusher);
1962
- } else {
1963
- send_trailing_state_ = SendTrailingState::kCancelled;
2131
+ switch (send_trailing_state_) {
2132
+ case SendTrailingState::kInitial:
2133
+ case SendTrailingState::kForwarded:
2134
+ send_trailing_state_ = SendTrailingState::kCancelled;
2135
+ if (!error.ok()) {
2136
+ auto* batch = grpc_make_transport_stream_op(
2137
+ NewClosure([call_combiner = call_combiner()](absl::Status) {
2138
+ GRPC_CALL_COMBINER_STOP(call_combiner, "done-cancel");
2139
+ }));
2140
+ batch->cancel_stream = true;
2141
+ batch->payload->cancel_stream.cancel_error = error;
2142
+ flusher->Resume(batch);
2143
+ }
2144
+ break;
2145
+ case SendTrailingState::kQueued:
2146
+ send_trailing_state_ = SendTrailingState::kCancelled;
2147
+ send_trailing_metadata_batch_.CancelWith(error, flusher);
2148
+ break;
2149
+ case SendTrailingState::kQueuedBehindSendMessage:
2150
+ case SendTrailingState::kQueuedButHaventClosedSends:
2151
+ case SendTrailingState::kCancelled:
2152
+ send_trailing_state_ = SendTrailingState::kCancelled;
2153
+ break;
1964
2154
  }
1965
2155
  if (send_initial_metadata_ != nullptr) {
1966
2156
  switch (send_initial_metadata_->state) {
1967
2157
  case SendInitialMetadata::kInitial:
1968
- case SendInitialMetadata::kGotLatch:
2158
+ case SendInitialMetadata::kGotPipe:
1969
2159
  case SendInitialMetadata::kForwarded:
1970
2160
  case SendInitialMetadata::kCancelled:
1971
2161
  break;
1972
- case SendInitialMetadata::kQueuedWaitingForLatch:
1973
- case SendInitialMetadata::kQueuedAndGotLatch:
1974
- case SendInitialMetadata::kQueuedAndSetLatch:
2162
+ case SendInitialMetadata::kQueuedWaitingForPipe:
2163
+ case SendInitialMetadata::kQueuedAndGotPipe:
2164
+ case SendInitialMetadata::kQueuedAndPushedToPipe:
1975
2165
  send_initial_metadata_->batch.CancelWith(error, flusher);
1976
2166
  break;
1977
2167
  }
@@ -1983,7 +2173,7 @@ void ServerCallData::Completed(grpc_error_handle error, Flusher* flusher) {
1983
2173
  }
1984
2174
  ScopedContext ctx(this);
1985
2175
  if (send_message() != nullptr) {
1986
- send_message()->Done(*ServerMetadataFromStatus(error));
2176
+ send_message()->Done(*ServerMetadataFromStatus(error), flusher);
1987
2177
  }
1988
2178
  if (receive_message() != nullptr) {
1989
2179
  receive_message()->Done(*ServerMetadataFromStatus(error), flusher);
@@ -2008,19 +2198,19 @@ ArenaPromise<ServerMetadataHandle> ServerCallData::MakeNextPromise(
2008
2198
  call_args.server_initial_metadata;
2009
2199
  switch (send_initial_metadata_->state) {
2010
2200
  case SendInitialMetadata::kInitial:
2011
- send_initial_metadata_->state = SendInitialMetadata::kGotLatch;
2201
+ send_initial_metadata_->state = SendInitialMetadata::kGotPipe;
2012
2202
  break;
2013
- case SendInitialMetadata::kGotLatch:
2014
- case SendInitialMetadata::kQueuedAndGotLatch:
2015
- case SendInitialMetadata::kQueuedAndSetLatch:
2203
+ case SendInitialMetadata::kGotPipe:
2204
+ case SendInitialMetadata::kQueuedAndGotPipe:
2205
+ case SendInitialMetadata::kQueuedAndPushedToPipe:
2016
2206
  case SendInitialMetadata::kForwarded:
2017
2207
  Crash(absl::StrFormat(
2018
2208
  "ILLEGAL STATE: %s",
2019
2209
  SendInitialMetadata::StateString(
2020
2210
  send_initial_metadata_->state))); // not reachable
2021
2211
  break;
2022
- case SendInitialMetadata::kQueuedWaitingForLatch:
2023
- send_initial_metadata_->state = SendInitialMetadata::kQueuedAndGotLatch;
2212
+ case SendInitialMetadata::kQueuedWaitingForPipe:
2213
+ send_initial_metadata_->state = SendInitialMetadata::kQueuedAndGotPipe;
2024
2214
  break;
2025
2215
  case SendInitialMetadata::kCancelled:
2026
2216
  break;
@@ -2029,14 +2219,14 @@ ArenaPromise<ServerMetadataHandle> ServerCallData::MakeNextPromise(
2029
2219
  GPR_ASSERT(call_args.server_initial_metadata == nullptr);
2030
2220
  }
2031
2221
  if (send_message() != nullptr) {
2032
- send_message()->GotPipe(call_args.outgoing_messages);
2222
+ send_message()->GotPipe(call_args.server_to_client_messages);
2033
2223
  } else {
2034
- GPR_ASSERT(call_args.outgoing_messages == nullptr);
2224
+ GPR_ASSERT(call_args.server_to_client_messages == nullptr);
2035
2225
  }
2036
2226
  if (receive_message() != nullptr) {
2037
- receive_message()->GotPipe(call_args.incoming_messages);
2227
+ receive_message()->GotPipe(call_args.client_to_server_messages);
2038
2228
  } else {
2039
- GPR_ASSERT(call_args.incoming_messages == nullptr);
2229
+ GPR_ASSERT(call_args.client_to_server_messages == nullptr);
2040
2230
  }
2041
2231
  return ArenaPromise<ServerMetadataHandle>(
2042
2232
  [this]() { return PollTrailingMetadata(); });
@@ -2046,9 +2236,14 @@ ArenaPromise<ServerMetadataHandle> ServerCallData::MakeNextPromise(
2046
2236
  // All polls: await sending the trailing metadata, then foward it down the
2047
2237
  // stack.
2048
2238
  Poll<ServerMetadataHandle> ServerCallData::PollTrailingMetadata() {
2239
+ if (grpc_trace_channel.enabled()) {
2240
+ gpr_log(GPR_INFO, "%s PollTrailingMetadata: %s", LogTag().c_str(),
2241
+ StateString(send_trailing_state_));
2242
+ }
2049
2243
  switch (send_trailing_state_) {
2050
2244
  case SendTrailingState::kInitial:
2051
2245
  case SendTrailingState::kQueuedBehindSendMessage:
2246
+ case SendTrailingState::kQueuedButHaventClosedSends:
2052
2247
  return Pending{};
2053
2248
  case SendTrailingState::kQueued:
2054
2249
  return WrapMetadata(send_trailing_metadata_batch_->payload
@@ -2111,22 +2306,24 @@ void ServerCallData::RecvInitialMetadataReady(grpc_error_handle error) {
2111
2306
  ScopedContext context(this);
2112
2307
  // Construct the promise.
2113
2308
  ChannelFilter* filter = static_cast<ChannelFilter*>(elem()->channel_data);
2114
- FakeActivity().Run([this, filter] {
2309
+ FakeActivity(this).Run([this, filter] {
2115
2310
  promise_ = filter->MakeCallPromise(
2116
2311
  CallArgs{WrapMetadata(recv_initial_metadata_),
2117
- server_initial_metadata_latch(), outgoing_messages_pipe(),
2118
- incoming_messages_pipe()},
2312
+ server_initial_metadata_pipe() == nullptr
2313
+ ? nullptr
2314
+ : &server_initial_metadata_pipe()->sender,
2315
+ receive_message() == nullptr
2316
+ ? nullptr
2317
+ : receive_message()->interceptor()->original_receiver(),
2318
+ send_message() == nullptr
2319
+ ? nullptr
2320
+ : send_message()->interceptor()->original_sender()},
2119
2321
  [this](CallArgs call_args) {
2120
2322
  return MakeNextPromise(std::move(call_args));
2121
2323
  });
2122
2324
  });
2123
2325
  // Poll once.
2124
2326
  WakeInsideCombiner(&flusher);
2125
- if (auto* closure =
2126
- std::exchange(original_recv_initial_metadata_ready_, nullptr)) {
2127
- flusher.AddClosure(closure, absl::OkStatus(),
2128
- "original_recv_initial_metadata");
2129
- }
2130
2327
  }
2131
2328
 
2132
2329
  std::string ServerCallData::DebugString() const {
@@ -2157,61 +2354,125 @@ void ServerCallData::WakeInsideCombiner(Flusher* flusher) {
2157
2354
  gpr_log(GPR_INFO, "%s: WakeInsideCombiner %s", LogTag().c_str(),
2158
2355
  DebugString().c_str());
2159
2356
  }
2160
- if (send_initial_metadata_ != nullptr &&
2161
- send_initial_metadata_->state ==
2162
- SendInitialMetadata::kQueuedAndGotLatch) {
2163
- send_initial_metadata_->state = SendInitialMetadata::kQueuedAndSetLatch;
2164
- send_initial_metadata_->server_initial_metadata_publisher->Set(
2165
- send_initial_metadata_->batch->payload->send_initial_metadata
2166
- .send_initial_metadata);
2167
- }
2168
2357
  poll_ctx.ClearRepoll();
2358
+ if (send_initial_metadata_ != nullptr) {
2359
+ if (send_initial_metadata_->state ==
2360
+ SendInitialMetadata::kQueuedAndGotPipe) {
2361
+ send_initial_metadata_->state =
2362
+ SendInitialMetadata::kQueuedAndPushedToPipe;
2363
+ GPR_ASSERT(!send_initial_metadata_->metadata_push_.has_value());
2364
+ GPR_ASSERT(!send_initial_metadata_->metadata_next_.has_value());
2365
+ send_initial_metadata_->metadata_push_.emplace(
2366
+ send_initial_metadata_->server_initial_metadata_publisher->Push(
2367
+ ServerMetadataHandle(
2368
+ send_initial_metadata_->batch->payload->send_initial_metadata
2369
+ .send_initial_metadata,
2370
+ Arena::PooledDeleter(nullptr))));
2371
+ send_initial_metadata_->metadata_next_.emplace(
2372
+ server_initial_metadata_pipe()->receiver.Next());
2373
+ }
2374
+ if (send_initial_metadata_->metadata_push_.has_value()) {
2375
+ if ((*send_initial_metadata_->metadata_push_)().ready()) {
2376
+ if (grpc_trace_channel.enabled()) {
2377
+ gpr_log(GPR_INFO, "%s: WakeInsideCombiner: metadata_push done",
2378
+ LogTag().c_str());
2379
+ }
2380
+ send_initial_metadata_->metadata_push_.reset();
2381
+ } else if (grpc_trace_channel.enabled()) {
2382
+ gpr_log(GPR_INFO, "%s: WakeInsideCombiner: metadata_push pending",
2383
+ LogTag().c_str());
2384
+ }
2385
+ }
2386
+ }
2169
2387
  if (send_message() != nullptr) {
2170
- send_message()->WakeInsideCombiner(flusher);
2388
+ if (send_trailing_state_ ==
2389
+ SendTrailingState::kQueuedButHaventClosedSends) {
2390
+ send_trailing_state_ = SendTrailingState::kQueued;
2391
+ send_message()->Done(*send_trailing_metadata_batch_->payload
2392
+ ->send_trailing_metadata.send_trailing_metadata,
2393
+ flusher);
2394
+ }
2395
+ send_message()->WakeInsideCombiner(
2396
+ flusher,
2397
+ send_initial_metadata_ == nullptr ||
2398
+ send_initial_metadata_->state == SendInitialMetadata::kForwarded);
2399
+ if (grpc_trace_channel.enabled()) {
2400
+ gpr_log(GPR_DEBUG,
2401
+ "%s: After send_message WakeInsideCombiner %s is_idle=%s "
2402
+ "is_forwarded=%s",
2403
+ LogTag().c_str(), DebugString().c_str(),
2404
+ send_message()->IsIdle() ? "true" : "false",
2405
+ send_message()->IsForwarded() ? "true" : "false");
2406
+ }
2171
2407
  if (send_trailing_state_ == SendTrailingState::kQueuedBehindSendMessage &&
2172
- send_message()->IsIdle()) {
2408
+ (send_message()->IsIdle() ||
2409
+ (send_trailing_metadata_batch_->send_message &&
2410
+ send_message()->IsForwarded()))) {
2173
2411
  send_trailing_state_ = SendTrailingState::kQueued;
2412
+ send_message()->Done(*send_trailing_metadata_batch_->payload
2413
+ ->send_trailing_metadata.send_trailing_metadata,
2414
+ flusher);
2174
2415
  }
2175
2416
  }
2176
2417
  if (receive_message() != nullptr) {
2177
- receive_message()->WakeInsideCombiner(flusher);
2418
+ receive_message()->WakeInsideCombiner(flusher, true);
2178
2419
  }
2179
2420
  if (promise_.has_value()) {
2180
2421
  Poll<ServerMetadataHandle> poll;
2181
2422
  poll = promise_();
2182
2423
  if (grpc_trace_channel.enabled()) {
2183
- gpr_log(GPR_INFO, "%s: WakeInsideCombiner poll=%s", LogTag().c_str(),
2184
- PollToString(poll, [](const ServerMetadataHandle& h) {
2185
- return h->DebugString();
2186
- }).c_str());
2424
+ gpr_log(
2425
+ GPR_INFO,
2426
+ "%s: WakeInsideCombiner poll=%s; send_initial_metadata=%s "
2427
+ "send_trailing_metadata=%s",
2428
+ LogTag().c_str(),
2429
+ PollToString(
2430
+ poll,
2431
+ [](const ServerMetadataHandle& h) { return h->DebugString(); })
2432
+ .c_str(),
2433
+ send_initial_metadata_ == nullptr
2434
+ ? "null"
2435
+ : SendInitialMetadata::StateString(send_initial_metadata_->state),
2436
+ StateString(send_trailing_state_));
2187
2437
  }
2188
2438
  if (send_initial_metadata_ != nullptr &&
2189
2439
  send_initial_metadata_->state ==
2190
- SendInitialMetadata::kQueuedAndSetLatch) {
2191
- Poll<ServerMetadata**> p = server_initial_metadata_latch()->Wait()();
2192
- if (ServerMetadata*** ppp = absl::get_if<ServerMetadata**>(&p)) {
2193
- ServerMetadata* md = **ppp;
2440
+ SendInitialMetadata::kQueuedAndPushedToPipe) {
2441
+ GPR_ASSERT(send_initial_metadata_->metadata_next_.has_value());
2442
+ auto p = (*send_initial_metadata_->metadata_next_)();
2443
+ if (grpc_trace_channel.enabled()) {
2444
+ gpr_log(GPR_INFO,
2445
+ "%s: WakeInsideCombiner send_initial_metadata poll=%s",
2446
+ LogTag().c_str(),
2447
+ PollToString(p, [](const NextResult<ServerMetadataHandle>& h) {
2448
+ return (*h)->DebugString();
2449
+ }).c_str());
2450
+ }
2451
+ if (auto* nr = p.value_if_ready()) {
2452
+ ServerMetadataHandle md = std::move(nr->value());
2194
2453
  if (send_initial_metadata_->batch->payload->send_initial_metadata
2195
- .send_initial_metadata != md) {
2454
+ .send_initial_metadata != md.get()) {
2196
2455
  *send_initial_metadata_->batch->payload->send_initial_metadata
2197
2456
  .send_initial_metadata = std::move(*md);
2198
2457
  }
2199
2458
  send_initial_metadata_->state = SendInitialMetadata::kForwarded;
2459
+ poll_ctx.Repoll();
2200
2460
  send_initial_metadata_->batch.ResumeWith(flusher);
2201
2461
  }
2202
2462
  }
2203
- if (auto* r = absl::get_if<ServerMetadataHandle>(&poll)) {
2463
+ if (auto* r = poll.value_if_ready()) {
2204
2464
  promise_ = ArenaPromise<ServerMetadataHandle>();
2205
2465
  auto* md = UnwrapMetadata(std::move(*r));
2206
2466
  bool destroy_md = true;
2207
2467
  if (send_message() != nullptr) {
2208
- send_message()->Done(*md);
2468
+ send_message()->Done(*md, flusher);
2209
2469
  }
2210
2470
  if (receive_message() != nullptr) {
2211
2471
  receive_message()->Done(*md, flusher);
2212
2472
  }
2213
2473
  switch (send_trailing_state_) {
2214
2474
  case SendTrailingState::kQueuedBehindSendMessage:
2475
+ case SendTrailingState::kQueuedButHaventClosedSends:
2215
2476
  case SendTrailingState::kQueued: {
2216
2477
  if (send_trailing_metadata_batch_->payload->send_trailing_metadata
2217
2478
  .send_trailing_metadata != md) {
@@ -2241,9 +2502,20 @@ void ServerCallData::WakeInsideCombiner(Flusher* flusher) {
2241
2502
  }
2242
2503
  }
2243
2504
  }
2505
+ if (std::exchange(forward_recv_initial_metadata_callback_, false)) {
2506
+ if (auto* closure =
2507
+ std::exchange(original_recv_initial_metadata_ready_, nullptr)) {
2508
+ flusher->AddClosure(closure, absl::OkStatus(),
2509
+ "original_recv_initial_metadata");
2510
+ }
2511
+ }
2244
2512
  }
2245
2513
 
2246
- void ServerCallData::OnWakeup() { abort(); } // not implemented
2514
+ void ServerCallData::OnWakeup() {
2515
+ Flusher flusher(this);
2516
+ ScopedContext context(this);
2517
+ WakeInsideCombiner(&flusher);
2518
+ }
2247
2519
 
2248
2520
  } // namespace promise_filter_detail
2249
2521
  } // namespace grpc_core