grpc 1.81.1 → 1.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (948) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +15 -9
  3. data/etc/roots.pem +10400 -3855
  4. data/include/grpc/grpc.h +6 -7
  5. data/include/grpc/grpc_audit_logging.h +2 -2
  6. data/include/grpc/grpc_security_constants.h +2 -0
  7. data/include/grpc/impl/channel_arg_names.h +26 -1
  8. data/src/core/call/call_filters.h +21 -5
  9. data/src/core/call/call_spine.h +4 -4
  10. data/src/core/call/client_call.cc +2 -2
  11. data/src/core/call/interception_chain.h +6 -9
  12. data/src/core/call/metadata.cc +7 -2
  13. data/src/core/call/metadata.h +1 -1
  14. data/src/core/call/metadata_batch.cc +1 -1
  15. data/src/core/call/metadata_batch.h +17 -1
  16. data/src/core/call/parsed_metadata.h +7 -2
  17. data/src/core/call/server_call.cc +16 -4
  18. data/src/core/call/server_call.h +14 -5
  19. data/src/core/call/status_util.cc +0 -4
  20. data/src/core/call/status_util.h +0 -3
  21. data/src/core/channelz/channel_trace.cc +3 -1
  22. data/src/core/client_channel/backup_poller.cc +2 -17
  23. data/src/core/client_channel/client_channel.cc +23 -28
  24. data/src/core/client_channel/client_channel.h +5 -3
  25. data/src/core/client_channel/client_channel_filter.cc +19 -30
  26. data/src/core/client_channel/client_channel_filter.h +2 -2
  27. data/src/core/client_channel/client_channel_plugin.cc +1 -1
  28. data/src/core/client_channel/client_channel_service_config.cc +5 -13
  29. data/src/core/client_channel/config_selector.h +2 -7
  30. data/src/core/client_channel/direct_channel.cc +5 -1
  31. data/src/core/client_channel/direct_channel.h +3 -1
  32. data/src/core/client_channel/dynamic_filters.cc +4 -7
  33. data/src/core/client_channel/dynamic_filters.h +1 -3
  34. data/src/core/client_channel/retry_filter.cc +2 -25
  35. data/src/core/client_channel/retry_filter.h +3 -7
  36. data/src/core/client_channel/retry_filter_legacy_call_data.cc +1 -1
  37. data/src/core/client_channel/retry_filter_legacy_call_data.h +2 -2
  38. data/src/core/client_channel/retry_interceptor.cc +7 -35
  39. data/src/core/client_channel/retry_interceptor.h +11 -14
  40. data/src/core/client_channel/retry_service_config.cc +0 -2
  41. data/src/core/client_channel/retry_service_config.h +0 -2
  42. data/src/core/client_channel/retry_throttle.cc +19 -7
  43. data/src/core/client_channel/retry_throttle.h +24 -7
  44. data/src/core/client_channel/subchannel.cc +1 -1
  45. data/src/core/{filter/blackboard.cc → config/experiment_env_var.cc} +11 -14
  46. data/src/core/config/experiment_env_var.h +26 -0
  47. data/src/core/credentials/call/external/external_account_credentials.cc +125 -12
  48. data/src/core/credentials/call/external/external_account_credentials.h +6 -1
  49. data/src/core/credentials/call/jwt/jwt_credentials.cc +11 -1
  50. data/src/core/credentials/call/jwt/jwt_credentials.h +3 -0
  51. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +64 -11
  52. data/src/core/credentials/call/oauth2/oauth2_credentials.h +0 -1
  53. data/src/core/credentials/call/regional_access_boundary_fetcher.cc +411 -0
  54. data/src/core/credentials/call/regional_access_boundary_fetcher.h +158 -0
  55. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +1 -1
  56. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +7 -1
  57. data/src/core/credentials/transport/insecure/insecure_security_connector.h +1 -1
  58. data/src/core/credentials/transport/local/local_security_connector.cc +1 -1
  59. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +14 -2
  60. data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.cc +172 -0
  61. data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +103 -0
  62. data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +3 -2
  63. data/src/core/credentials/transport/tls/load_system_roots_supported.cc +10 -3
  64. data/src/core/credentials/transport/tls/tls_security_connector.cc +14 -2
  65. data/src/core/credentials/transport/xds/xds_credentials.cc +4 -12
  66. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +6 -0
  67. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +28 -66
  68. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +0 -8
  69. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +24 -58
  70. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +24 -19
  71. data/src/core/ext/filters/message_size/message_size_filter.cc +1 -81
  72. data/src/core/ext/filters/message_size/message_size_filter.h +1 -50
  73. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -1
  74. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +13 -56
  75. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +0 -14
  76. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
  77. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +184 -54
  78. data/src/core/ext/transport/chttp2/server/chttp2_server.h +10 -1
  79. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +84 -15
  80. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  81. data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
  82. data/src/core/ext/transport/chttp2/transport/flow_control.h +14 -2
  83. data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +2 -4
  84. data/src/core/ext/transport/chttp2/transport/frame.cc +120 -13
  85. data/src/core/ext/transport/chttp2/transport/frame.h +57 -10
  86. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +4 -1
  87. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +13 -7
  88. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -1
  89. data/src/core/ext/transport/chttp2/transport/frame_security.cc +10 -1
  90. data/src/core/ext/transport/chttp2/transport/frame_security.h +2 -1
  91. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +4 -1
  92. data/src/core/ext/transport/chttp2/transport/goaway.cc +11 -1
  93. data/src/core/ext/transport/chttp2/transport/goaway.h +17 -1
  94. data/src/core/ext/transport/chttp2/transport/header_assembler.h +54 -22
  95. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +53 -5
  96. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +22 -0
  97. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +20 -0
  98. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +42 -1
  99. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +4 -1
  100. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +219 -417
  101. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +49 -29
  102. data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +2073 -0
  103. data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +746 -0
  104. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -1
  105. data/src/core/ext/transport/chttp2/transport/http2_settings.h +49 -15
  106. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +0 -2
  107. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +74 -26
  108. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +39 -15
  109. data/src/core/ext/transport/chttp2/transport/http2_transport.h +18 -48
  110. data/src/core/ext/transport/chttp2/transport/internal.h +18 -0
  111. data/src/core/ext/transport/chttp2/transport/message_assembler.h +1 -2
  112. data/src/core/ext/transport/chttp2/transport/parsing.cc +85 -26
  113. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +1 -1
  114. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +4 -10
  115. data/src/core/ext/transport/chttp2/transport/read_context.h +494 -0
  116. data/src/core/ext/transport/chttp2/transport/security_frame.h +13 -3
  117. data/src/core/ext/transport/chttp2/transport/stream.h +287 -137
  118. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +83 -65
  119. data/src/core/ext/transport/chttp2/transport/write_cycle.h +9 -1
  120. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +16 -2
  121. data/src/core/ext/upb-gen/cel/expr/checked.upb.h +621 -432
  122. data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.c +264 -166
  123. data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.h +0 -13
  124. data/src/core/ext/upb-gen/cel/expr/syntax.upb.h +708 -497
  125. data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.c +294 -176
  126. data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.h +0 -15
  127. data/src/core/ext/upb-gen/envoy/admin/v3/certs.upb.h +262 -181
  128. data/src/core/ext/upb-gen/envoy/admin/v3/certs.upb_minitable.c +84 -58
  129. data/src/core/ext/upb-gen/envoy/admin/v3/certs.upb_minitable.h +0 -5
  130. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb.h +254 -190
  131. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb_minitable.c +107 -53
  132. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb_minitable.h +0 -4
  133. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump.upb.h +271 -190
  134. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump.upb_minitable.c +88 -64
  135. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump.upb_minitable.h +0 -5
  136. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb.h +1035 -730
  137. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb_minitable.c +384 -260
  138. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb_minitable.h +0 -19
  139. data/src/core/ext/upb-gen/envoy/admin/v3/init_dump.upb.h +87 -56
  140. data/src/core/ext/upb-gen/envoy/admin/v3/init_dump.upb_minitable.c +26 -16
  141. data/src/core/ext/upb-gen/envoy/admin/v3/init_dump.upb_minitable.h +0 -2
  142. data/src/core/ext/upb-gen/envoy/admin/v3/listeners.upb.h +105 -71
  143. data/src/core/ext/upb-gen/envoy/admin/v3/listeners.upb_minitable.c +30 -22
  144. data/src/core/ext/upb-gen/envoy/admin/v3/listeners.upb_minitable.h +0 -2
  145. data/src/core/ext/upb-gen/envoy/admin/v3/memory.upb.h +31 -29
  146. data/src/core/ext/upb-gen/envoy/admin/v3/memory.upb_minitable.c +19 -7
  147. data/src/core/ext/upb-gen/envoy/admin/v3/memory.upb_minitable.h +0 -1
  148. data/src/core/ext/upb-gen/envoy/admin/v3/metrics.upb.h +25 -23
  149. data/src/core/ext/upb-gen/envoy/admin/v3/metrics.upb_minitable.c +15 -7
  150. data/src/core/ext/upb-gen/envoy/admin/v3/metrics.upb_minitable.h +0 -1
  151. data/src/core/ext/upb-gen/envoy/admin/v3/mutex_stats.upb.h +25 -23
  152. data/src/core/ext/upb-gen/envoy/admin/v3/mutex_stats.upb_minitable.c +15 -7
  153. data/src/core/ext/upb-gen/envoy/admin/v3/mutex_stats.upb_minitable.h +0 -1
  154. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +201 -165
  155. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +79 -31
  156. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.h +0 -2
  157. data/src/core/ext/upb-gen/envoy/admin/v3/tap.upb.h +29 -26
  158. data/src/core/ext/upb-gen/envoy/admin/v3/tap.upb_minitable.c +17 -11
  159. data/src/core/ext/upb-gen/envoy/admin/v3/tap.upb_minitable.h +0 -1
  160. data/src/core/ext/upb-gen/envoy/annotations/deprecation.upb.h +46 -29
  161. data/src/core/ext/upb-gen/envoy/annotations/deprecation.upb_minitable.c +37 -19
  162. data/src/core/ext/upb-gen/envoy/annotations/deprecation.upb_minitable.h +4 -4
  163. data/src/core/ext/upb-gen/envoy/annotations/resource.upb.h +34 -27
  164. data/src/core/ext/upb-gen/envoy/annotations/resource.upb_minitable.c +34 -13
  165. data/src/core/ext/upb-gen/envoy/annotations/resource.upb_minitable.h +1 -2
  166. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb.h +617 -452
  167. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb_minitable.c +221 -163
  168. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb_minitable.h +0 -16
  169. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +1339 -970
  170. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +484 -324
  171. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.h +0 -23
  172. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb.h +181 -135
  173. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb_minitable.c +59 -43
  174. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb_minitable.h +0 -3
  175. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +1353 -1028
  176. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +535 -361
  177. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.h +0 -25
  178. data/src/core/ext/upb-gen/envoy/config/cluster/v3/filter.upb.h +37 -33
  179. data/src/core/ext/upb-gen/envoy/config/cluster/v3/filter.upb_minitable.c +19 -13
  180. data/src/core/ext/upb-gen/envoy/config/cluster/v3/filter.upb_minitable.h +0 -1
  181. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb.h +234 -196
  182. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb_minitable.c +77 -57
  183. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb_minitable.h +0 -1
  184. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb.h +695 -502
  185. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.c +246 -186
  186. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.h +0 -15
  187. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb.h +140 -116
  188. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.c +53 -43
  189. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.h +0 -3
  190. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +363 -269
  191. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +131 -89
  192. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.h +0 -8
  193. data/src/core/ext/upb-gen/envoy/config/core/v3/backoff.upb.h +35 -31
  194. data/src/core/ext/upb-gen/envoy/config/core/v3/backoff.upb_minitable.c +15 -13
  195. data/src/core/ext/upb-gen/envoy/config/core/v3/backoff.upb_minitable.h +0 -1
  196. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +1073 -769
  197. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +515 -293
  198. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +0 -30
  199. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb.h +25 -23
  200. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.c +15 -7
  201. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.h +0 -1
  202. data/src/core/ext/upb-gen/envoy/config/core/v3/config_source.upb.h +375 -267
  203. data/src/core/ext/upb-gen/envoy/config/core/v3/config_source.upb_minitable.c +142 -86
  204. data/src/core/ext/upb-gen/envoy/config/core/v3/config_source.upb_minitable.h +0 -7
  205. data/src/core/ext/upb-gen/envoy/config/core/v3/event_service_config.upb.h +32 -27
  206. data/src/core/ext/upb-gen/envoy/config/core/v3/event_service_config.upb_minitable.c +13 -11
  207. data/src/core/ext/upb-gen/envoy/config/core/v3/event_service_config.upb_minitable.h +0 -1
  208. data/src/core/ext/upb-gen/envoy/config/core/v3/extension.upb.h +29 -26
  209. data/src/core/ext/upb-gen/envoy/config/core/v3/extension.upb_minitable.c +17 -11
  210. data/src/core/ext/upb-gen/envoy/config/core/v3/extension.upb_minitable.h +0 -1
  211. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_method_list.upb.h +87 -56
  212. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_method_list.upb_minitable.c +26 -16
  213. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_method_list.upb_minitable.h +0 -2
  214. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb.h +634 -468
  215. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.c +255 -161
  216. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.h +0 -14
  217. data/src/core/ext/upb-gen/envoy/config/core/v3/health_check.upb.h +672 -474
  218. data/src/core/ext/upb-gen/envoy/config/core/v3/health_check.upb_minitable.c +228 -130
  219. data/src/core/ext/upb-gen/envoy/config/core/v3/health_check.upb_minitable.h +0 -9
  220. data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb.h +56 -40
  221. data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb_minitable.c +15 -13
  222. data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb_minitable.h +0 -1
  223. data/src/core/ext/upb-gen/envoy/config/core/v3/http_uri.upb.h +34 -29
  224. data/src/core/ext/upb-gen/envoy/config/core/v3/http_uri.upb_minitable.c +19 -11
  225. data/src/core/ext/upb-gen/envoy/config/core/v3/http_uri.upb_minitable.h +0 -1
  226. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +811 -635
  227. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +347 -221
  228. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.h +0 -16
  229. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb.h +174 -118
  230. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.c +62 -38
  231. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.h +0 -4
  232. data/src/core/ext/upb-gen/envoy/config/core/v3/resolver.upb.h +78 -57
  233. data/src/core/ext/upb-gen/envoy/config/core/v3/resolver.upb_minitable.c +28 -18
  234. data/src/core/ext/upb-gen/envoy/config/core/v3/resolver.upb_minitable.h +0 -2
  235. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb.h +37 -33
  236. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.c +22 -14
  237. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.h +0 -1
  238. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +159 -119
  239. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +47 -35
  240. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.h +0 -5
  241. data/src/core/ext/upb-gen/envoy/config/core/v3/substitution_format_string.upb.h +101 -76
  242. data/src/core/ext/upb-gen/envoy/config/core/v3/substitution_format_string.upb_minitable.c +41 -23
  243. data/src/core/ext/upb-gen/envoy/config/core/v3/substitution_format_string.upb_minitable.h +0 -2
  244. data/src/core/ext/upb-gen/envoy/config/core/v3/udp_socket_config.upb.h +35 -31
  245. data/src/core/ext/upb-gen/envoy/config/core/v3/udp_socket_config.upb_minitable.c +15 -13
  246. data/src/core/ext/upb-gen/envoy/config/core/v3/udp_socket_config.upb_minitable.h +0 -1
  247. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint.upb.h +189 -127
  248. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint.upb_minitable.c +79 -49
  249. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint.upb_minitable.h +0 -4
  250. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +378 -283
  251. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +156 -98
  252. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.h +0 -8
  253. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/load_report.upb.h +354 -255
  254. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/load_report.upb_minitable.c +125 -69
  255. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/load_report.upb_minitable.h +0 -6
  256. data/src/core/ext/upb-gen/envoy/config/listener/v3/api_listener.upb.h +27 -24
  257. data/src/core/ext/upb-gen/envoy/config/listener/v3/api_listener.upb_minitable.c +13 -11
  258. data/src/core/ext/upb-gen/envoy/config/listener/v3/api_listener.upb_minitable.h +0 -1
  259. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +611 -451
  260. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +159 -119
  261. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +0 -11
  262. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb.h +468 -321
  263. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.c +157 -99
  264. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.h +0 -6
  265. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +146 -119
  266. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +55 -35
  267. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.h +0 -1
  268. data/src/core/ext/upb-gen/envoy/config/listener/v3/udp_listener_config.upb.h +61 -51
  269. data/src/core/ext/upb-gen/envoy/config/listener/v3/udp_listener_config.upb_minitable.c +16 -16
  270. data/src/core/ext/upb-gen/envoy/config/listener/v3/udp_listener_config.upb_minitable.h +0 -2
  271. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb.h +43 -39
  272. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.c +25 -13
  273. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.h +0 -1
  274. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +341 -247
  275. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +130 -84
  276. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.h +0 -8
  277. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +452 -313
  278. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.c +144 -100
  279. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.h +0 -10
  280. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +666 -493
  281. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +251 -181
  282. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.h +0 -12
  283. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb.h +327 -197
  284. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.c +92 -48
  285. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.h +0 -3
  286. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +3583 -2532
  287. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +1340 -816
  288. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +0 -60
  289. data/src/core/ext/upb-gen/envoy/config/route/v3/scoped_route.upb.h +111 -82
  290. data/src/core/ext/upb-gen/envoy/config/route/v3/scoped_route.upb_minitable.c +48 -28
  291. data/src/core/ext/upb-gen/envoy/config/route/v3/scoped_route.upb_minitable.h +0 -3
  292. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb.h +548 -410
  293. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.c +214 -148
  294. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.h +0 -12
  295. data/src/core/ext/upb-gen/envoy/config/trace/v3/datadog.upb.h +59 -50
  296. data/src/core/ext/upb-gen/envoy/config/trace/v3/datadog.upb_minitable.c +30 -20
  297. data/src/core/ext/upb-gen/envoy/config/trace/v3/datadog.upb_minitable.h +0 -2
  298. data/src/core/ext/upb-gen/envoy/config/trace/v3/dynamic_ot.upb.h +29 -26
  299. data/src/core/ext/upb-gen/envoy/config/trace/v3/dynamic_ot.upb_minitable.c +17 -11
  300. data/src/core/ext/upb-gen/envoy/config/trace/v3/dynamic_ot.upb_minitable.h +0 -1
  301. data/src/core/ext/upb-gen/envoy/config/trace/v3/http_tracer.upb.h +60 -49
  302. data/src/core/ext/upb-gen/envoy/config/trace/v3/http_tracer.upb_minitable.c +28 -20
  303. data/src/core/ext/upb-gen/envoy/config/trace/v3/http_tracer.upb_minitable.h +0 -2
  304. data/src/core/ext/upb-gen/envoy/config/trace/v3/lightstep.upb.h +50 -36
  305. data/src/core/ext/upb-gen/envoy/config/trace/v3/lightstep.upb_minitable.c +19 -11
  306. data/src/core/ext/upb-gen/envoy/config/trace/v3/lightstep.upb_minitable.h +0 -1
  307. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +82 -63
  308. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +27 -19
  309. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.h +0 -1
  310. data/src/core/ext/upb-gen/envoy/config/trace/v3/service.upb.h +27 -24
  311. data/src/core/ext/upb-gen/envoy/config/trace/v3/service.upb_minitable.c +13 -11
  312. data/src/core/ext/upb-gen/envoy/config/trace/v3/service.upb_minitable.h +0 -1
  313. data/src/core/ext/upb-gen/envoy/config/trace/v3/skywalking.upb.h +70 -58
  314. data/src/core/ext/upb-gen/envoy/config/trace/v3/skywalking.upb_minitable.c +32 -22
  315. data/src/core/ext/upb-gen/envoy/config/trace/v3/skywalking.upb_minitable.h +0 -2
  316. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb.h +2 -5
  317. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.c +1 -1
  318. data/src/core/ext/upb-gen/envoy/config/trace/v3/xray.upb.h +73 -62
  319. data/src/core/ext/upb-gen/envoy/config/trace/v3/xray.upb_minitable.c +39 -25
  320. data/src/core/ext/upb-gen/envoy/config/trace/v3/xray.upb_minitable.h +0 -2
  321. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +49 -45
  322. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +33 -13
  323. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.h +0 -1
  324. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb.h +771 -588
  325. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb_minitable.c +383 -185
  326. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb_minitable.h +0 -16
  327. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +66 -47
  328. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.c +31 -17
  329. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.h +0 -2
  330. data/src/core/ext/upb-gen/envoy/extensions/common/matching/v3/extension_matcher.upb.h +69 -58
  331. data/src/core/ext/upb-gen/envoy/extensions/common/matching/v3/extension_matcher.upb_minitable.c +27 -23
  332. data/src/core/ext/upb-gen/envoy/extensions/common/matching/v3/extension_matcher.upb_minitable.h +0 -2
  333. data/src/core/ext/upb-gen/envoy/extensions/filters/common/fault/v3/fault.upb.h +151 -119
  334. data/src/core/ext/upb-gen/envoy/extensions/filters/common/fault/v3/fault.upb_minitable.c +45 -39
  335. data/src/core/ext/upb-gen/envoy/extensions/filters/common/fault/v3/fault.upb_minitable.h +0 -5
  336. data/src/core/ext/upb-gen/envoy/extensions/filters/common/matcher/action/v3/skip_action.upb.h +19 -17
  337. data/src/core/ext/upb-gen/envoy/extensions/filters/common/matcher/action/v3/skip_action.upb_minitable.c +1 -3
  338. data/src/core/ext/upb-gen/envoy/extensions/filters/common/matcher/action/v3/skip_action.upb_minitable.h +0 -1
  339. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb.h +144 -109
  340. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.c +46 -38
  341. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.h +0 -4
  342. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb.h +184 -139
  343. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.c +65 -35
  344. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.h +0 -3
  345. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +129 -106
  346. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +69 -41
  347. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h +0 -4
  348. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +83 -71
  349. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c +40 -26
  350. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.h +0 -2
  351. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb.h +148 -101
  352. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb_minitable.c +45 -27
  353. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb_minitable.h +0 -2
  354. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +62 -51
  355. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +35 -21
  356. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.h +0 -2
  357. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1362 -1024
  358. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +508 -336
  359. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +0 -22
  360. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb.h +21 -19
  361. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.c +13 -7
  362. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.h +0 -1
  363. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb.h +35 -31
  364. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.c +15 -13
  365. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.h +0 -1
  366. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb.h +27 -24
  367. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.c +13 -11
  368. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.h +0 -1
  369. data/src/core/ext/upb-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.h +27 -24
  370. data/src/core/ext/upb-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb_minitable.c +13 -11
  371. data/src/core/ext/upb-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb_minitable.h +0 -1
  372. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +94 -74
  373. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +35 -23
  374. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.h +0 -1
  375. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +231 -179
  376. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +88 -66
  377. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +0 -6
  378. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +21 -19
  379. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb_minitable.c +13 -7
  380. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb_minitable.h +0 -1
  381. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +63 -56
  382. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb_minitable.c +31 -19
  383. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb_minitable.h +0 -1
  384. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h +27 -24
  385. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb_minitable.c +13 -11
  386. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb_minitable.h +0 -1
  387. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +27 -24
  388. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +13 -11
  389. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h +0 -1
  390. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +2 -5
  391. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb_minitable.c +1 -1
  392. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +538 -364
  393. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +157 -95
  394. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.h +0 -8
  395. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +150 -110
  396. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.c +69 -49
  397. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.h +0 -4
  398. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +517 -389
  399. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.c +182 -116
  400. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.h +0 -7
  401. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +84 -62
  402. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb_minitable.c +30 -22
  403. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb_minitable.h +0 -2
  404. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +340 -256
  405. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +92 -82
  406. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +0 -5
  407. data/src/core/ext/upb-gen/envoy/service/discovery/v3/ads.upb.h +19 -17
  408. data/src/core/ext/upb-gen/envoy/service/discovery/v3/ads.upb_minitable.c +1 -3
  409. data/src/core/ext/upb-gen/envoy/service/discovery/v3/ads.upb_minitable.h +0 -1
  410. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb.h +857 -566
  411. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c +288 -182
  412. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.h +0 -15
  413. data/src/core/ext/upb-gen/envoy/service/load_stats/v3/lrs.upb.h +105 -72
  414. data/src/core/ext/upb-gen/envoy/service/load_stats/v3/lrs.upb_minitable.c +36 -22
  415. data/src/core/ext/upb-gen/envoy/service/load_stats/v3/lrs.upb_minitable.h +0 -2
  416. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb.h +312 -226
  417. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb_minitable.c +132 -78
  418. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb_minitable.h +0 -5
  419. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb.h +82 -61
  420. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c +35 -19
  421. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.h +0 -2
  422. data/src/core/ext/upb-gen/envoy/type/http/v3/path_transformation.upb.h +123 -89
  423. data/src/core/ext/upb-gen/envoy/type/http/v3/path_transformation.upb_minitable.c +25 -25
  424. data/src/core/ext/upb-gen/envoy/type/http/v3/path_transformation.upb_minitable.h +0 -4
  425. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb.h +48 -33
  426. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.c +13 -11
  427. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.h +0 -1
  428. data/src/core/ext/upb-gen/envoy/type/matcher/v3/filter_state.upb.h +42 -36
  429. data/src/core/ext/upb-gen/envoy/type/matcher/v3/filter_state.upb_minitable.c +19 -13
  430. data/src/core/ext/upb-gen/envoy/type/matcher/v3/filter_state.upb_minitable.h +0 -1
  431. data/src/core/ext/upb-gen/envoy/type/matcher/v3/http_inputs.upb.h +101 -79
  432. data/src/core/ext/upb-gen/envoy/type/matcher/v3/http_inputs.upb_minitable.c +61 -31
  433. data/src/core/ext/upb-gen/envoy/type/matcher/v3/http_inputs.upb_minitable.h +0 -5
  434. data/src/core/ext/upb-gen/envoy/type/matcher/v3/metadata.upb.h +83 -60
  435. data/src/core/ext/upb-gen/envoy/type/matcher/v3/metadata.upb_minitable.c +37 -19
  436. data/src/core/ext/upb-gen/envoy/type/matcher/v3/metadata.upb_minitable.h +0 -2
  437. data/src/core/ext/upb-gen/envoy/type/matcher/v3/node.upb.h +56 -40
  438. data/src/core/ext/upb-gen/envoy/type/matcher/v3/node.upb_minitable.c +15 -13
  439. data/src/core/ext/upb-gen/envoy/type/matcher/v3/node.upb_minitable.h +0 -1
  440. data/src/core/ext/upb-gen/envoy/type/matcher/v3/number.upb.h +34 -29
  441. data/src/core/ext/upb-gen/envoy/type/matcher/v3/number.upb_minitable.c +13 -11
  442. data/src/core/ext/upb-gen/envoy/type/matcher/v3/number.upb_minitable.h +0 -1
  443. data/src/core/ext/upb-gen/envoy/type/matcher/v3/path.upb.h +32 -27
  444. data/src/core/ext/upb-gen/envoy/type/matcher/v3/path.upb_minitable.c +13 -11
  445. data/src/core/ext/upb-gen/envoy/type/matcher/v3/path.upb_minitable.h +0 -1
  446. data/src/core/ext/upb-gen/envoy/type/matcher/v3/regex.upb.h +88 -71
  447. data/src/core/ext/upb-gen/envoy/type/matcher/v3/regex.upb_minitable.c +48 -30
  448. data/src/core/ext/upb-gen/envoy/type/matcher/v3/regex.upb_minitable.h +0 -3
  449. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb.h +37 -30
  450. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.c +1 -5
  451. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.h +0 -2
  452. data/src/core/ext/upb-gen/envoy/type/matcher/v3/string.upb.h +95 -71
  453. data/src/core/ext/upb-gen/envoy/type/matcher/v3/string.upb_minitable.c +36 -22
  454. data/src/core/ext/upb-gen/envoy/type/matcher/v3/string.upb_minitable.h +0 -2
  455. data/src/core/ext/upb-gen/envoy/type/matcher/v3/struct.upb.h +79 -56
  456. data/src/core/ext/upb-gen/envoy/type/matcher/v3/struct.upb_minitable.c +26 -18
  457. data/src/core/ext/upb-gen/envoy/type/matcher/v3/struct.upb_minitable.h +0 -2
  458. data/src/core/ext/upb-gen/envoy/type/matcher/v3/value.upb.h +164 -124
  459. data/src/core/ext/upb-gen/envoy/type/matcher/v3/value.upb_minitable.c +54 -40
  460. data/src/core/ext/upb-gen/envoy/type/matcher/v3/value.upb_minitable.h +0 -4
  461. data/src/core/ext/upb-gen/envoy/type/metadata/v3/metadata.upb.h +200 -147
  462. data/src/core/ext/upb-gen/envoy/type/metadata/v3/metadata.upb_minitable.c +47 -41
  463. data/src/core/ext/upb-gen/envoy/type/metadata/v3/metadata.upb_minitable.h +0 -7
  464. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb.h +160 -130
  465. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.c +89 -47
  466. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.h +0 -5
  467. data/src/core/ext/upb-gen/envoy/type/v3/hash_policy.upb.h +78 -62
  468. data/src/core/ext/upb-gen/envoy/type/v3/hash_policy.upb_minitable.c +26 -20
  469. data/src/core/ext/upb-gen/envoy/type/v3/hash_policy.upb_minitable.h +0 -3
  470. data/src/core/ext/upb-gen/envoy/type/v3/http.upb.h +2 -5
  471. data/src/core/ext/upb-gen/envoy/type/v3/http.upb_minitable.c +1 -1
  472. data/src/core/ext/upb-gen/envoy/type/v3/http_status.upb.h +21 -19
  473. data/src/core/ext/upb-gen/envoy/type/v3/http_status.upb_minitable.c +13 -7
  474. data/src/core/ext/upb-gen/envoy/type/v3/http_status.upb_minitable.h +0 -1
  475. data/src/core/ext/upb-gen/envoy/type/v3/percent.upb.h +43 -36
  476. data/src/core/ext/upb-gen/envoy/type/v3/percent.upb_minitable.c +22 -12
  477. data/src/core/ext/upb-gen/envoy/type/v3/percent.upb_minitable.h +0 -2
  478. data/src/core/ext/upb-gen/envoy/type/v3/range.upb.h +67 -55
  479. data/src/core/ext/upb-gen/envoy/type/v3/range.upb_minitable.c +36 -18
  480. data/src/core/ext/upb-gen/envoy/type/v3/range.upb_minitable.h +0 -3
  481. data/src/core/ext/upb-gen/envoy/type/v3/ratelimit_strategy.upb.h +62 -51
  482. data/src/core/ext/upb-gen/envoy/type/v3/ratelimit_strategy.upb_minitable.c +33 -19
  483. data/src/core/ext/upb-gen/envoy/type/v3/ratelimit_strategy.upb_minitable.h +0 -2
  484. data/src/core/ext/upb-gen/envoy/type/v3/ratelimit_unit.upb.h +2 -5
  485. data/src/core/ext/upb-gen/envoy/type/v3/ratelimit_unit.upb_minitable.c +1 -1
  486. data/src/core/ext/upb-gen/envoy/type/v3/semantic_version.upb.h +25 -23
  487. data/src/core/ext/upb-gen/envoy/type/v3/semantic_version.upb_minitable.c +15 -7
  488. data/src/core/ext/upb-gen/envoy/type/v3/semantic_version.upb_minitable.h +0 -1
  489. data/src/core/ext/upb-gen/envoy/type/v3/token_bucket.upb.h +37 -33
  490. data/src/core/ext/upb-gen/envoy/type/v3/token_bucket.upb_minitable.c +19 -13
  491. data/src/core/ext/upb-gen/envoy/type/v3/token_bucket.upb_minitable.h +0 -1
  492. data/src/core/ext/upb-gen/google/api/annotations.upb.h +15 -13
  493. data/src/core/ext/upb-gen/google/api/annotations.upb_minitable.c +22 -7
  494. data/src/core/ext/upb-gen/google/api/annotations.upb_minitable.h +1 -1
  495. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb.h +619 -430
  496. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb_minitable.c +260 -168
  497. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb_minitable.h +0 -13
  498. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb.h +734 -518
  499. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb_minitable.c +312 -182
  500. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb_minitable.h +0 -16
  501. data/src/core/ext/upb-gen/google/api/http.upb.h +146 -105
  502. data/src/core/ext/upb-gen/google/api/http.upb_minitable.c +65 -29
  503. data/src/core/ext/upb-gen/google/api/http.upb_minitable.h +0 -3
  504. data/src/core/ext/upb-gen/google/api/httpbody.upb.h +52 -37
  505. data/src/core/ext/upb-gen/google/api/httpbody.upb_minitable.c +19 -11
  506. data/src/core/ext/upb-gen/google/api/httpbody.upb_minitable.h +0 -1
  507. data/src/core/ext/upb-gen/google/protobuf/any.upb.h +23 -21
  508. data/src/core/ext/upb-gen/google/protobuf/any.upb_minitable.c +15 -7
  509. data/src/core/ext/upb-gen/google/protobuf/any.upb_minitable.h +0 -1
  510. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb.h +2236 -1514
  511. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.c +824 -406
  512. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.h +0 -34
  513. data/src/core/ext/upb-gen/google/protobuf/duration.upb.h +23 -21
  514. data/src/core/ext/upb-gen/google/protobuf/duration.upb_minitable.c +15 -7
  515. data/src/core/ext/upb-gen/google/protobuf/duration.upb_minitable.h +0 -1
  516. data/src/core/ext/upb-gen/google/protobuf/empty.upb.h +19 -17
  517. data/src/core/ext/upb-gen/google/protobuf/empty.upb_minitable.c +1 -3
  518. data/src/core/ext/upb-gen/google/protobuf/empty.upb_minitable.h +0 -1
  519. data/src/core/ext/upb-gen/google/protobuf/struct.upb.h +149 -100
  520. data/src/core/ext/upb-gen/google/protobuf/struct.upb_minitable.c +59 -43
  521. data/src/core/ext/upb-gen/google/protobuf/struct.upb_minitable.h +0 -4
  522. data/src/core/ext/upb-gen/google/protobuf/timestamp.upb.h +23 -21
  523. data/src/core/ext/upb-gen/google/protobuf/timestamp.upb_minitable.c +15 -7
  524. data/src/core/ext/upb-gen/google/protobuf/timestamp.upb_minitable.h +0 -1
  525. data/src/core/ext/upb-gen/google/protobuf/wrappers.upb.h +181 -139
  526. data/src/core/ext/upb-gen/google/protobuf/wrappers.upb_minitable.c +99 -53
  527. data/src/core/ext/upb-gen/google/protobuf/wrappers.upb_minitable.h +0 -9
  528. data/src/core/ext/upb-gen/google/rpc/status.upb.h +52 -37
  529. data/src/core/ext/upb-gen/google/rpc/status.upb_minitable.c +19 -11
  530. data/src/core/ext/upb-gen/google/rpc/status.upb_minitable.h +0 -1
  531. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb.h +1553 -1157
  532. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.c +712 -410
  533. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.h +0 -39
  534. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb.h +189 -125
  535. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb_minitable.c +59 -35
  536. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb_minitable.h +0 -3
  537. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb.h +454 -343
  538. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c +204 -130
  539. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.h +0 -11
  540. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb.h +369 -243
  541. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.c +109 -79
  542. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.h +0 -7
  543. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb.h +256 -175
  544. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.c +122 -68
  545. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.h +0 -8
  546. data/src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb.h +71 -51
  547. data/src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb_minitable.c +39 -19
  548. data/src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb_minitable.h +0 -2
  549. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +583 -407
  550. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +259 -145
  551. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.h +0 -12
  552. data/src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb.h +114 -84
  553. data/src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb_minitable.c +52 -30
  554. data/src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb_minitable.h +0 -4
  555. data/src/core/ext/upb-gen/src/proto/grpc/health/v1/health.upb.h +41 -34
  556. data/src/core/ext/upb-gen/src/proto/grpc/health/v1/health.upb_minitable.c +25 -13
  557. data/src/core/ext/upb-gen/src/proto/grpc/health/v1/health.upb_minitable.h +0 -2
  558. data/src/core/ext/upb-gen/src/proto/grpc/lb/v1/load_balancer.upb.h +309 -230
  559. data/src/core/ext/upb-gen/src/proto/grpc/lb/v1/load_balancer.upb_minitable.c +123 -79
  560. data/src/core/ext/upb-gen/src/proto/grpc/lb/v1/load_balancer.upb_minitable.h +0 -9
  561. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls.upb.h +98 -63
  562. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls.upb_minitable.c +51 -23
  563. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls.upb_minitable.h +0 -3
  564. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls_config.upb.h +505 -312
  565. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls_config.upb_minitable.c +159 -87
  566. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls_config.upb_minitable.h +0 -9
  567. data/src/core/ext/upb-gen/udpa/annotations/migrate.upb.h +128 -91
  568. data/src/core/ext/upb-gen/udpa/annotations/migrate.upb_minitable.c +82 -41
  569. data/src/core/ext/upb-gen/udpa/annotations/migrate.upb_minitable.h +5 -8
  570. data/src/core/ext/upb-gen/udpa/annotations/security.upb.h +36 -29
  571. data/src/core/ext/upb-gen/udpa/annotations/security.upb_minitable.c +36 -13
  572. data/src/core/ext/upb-gen/udpa/annotations/security.upb_minitable.h +1 -2
  573. data/src/core/ext/upb-gen/udpa/annotations/sensitive.upb.h +13 -11
  574. data/src/core/ext/upb-gen/udpa/annotations/sensitive.upb_minitable.c +22 -7
  575. data/src/core/ext/upb-gen/udpa/annotations/sensitive.upb_minitable.h +1 -1
  576. data/src/core/ext/upb-gen/udpa/annotations/status.upb.h +36 -29
  577. data/src/core/ext/upb-gen/udpa/annotations/status.upb_minitable.c +36 -13
  578. data/src/core/ext/upb-gen/udpa/annotations/status.upb_minitable.h +1 -2
  579. data/src/core/ext/upb-gen/udpa/annotations/versioning.upb.h +34 -27
  580. data/src/core/ext/upb-gen/udpa/annotations/versioning.upb_minitable.c +34 -13
  581. data/src/core/ext/upb-gen/udpa/annotations/versioning.upb_minitable.h +1 -2
  582. data/src/core/ext/upb-gen/validate/validate.upb.h +1682 -1130
  583. data/src/core/ext/upb-gen/validate/validate.upb_minitable.c +587 -247
  584. data/src/core/ext/upb-gen/validate/validate.upb_minitable.h +4 -27
  585. data/src/core/ext/upb-gen/xds/annotations/v3/migrate.upb.h +128 -91
  586. data/src/core/ext/upb-gen/xds/annotations/v3/migrate.upb_minitable.c +82 -41
  587. data/src/core/ext/upb-gen/xds/annotations/v3/migrate.upb_minitable.h +5 -8
  588. data/src/core/ext/upb-gen/xds/annotations/v3/security.upb.h +36 -29
  589. data/src/core/ext/upb-gen/xds/annotations/v3/security.upb_minitable.c +36 -13
  590. data/src/core/ext/upb-gen/xds/annotations/v3/security.upb_minitable.h +1 -2
  591. data/src/core/ext/upb-gen/xds/annotations/v3/sensitive.upb.h +13 -11
  592. data/src/core/ext/upb-gen/xds/annotations/v3/sensitive.upb_minitable.c +22 -7
  593. data/src/core/ext/upb-gen/xds/annotations/v3/sensitive.upb_minitable.h +1 -1
  594. data/src/core/ext/upb-gen/xds/annotations/v3/status.upb.h +122 -90
  595. data/src/core/ext/upb-gen/xds/annotations/v3/status.upb_minitable.c +82 -39
  596. data/src/core/ext/upb-gen/xds/annotations/v3/status.upb_minitable.h +3 -7
  597. data/src/core/ext/upb-gen/xds/annotations/v3/versioning.upb.h +34 -27
  598. data/src/core/ext/upb-gen/xds/annotations/v3/versioning.upb_minitable.c +34 -13
  599. data/src/core/ext/upb-gen/xds/annotations/v3/versioning.upb_minitable.h +1 -2
  600. data/src/core/ext/upb-gen/xds/core/v3/authority.upb.h +21 -19
  601. data/src/core/ext/upb-gen/xds/core/v3/authority.upb_minitable.c +13 -7
  602. data/src/core/ext/upb-gen/xds/core/v3/authority.upb_minitable.h +0 -1
  603. data/src/core/ext/upb-gen/xds/core/v3/cidr.upb.h +29 -26
  604. data/src/core/ext/upb-gen/xds/core/v3/cidr.upb_minitable.c +17 -11
  605. data/src/core/ext/upb-gen/xds/core/v3/cidr.upb_minitable.h +0 -1
  606. data/src/core/ext/upb-gen/xds/core/v3/collection_entry.upb.h +70 -58
  607. data/src/core/ext/upb-gen/xds/core/v3/collection_entry.upb_minitable.c +32 -22
  608. data/src/core/ext/upb-gen/xds/core/v3/collection_entry.upb_minitable.h +0 -2
  609. data/src/core/ext/upb-gen/xds/core/v3/context_params.upb.h +53 -34
  610. data/src/core/ext/upb-gen/xds/core/v3/context_params.upb_minitable.c +26 -16
  611. data/src/core/ext/upb-gen/xds/core/v3/context_params.upb_minitable.h +0 -2
  612. data/src/core/ext/upb-gen/xds/core/v3/extension.upb.h +29 -26
  613. data/src/core/ext/upb-gen/xds/core/v3/extension.upb_minitable.c +17 -11
  614. data/src/core/ext/upb-gen/xds/core/v3/extension.upb_minitable.h +0 -1
  615. data/src/core/ext/upb-gen/xds/core/v3/resource.upb.h +37 -33
  616. data/src/core/ext/upb-gen/xds/core/v3/resource.upb_minitable.c +22 -14
  617. data/src/core/ext/upb-gen/xds/core/v3/resource.upb_minitable.h +0 -1
  618. data/src/core/ext/upb-gen/xds/core/v3/resource_locator.upb.h +102 -76
  619. data/src/core/ext/upb-gen/xds/core/v3/resource_locator.upb_minitable.c +43 -23
  620. data/src/core/ext/upb-gen/xds/core/v3/resource_locator.upb_minitable.h +0 -2
  621. data/src/core/ext/upb-gen/xds/core/v3/resource_name.upb.h +33 -30
  622. data/src/core/ext/upb-gen/xds/core/v3/resource_name.upb_minitable.c +19 -11
  623. data/src/core/ext/upb-gen/xds/core/v3/resource_name.upb_minitable.h +0 -1
  624. data/src/core/ext/upb-gen/xds/data/orca/v3/orca_load_report.upb.h +136 -83
  625. data/src/core/ext/upb-gen/xds/data/orca/v3/orca_load_report.upb_minitable.c +41 -33
  626. data/src/core/ext/upb-gen/xds/data/orca/v3/orca_load_report.upb_minitable.h +0 -4
  627. data/src/core/ext/upb-gen/xds/service/orca/v3/orca.upb.h +46 -32
  628. data/src/core/ext/upb-gen/xds/service/orca/v3/orca.upb_minitable.c +20 -12
  629. data/src/core/ext/upb-gen/xds/service/orca/v3/orca.upb_minitable.h +0 -1
  630. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb.h +29 -26
  631. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.c +20 -12
  632. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.h +0 -1
  633. data/src/core/ext/upb-gen/xds/type/matcher/v3/domain.upb.h +93 -61
  634. data/src/core/ext/upb-gen/xds/type/matcher/v3/domain.upb_minitable.c +28 -20
  635. data/src/core/ext/upb-gen/xds/type/matcher/v3/domain.upb_minitable.h +0 -2
  636. data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb.h +19 -17
  637. data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb_minitable.c +1 -3
  638. data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb_minitable.h +0 -1
  639. data/src/core/ext/upb-gen/xds/type/matcher/v3/ip.upb.h +105 -71
  640. data/src/core/ext/upb-gen/xds/type/matcher/v3/ip.upb_minitable.c +32 -22
  641. data/src/core/ext/upb-gen/xds/type/matcher/v3/ip.upb_minitable.h +0 -2
  642. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb.h +430 -314
  643. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.c +153 -123
  644. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.h +0 -10
  645. data/src/core/ext/upb-gen/xds/type/matcher/v3/range.upb.h +307 -199
  646. data/src/core/ext/upb-gen/xds/type/matcher/v3/range.upb_minitable.c +74 -62
  647. data/src/core/ext/upb-gen/xds/type/matcher/v3/range.upb_minitable.h +0 -6
  648. data/src/core/ext/upb-gen/xds/type/matcher/v3/regex.upb.h +52 -42
  649. data/src/core/ext/upb-gen/xds/type/matcher/v3/regex.upb_minitable.c +19 -13
  650. data/src/core/ext/upb-gen/xds/type/matcher/v3/regex.upb_minitable.h +0 -2
  651. data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb.h +95 -71
  652. data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb_minitable.c +36 -22
  653. data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb_minitable.h +0 -2
  654. data/src/core/ext/upb-gen/xds/type/v3/cel.upb.h +92 -77
  655. data/src/core/ext/upb-gen/xds/type/v3/cel.upb_minitable.c +42 -28
  656. data/src/core/ext/upb-gen/xds/type/v3/cel.upb_minitable.h +0 -2
  657. data/src/core/ext/upb-gen/xds/type/v3/range.upb.h +67 -55
  658. data/src/core/ext/upb-gen/xds/type/v3/range.upb_minitable.c +36 -18
  659. data/src/core/ext/upb-gen/xds/type/v3/range.upb_minitable.h +0 -3
  660. data/src/core/ext/upb-gen/xds/type/v3/typed_struct.upb.h +29 -26
  661. data/src/core/ext/upb-gen/xds/type/v3/typed_struct.upb_minitable.c +17 -11
  662. data/src/core/ext/upb-gen/xds/type/v3/typed_struct.upb_minitable.h +0 -1
  663. data/src/core/ext/upbdefs-gen/google/protobuf/descriptor.upbdefs.c +885 -855
  664. data/src/core/filter/composite/composite_filter.cc +10 -3
  665. data/src/core/filter/composite/composite_filter.h +11 -1
  666. data/src/core/filter/filter_args.h +4 -22
  667. data/src/core/handshaker/handshaker.cc +10 -2
  668. data/src/core/handshaker/security/secure_endpoint.cc +60 -5
  669. data/src/core/lib/channel/channel_args.h +12 -6
  670. data/src/core/lib/channel/channel_stack.cc +1 -2
  671. data/src/core/lib/channel/channel_stack.h +1 -7
  672. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -1
  673. data/src/core/lib/channel/channel_stack_builder_impl.h +0 -7
  674. data/src/core/lib/channel/promise_based_filter.cc +90 -4
  675. data/src/core/lib/channel/promise_based_filter.h +241 -188
  676. data/src/core/lib/event_engine/extensions/chaotic_good_extension.h +0 -13
  677. data/src/core/lib/event_engine/extensions/receive_coalescing_extension.h +44 -0
  678. data/src/core/lib/event_engine/extensions/tcp_trace.h +1 -1
  679. data/src/core/lib/event_engine/posix.h +2 -0
  680. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +2 -1
  681. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +11 -8
  682. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +9 -18
  683. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -1
  684. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +2 -1
  685. data/src/core/lib/event_engine/posix_engine/posix_interface_posix.cc +10 -10
  686. data/src/core/lib/event_engine/posix_engine/posix_write_event_sink.h +1 -1
  687. data/src/core/lib/event_engine/shim.cc +2 -16
  688. data/src/core/lib/event_engine/shim.h +0 -4
  689. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +1 -1
  690. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.cc +5 -4
  691. data/src/core/lib/experiments/experiments.cc +303 -183
  692. data/src/core/lib/experiments/experiments.h +166 -90
  693. data/src/core/lib/iomgr/buffer_list.h +1 -1
  694. data/src/core/lib/iomgr/error.cc +3 -73
  695. data/src/core/lib/iomgr/error.h +8 -6
  696. data/src/core/lib/iomgr/error_cfstream.cc +1 -2
  697. data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -7
  698. data/src/core/lib/iomgr/ev_poll_posix.cc +2 -6
  699. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -2
  700. data/src/core/lib/iomgr/tcp_posix.cc +4 -7
  701. data/src/core/lib/iomgr/tcp_server_posix.cc +3 -3
  702. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -1
  703. data/src/core/lib/promise/detail/promise_factory.h +8 -8
  704. data/src/core/lib/promise/interceptor_list.h +1 -1
  705. data/src/core/lib/promise/try_seq.h +2 -2
  706. data/src/core/lib/resource_quota/telemetry.cc +54 -0
  707. data/src/core/lib/resource_quota/telemetry.h +5 -23
  708. data/src/core/lib/security/authorization/audit_logging.cc +2 -2
  709. data/src/core/lib/security/authorization/audit_logging.h +3 -3
  710. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +11 -13
  711. data/src/core/lib/security/authorization/grpc_authorization_engine.h +1 -1
  712. data/src/core/lib/security/authorization/matchers.cc +20 -20
  713. data/src/core/lib/security/authorization/matchers.h +15 -16
  714. data/src/core/lib/security/authorization/rbac_policy.h +1 -1
  715. data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
  716. data/src/core/lib/security/authorization/stdout_logger.h +6 -5
  717. data/src/core/lib/surface/call.cc +6 -9
  718. data/src/core/lib/surface/call.h +11 -0
  719. data/src/core/lib/surface/channel.cc +21 -2
  720. data/src/core/lib/surface/channel.h +14 -6
  721. data/src/core/lib/surface/filter_stack_call.cc +10 -29
  722. data/src/core/lib/surface/legacy_channel.cc +7 -7
  723. data/src/core/lib/surface/legacy_channel.h +3 -1
  724. data/src/core/lib/surface/version.cc +2 -2
  725. data/src/core/lib/transport/bdp_estimator.cc +13 -13
  726. data/src/core/lib/transport/bdp_estimator.h +9 -5
  727. data/src/core/lib/transport/error_utils.cc +26 -138
  728. data/src/core/lib/transport/promise_endpoint.h +8 -8
  729. data/src/core/lib/transport/transport.h +31 -4
  730. data/src/core/load_balancing/grpclb/grpclb.cc +2 -1
  731. data/src/core/load_balancing/pick_first/pick_first.cc +33 -2
  732. data/src/core/load_balancing/pick_first/pick_first.h +6 -0
  733. data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -10
  734. data/src/core/load_balancing/rls/rls.cc +2 -1
  735. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +141 -74
  736. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +88 -0
  737. data/src/core/load_balancing/xds/cds.cc +80 -56
  738. data/src/core/load_balancing/xds/cds.h +21 -0
  739. data/src/core/mitigation_engine/mitigation.h +53 -0
  740. data/src/core/mitigation_engine/mitigation_engine.h +81 -0
  741. data/src/core/mitigation_engine/mitigation_provider.h +62 -0
  742. data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -2
  743. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -5
  744. data/src/core/resolver/dns/dns_resolver_plugin.cc +1 -6
  745. data/src/core/resolver/xds/xds_resolver.cc +37 -144
  746. data/src/core/server/server.cc +40 -18
  747. data/src/core/server/server.h +26 -18
  748. data/src/core/server/server_config_selector.h +5 -4
  749. data/src/core/server/server_config_selector_filter.cc +135 -26
  750. data/src/core/server/server_config_selector_filter.h +1 -0
  751. data/src/core/server/xds_server_config_fetcher.cc +687 -692
  752. data/src/core/server/xds_server_config_fetcher_legacy.cc +1336 -0
  753. data/src/core/telemetry/call_tracer.cc +49 -2
  754. data/src/core/telemetry/call_tracer.h +1 -0
  755. data/src/core/telemetry/histogram.h +10 -89
  756. data/src/core/telemetry/instrument.h +42 -28
  757. data/src/core/telemetry/tcp_tracer.h +38 -0
  758. data/src/core/transport/message_size_service_config.cc +123 -0
  759. data/src/core/transport/message_size_service_config.h +85 -0
  760. data/src/core/transport/session_endpoint.cc +29 -4
  761. data/src/core/transport/session_endpoint.h +4 -0
  762. data/src/core/tsi/alts/crypt/gsec.h +4 -2
  763. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  764. data/src/core/tsi/ssl_telemetry_utils.cc +343 -0
  765. data/src/core/tsi/ssl_telemetry_utils.h +74 -0
  766. data/src/core/tsi/ssl_transport_security.cc +583 -305
  767. data/src/core/tsi/ssl_transport_security.h +22 -6
  768. data/src/core/tsi/ssl_transport_security_utils.cc +2 -0
  769. data/src/core/tsi/transport_security.h +7 -0
  770. data/src/core/util/http_client/httpcli.cc +1 -4
  771. data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
  772. data/src/core/util/http_client/parser.cc +1 -1
  773. data/src/core/util/lru_cache.h +2 -0
  774. data/src/core/util/ref_counted_string.h +1 -1
  775. data/src/core/util/status_helper.cc +71 -192
  776. data/src/core/util/status_helper.h +16 -21
  777. data/src/core/util/tchar.cc +13 -7
  778. data/src/core/util/trie_lookup.h +1 -1
  779. data/src/core/xds/grpc/blackboard.cc +58 -0
  780. data/src/core/{filter → xds/grpc}/blackboard.h +30 -11
  781. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +2 -11
  782. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -7
  783. data/src/core/xds/grpc/xds_cluster_parser.cc +5 -16
  784. data/src/core/xds/grpc/xds_common_types.cc +96 -0
  785. data/src/core/xds/grpc/xds_common_types.h +35 -7
  786. data/src/core/xds/grpc/xds_common_types_parser.cc +205 -134
  787. data/src/core/xds/grpc/xds_common_types_parser.h +18 -1
  788. data/src/core/xds/grpc/xds_endpoint_parser.cc +7 -18
  789. data/src/core/xds/grpc/xds_http_composite_filter.cc +34 -18
  790. data/src/core/xds/grpc/xds_http_composite_filter.h +6 -3
  791. data/src/core/xds/grpc/xds_http_fault_filter.cc +0 -149
  792. data/src/core/xds/grpc/xds_http_fault_filter.h +19 -8
  793. data/src/core/xds/grpc/xds_http_filter.cc +2 -1
  794. data/src/core/xds/grpc/xds_http_filter.h +6 -16
  795. data/src/core/xds/grpc/xds_http_filter_registry.cc +2 -12
  796. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +25 -119
  797. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +27 -15
  798. data/src/core/xds/grpc/xds_http_rbac_filter.cc +3 -12
  799. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +0 -149
  800. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +19 -8
  801. data/src/core/xds/grpc/xds_lb_policy_registry.cc +18 -0
  802. data/src/core/xds/grpc/xds_listener_parser.cc +13 -9
  803. data/src/core/xds/grpc/xds_metadata_parser.cc +0 -2
  804. data/src/core/xds/grpc/xds_route_config.h +1 -1
  805. data/src/core/xds/grpc/xds_route_config_parser.cc +10 -16
  806. data/src/core/xds/grpc/xds_routing.cc +115 -90
  807. data/src/core/xds/grpc/xds_routing.h +73 -24
  808. data/src/core/xds/grpc/xds_server_grpc.cc +22 -13
  809. data/src/core/xds/grpc/xds_server_grpc.h +16 -2
  810. data/src/core/xds/grpc/xds_server_grpc_interface.h +10 -0
  811. data/src/core/xds/grpc/xds_transport_grpc.cc +123 -18
  812. data/src/core/xds/grpc/xds_transport_grpc.h +28 -4
  813. data/src/core/xds/xds_client/lrs_client.cc +4 -8
  814. data/src/core/xds/xds_client/xds_bootstrap.cc +4 -16
  815. data/src/core/xds/xds_client/xds_client.cc +2 -15
  816. data/src/core/xds/xds_client/xds_transport.h +3 -0
  817. data/src/ruby/ext/grpc/rb_byte_buffer.c +1 -0
  818. data/src/ruby/ext/grpc/rb_call.c +3 -0
  819. data/src/ruby/ext/grpc/rb_call_credentials.c +1 -0
  820. data/src/ruby/ext/grpc/rb_channel.c +1 -0
  821. data/src/ruby/ext/grpc/rb_channel_args.c +1 -0
  822. data/src/ruby/ext/grpc/rb_channel_credentials.c +1 -0
  823. data/src/ruby/ext/grpc/rb_completion_queue.c +1 -0
  824. data/src/ruby/ext/grpc/rb_compression_options.c +1 -0
  825. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -4
  826. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -6
  827. data/src/ruby/ext/grpc/rb_server.c +1 -0
  828. data/src/ruby/ext/grpc/rb_server_credentials.c +1 -0
  829. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +1 -0
  830. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +1 -0
  831. data/src/ruby/lib/grpc/core/call_credentials.rb +86 -0
  832. data/src/ruby/lib/grpc/core/channel_credentials.rb +69 -0
  833. data/src/ruby/lib/grpc/core/credentials_helper.rb +126 -0
  834. data/src/ruby/lib/grpc/generic/client_stub.rb +86 -73
  835. data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
  836. data/src/ruby/lib/grpc/version.rb +1 -1
  837. data/src/ruby/lib/grpc.rb +25 -0
  838. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +1 -1
  839. data/src/ruby/spec/call_credentials_spec.rb +52 -2
  840. data/src/ruby/spec/credentials_helper_spec.rb +80 -0
  841. data/src/ruby/spec/generic/client_stub_spec.rb +27 -4
  842. data/src/ruby/spec/generic/server_interceptors_spec.rb +17 -3
  843. data/third_party/upb/upb/base/error_handler.h +79 -0
  844. data/third_party/upb/upb/base/internal/log2.h +29 -5
  845. data/third_party/upb/upb/generated_code_support.h +1 -0
  846. data/third_party/upb/upb/hash/common.c +129 -14
  847. data/third_party/upb/upb/hash/common.h +1 -1
  848. data/third_party/upb/upb/hash/ext_table.h +65 -0
  849. data/third_party/upb/upb/lex/strtod.c +14 -5
  850. data/third_party/upb/upb/mem/arena.c +113 -95
  851. data/third_party/upb/upb/mem/internal/arena.h +13 -8
  852. data/third_party/upb/upb/message/accessors.c +2 -3
  853. data/third_party/upb/upb/message/accessors.h +32 -12
  854. data/third_party/upb/upb/message/array.c +51 -2
  855. data/third_party/upb/upb/message/array.h +10 -0
  856. data/third_party/upb/upb/message/copy.c +18 -34
  857. data/third_party/upb/upb/message/internal/accessors.h +15 -49
  858. data/third_party/upb/upb/message/internal/array.h +1 -1
  859. data/third_party/upb/upb/message/internal/map.h +1 -1
  860. data/third_party/upb/upb/message/internal/message.c +8 -1
  861. data/third_party/upb/upb/message/internal/message.h +40 -10
  862. data/third_party/upb/upb/message/message.c +3 -2
  863. data/third_party/upb/upb/message/value.h +0 -6
  864. data/third_party/upb/upb/mini_descriptor/decode.c +78 -59
  865. data/third_party/upb/upb/mini_descriptor/link.c +8 -6
  866. data/third_party/upb/upb/mini_table/extension_registry.c +17 -49
  867. data/third_party/upb/upb/mini_table/extension_registry.h +5 -17
  868. data/third_party/upb/upb/mini_table/generated_registry.c +180 -0
  869. data/third_party/upb/upb/mini_table/generated_registry.h +66 -0
  870. data/third_party/upb/upb/mini_table/internal/extension.h +5 -3
  871. data/third_party/upb/upb/mini_table/internal/field.h +7 -5
  872. data/third_party/upb/upb/mini_table/internal/generated_registry.h +37 -0
  873. data/third_party/upb/upb/mini_table/internal/message.c +0 -18
  874. data/third_party/upb/upb/mini_table/internal/message.h +24 -41
  875. data/third_party/upb/upb/mini_table/internal/size_log2.h +2 -1
  876. data/third_party/upb/upb/mini_table/internal/sub.h +2 -5
  877. data/third_party/upb/upb/mini_table/message.h +34 -13
  878. data/third_party/upb/upb/port/atomic.h +180 -74
  879. data/third_party/upb/upb/port/def.inc +194 -29
  880. data/third_party/upb/upb/port/sanitizers.h +15 -0
  881. data/third_party/upb/upb/port/undef.inc +6 -2
  882. data/third_party/upb/upb/reflection/common.h +0 -6
  883. data/third_party/upb/upb/reflection/def.hpp +8 -12
  884. data/third_party/upb/upb/reflection/def_pool.c +85 -33
  885. data/third_party/upb/upb/reflection/def_pool.h +38 -8
  886. data/third_party/upb/upb/reflection/def_type.h +3 -0
  887. data/third_party/upb/upb/reflection/enum_def.c +45 -33
  888. data/third_party/upb/upb/reflection/enum_def.h +8 -4
  889. data/third_party/upb/upb/reflection/enum_reserved_range.c +7 -3
  890. data/third_party/upb/upb/reflection/enum_value_def.c +14 -29
  891. data/third_party/upb/upb/reflection/enum_value_def.h +5 -4
  892. data/third_party/upb/upb/reflection/extension_range.c +15 -14
  893. data/third_party/upb/upb/reflection/extension_range.h +7 -4
  894. data/third_party/upb/upb/reflection/field_def.c +114 -96
  895. data/third_party/upb/upb/reflection/field_def.h +3 -3
  896. data/third_party/upb/upb/reflection/file_def.c +71 -65
  897. data/third_party/upb/upb/reflection/file_def.h +4 -5
  898. data/third_party/upb/upb/reflection/internal/def_builder.c +22 -14
  899. data/third_party/upb/upb/reflection/internal/def_builder.h +44 -38
  900. data/third_party/upb/upb/reflection/internal/def_pool.h +5 -1
  901. data/third_party/upb/upb/reflection/internal/enum_def.h +6 -4
  902. data/third_party/upb/upb/reflection/internal/enum_reserved_range.h +3 -2
  903. data/third_party/upb/upb/reflection/internal/enum_value_def.h +7 -4
  904. data/third_party/upb/upb/reflection/internal/extension_range.h +4 -3
  905. data/third_party/upb/upb/reflection/internal/field_def.h +15 -12
  906. data/third_party/upb/upb/reflection/internal/file_def.h +8 -1
  907. data/third_party/upb/upb/reflection/internal/message_def.h +10 -7
  908. data/third_party/upb/upb/reflection/internal/message_reserved_range.h +3 -1
  909. data/third_party/upb/upb/reflection/internal/method_def.h +6 -6
  910. data/third_party/upb/upb/reflection/internal/oneof_def.h +6 -6
  911. data/third_party/upb/upb/reflection/internal/service_def.h +9 -6
  912. data/third_party/upb/upb/reflection/internal/upb_edition_defaults.h +1 -1
  913. data/third_party/upb/upb/reflection/message_def.c +46 -53
  914. data/third_party/upb/upb/reflection/message_def.h +6 -7
  915. data/third_party/upb/upb/reflection/message_reserved_range.c +7 -6
  916. data/third_party/upb/upb/reflection/method_def.c +22 -20
  917. data/third_party/upb/upb/reflection/method_def.h +4 -4
  918. data/third_party/upb/upb/reflection/oneof_def.c +17 -15
  919. data/third_party/upb/upb/reflection/oneof_def.h +6 -3
  920. data/third_party/upb/upb/reflection/service_def.c +50 -23
  921. data/third_party/upb/upb/reflection/service_def.h +7 -4
  922. data/third_party/upb/upb/text/internal/encode.c +7 -10
  923. data/third_party/upb/upb/wire/decode.c +269 -430
  924. data/third_party/upb/upb/wire/decode.h +6 -45
  925. data/third_party/upb/upb/wire/decode_fast/combinations.h +7 -3
  926. data/third_party/upb/upb/wire/decode_fast/select.c +7 -2
  927. data/third_party/upb/upb/wire/encode.c +144 -106
  928. data/third_party/upb/upb/wire/encode.h +6 -2
  929. data/third_party/upb/upb/wire/eps_copy_input_stream.c +36 -7
  930. data/third_party/upb/upb/wire/eps_copy_input_stream.h +94 -380
  931. data/third_party/upb/upb/wire/internal/decoder.c +1 -14
  932. data/third_party/upb/upb/wire/internal/decoder.h +84 -24
  933. data/third_party/upb/upb/wire/internal/eps_copy_input_stream.h +339 -0
  934. data/third_party/upb/upb/wire/internal/reader.h +29 -12
  935. data/third_party/upb/upb/wire/reader.c +35 -22
  936. data/third_party/upb/upb/wire/reader.h +11 -18
  937. data/third_party/utf8_range/utf8_range.c +1 -1
  938. data/third_party/utf8_range/utf8_range.h +2 -1
  939. metadata +35 -13
  940. data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.cc +0 -117
  941. data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h +0 -109
  942. data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.cc +0 -80
  943. data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.h +0 -86
  944. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc +0 -83
  945. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +0 -91
  946. data/src/core/ext/transport/chttp2/transport/incoming_metadata_tracker.h +0 -217
  947. data/third_party/upb/upb/message/internal/tagged_ptr.h +0 -56
  948. data/third_party/upb/upb/message/tagged_ptr.h +0 -48
@@ -0,0 +1,2073 @@
1
+ //
2
+ //
3
+ // Copyright 2024 gRPC authors.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ //
18
+
19
+ #include "src/core/ext/transport/chttp2/transport/http2_server_transport.h"
20
+
21
+ #include <grpc/event_engine/event_engine.h>
22
+ #include <grpc/grpc.h>
23
+ #include <grpc/support/port_platform.h>
24
+ #include <limits.h>
25
+
26
+ #include <algorithm>
27
+ #include <cstddef>
28
+ #include <cstdint>
29
+ #include <iterator>
30
+ #include <memory>
31
+ #include <optional>
32
+ #include <string>
33
+ #include <type_traits>
34
+ #include <utility>
35
+ #include <variant>
36
+ #include <vector>
37
+
38
+ #include "src/core/call/call_destination.h"
39
+ #include "src/core/call/call_spine.h"
40
+ #include "src/core/call/message.h"
41
+ #include "src/core/call/metadata.h"
42
+ #include "src/core/call/metadata_batch.h"
43
+ #include "src/core/channelz/channelz.h"
44
+ #include "src/core/ext/transport/chttp2/transport/flow_control.h"
45
+ #include "src/core/ext/transport/chttp2/transport/flow_control_manager.h"
46
+ #include "src/core/ext/transport/chttp2/transport/frame.h"
47
+ #include "src/core/ext/transport/chttp2/transport/goaway.h"
48
+ #include "src/core/ext/transport/chttp2/transport/header_assembler.h"
49
+ #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
50
+ #include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
51
+ #include "src/core/ext/transport/chttp2/transport/http2_settings.h"
52
+ #include "src/core/ext/transport/chttp2/transport/http2_settings_promises.h"
53
+ #include "src/core/ext/transport/chttp2/transport/http2_status.h"
54
+ #include "src/core/ext/transport/chttp2/transport/http2_transport.h"
55
+ #include "src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h"
56
+ #include "src/core/ext/transport/chttp2/transport/keepalive.h"
57
+ #include "src/core/ext/transport/chttp2/transport/message_assembler.h"
58
+ #include "src/core/ext/transport/chttp2/transport/ping_promise.h"
59
+ #include "src/core/ext/transport/chttp2/transport/read_context.h"
60
+ #include "src/core/ext/transport/chttp2/transport/security_frame.h"
61
+ #include "src/core/ext/transport/chttp2/transport/stream.h"
62
+ #include "src/core/ext/transport/chttp2/transport/stream_data_queue.h"
63
+ #include "src/core/ext/transport/chttp2/transport/transport_common.h"
64
+ #include "src/core/lib/channel/channel_args.h"
65
+ #include "src/core/lib/debug/trace_impl.h"
66
+ #include "src/core/lib/iomgr/closure.h"
67
+ #include "src/core/lib/iomgr/exec_ctx.h"
68
+ #include "src/core/lib/promise/for_each.h"
69
+ #include "src/core/lib/promise/if.h"
70
+ #include "src/core/lib/promise/loop.h"
71
+ #include "src/core/lib/promise/map.h"
72
+ #include "src/core/lib/promise/match_promise.h"
73
+ #include "src/core/lib/promise/party.h"
74
+ #include "src/core/lib/promise/poll.h"
75
+ #include "src/core/lib/promise/promise.h"
76
+ #include "src/core/lib/promise/race.h"
77
+ #include "src/core/lib/promise/sleep.h"
78
+ #include "src/core/lib/promise/try_seq.h"
79
+ #include "src/core/lib/resource_quota/arena.h"
80
+ #include "src/core/lib/resource_quota/resource_quota.h"
81
+ #include "src/core/lib/slice/slice.h"
82
+ #include "src/core/lib/slice/slice_buffer.h"
83
+ #include "src/core/lib/transport/connectivity_state.h"
84
+ #include "src/core/lib/transport/promise_endpoint.h"
85
+ #include "src/core/lib/transport/transport.h"
86
+ #include "src/core/util/debug_location.h"
87
+ #include "src/core/util/grpc_check.h"
88
+ #include "src/core/util/latent_see.h"
89
+ #include "src/core/util/orphanable.h"
90
+ #include "src/core/util/ref_counted.h"
91
+ #include "src/core/util/ref_counted_ptr.h"
92
+ #include "src/core/util/sync.h"
93
+ #include "src/core/util/time.h"
94
+ #include "absl/container/flat_hash_map.h"
95
+ #include "absl/functional/any_invocable.h"
96
+ #include "absl/log/log.h"
97
+ #include "absl/status/status.h"
98
+ #include "absl/strings/cord.h"
99
+ #include "absl/strings/str_cat.h"
100
+ #include "absl/strings/string_view.h"
101
+ #include "absl/types/span.h"
102
+
103
+ namespace grpc_core {
104
+ namespace http2 {
105
+
106
+ using grpc_event_engine::experimental::EventEngine;
107
+ using StreamWritabilityUpdate =
108
+ StreamDataQueue<ServerMetadataHandle>::StreamWritabilityUpdate;
109
+
110
+ // Experimental : This is just the initial skeleton of class
111
+ // and it is functions. The code will be written iteratively.
112
+ // Do not use or edit any of these functions unless you are
113
+ // familiar with the PH2 project (Moving chttp2 to promises.)
114
+ // TODO(tjagtap) : [PH2][P3] : Delete this comment after CHTTP2 deletion.
115
+
116
+ constexpr bool kIsClient = false;
117
+
118
+ //////////////////////////////////////////////////////////////////////////////
119
+ // Channelz and ZTrace
120
+
121
+ RefCountedPtr<channelz::SocketNode> Http2ServerTransport::GetSocketNode()
122
+ const {
123
+ const channelz::BaseNode* node = channelz::DataSource::channelz_node();
124
+ if (node == nullptr) {
125
+ return nullptr;
126
+ }
127
+ return const_cast<channelz::BaseNode*>(node)
128
+ ->RefAsSubclass<channelz::SocketNode>();
129
+ }
130
+
131
+ void Http2ServerTransport::AddData(channelz::DataSink sink) {
132
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::AddData Begin";
133
+
134
+ event_engine_->Run([self = RefAsSubclass<Http2ServerTransport>(),
135
+ sink = std::move(sink)]() mutable {
136
+ RefCountedPtr<Party> party = nullptr;
137
+ {
138
+ MutexLock lock(&self->transport_mutex_);
139
+ if (GPR_LIKELY(!self->is_transport_closed_)) {
140
+ GRPC_DCHECK(self->general_party_ != nullptr);
141
+ party = self->general_party_;
142
+ } else {
143
+ GRPC_HTTP2_SERVER_DLOG
144
+ << "Http2ServerTransport::AddData Transport is closed.";
145
+ }
146
+ }
147
+
148
+ ExecCtx exec_ctx;
149
+ if (party != nullptr) {
150
+ self->SpawnAddChannelzData(std::move(party), std::move(sink));
151
+ }
152
+ self.reset(); // Cleanup with exec_ctx in scope
153
+ });
154
+ }
155
+
156
+ void Http2ServerTransport::SpawnAddChannelzData(RefCountedPtr<Party> party,
157
+ channelz::DataSink sink) {
158
+ SpawnInfallible(
159
+ std::move(party), "AddData",
160
+ [self = RefAsSubclass<Http2ServerTransport>(),
161
+ sink = std::move(sink)]() mutable {
162
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::SpawnAddChannelzData";
163
+ sink.AddData(
164
+ "Http2ServerTransport",
165
+ channelz::PropertyList()
166
+ .Set("keepalive_time", self->keepalive_time_)
167
+ .Set("keepalive_permit_without_calls",
168
+ self->keepalive_permit_without_calls_)
169
+ .Set("max_requests_per_read",
170
+ self->read_context_.max_new_streams_per_read_cycle())
171
+ .Set("settings", self->settings_->ChannelzProperties())
172
+ .Set("flow_control",
173
+ self->flow_control_.stats().ChannelzProperties()));
174
+ self->general_party_->ExportToChannelz("Http2ServerTransport Party",
175
+ sink);
176
+ GRPC_HTTP2_SERVER_DLOG
177
+ << "Http2ServerTransport::SpawnAddChannelzData End";
178
+ return Empty{};
179
+ });
180
+ }
181
+
182
+ //////////////////////////////////////////////////////////////////////////////
183
+ // Watchers
184
+
185
+ void Http2ServerTransport::StartWatch(RefCountedPtr<StateWatcher> watcher) {
186
+ MutexLock lock(&transport_mutex_);
187
+ GRPC_CHECK(watcher_ == nullptr);
188
+ watcher_ = std::move(watcher);
189
+ if (is_transport_closed_) {
190
+ // TODO(tjagtap) : [PH2][P2] : Provide better status message and
191
+ // disconnect info here.
192
+ NotifyStateWatcherOnDisconnectLocked(
193
+ absl::UnknownError("transport closed before watcher started"), {});
194
+ } else {
195
+ // TODO(tjagtap) : [PH2][P2] : Notify the state watcher of the current
196
+ // value of the peer's MAX_CONCURRENT_STREAMS setting.
197
+ }
198
+ }
199
+
200
+ void Http2ServerTransport::StopWatch(RefCountedPtr<StateWatcher> watcher) {
201
+ MutexLock lock(&transport_mutex_);
202
+ if (watcher_ == watcher) watcher_.reset();
203
+ }
204
+
205
+ void Http2ServerTransport::StartConnectivityWatch(
206
+ grpc_connectivity_state state,
207
+ OrphanablePtr<ConnectivityStateWatcherInterface> watcher) {
208
+ MutexLock lock(&transport_mutex_);
209
+ state_tracker_.AddWatcher(state, std::move(watcher));
210
+ }
211
+
212
+ void Http2ServerTransport::StopConnectivityWatch(
213
+ ConnectivityStateWatcherInterface* watcher) {
214
+ MutexLock lock(&transport_mutex_);
215
+ state_tracker_.RemoveWatcher(watcher);
216
+ }
217
+
218
+ void Http2ServerTransport::NotifyStateWatcherOnDisconnectLocked(
219
+ absl::Status status, StateWatcher::DisconnectInfo disconnect_info) {
220
+ if (watcher_ == nullptr) return;
221
+ event_engine_->Run([watcher = std::move(watcher_), status = std::move(status),
222
+ disconnect_info]() mutable {
223
+ ExecCtx exec_ctx;
224
+ watcher->OnDisconnect(std::move(status), disconnect_info);
225
+ watcher.reset(); // Before ExecCtx goes out of scope.
226
+ });
227
+ }
228
+
229
+ //////////////////////////////////////////////////////////////////////////////
230
+ // Test Only Functions
231
+
232
+ int64_t Http2ServerTransport::TestOnlyTransportFlowControlWindow() {
233
+ return flow_control_.remote_window();
234
+ }
235
+
236
+ int64_t Http2ServerTransport::TestOnlyGetStreamFlowControlWindow(
237
+ const uint32_t stream_id) {
238
+ RefCountedPtr<Stream> stream = LookupStream(stream_id);
239
+ if (stream == nullptr) {
240
+ return -1;
241
+ }
242
+ return stream->GetStreamFlowControl().remote_window_delta();
243
+ }
244
+
245
+ //////////////////////////////////////////////////////////////////////////////
246
+ // Endpoint Helpers
247
+
248
+ auto Http2ServerTransport::EndpointWrite(SliceBuffer&& output_buf) {
249
+ size_t output_buf_length = output_buf.Length();
250
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::EndpointWrite output_buf: "
251
+ << output_buf_length;
252
+
253
+ transport_write_context_.GetWriteCycle().BeginWrite(output_buf_length);
254
+ return Map(
255
+ endpoint_.Write(std::forward<SliceBuffer>(output_buf),
256
+ TransportWriteContext::GetWriteArgs(settings_->peer())),
257
+ [this](absl::Status status) {
258
+ GRPC_HTTP2_SERVER_DLOG
259
+ << "Http2ServerTransport::EndpointWrite complete with status = "
260
+ << status;
261
+ transport_write_context_.GetWriteCycle().EndWrite(status.ok());
262
+ return status;
263
+ });
264
+ }
265
+
266
+ auto Http2ServerTransport::SerializeAndWrite() {
267
+ return AssertResultType<absl::Status>(If(
268
+ transport_write_context_.GetWriteCycle().CanSerializeRegularFrames(),
269
+ [this]() mutable {
270
+ WriteCycle& write_cycle = transport_write_context_.GetWriteCycle();
271
+ const uint64_t frame_count = write_cycle.GetRegularFrameCount();
272
+ GRPC_HTTP2_SERVER_DLOG
273
+ << "Http2ServerTransport::SerializeAndWrite frame count: "
274
+ << frame_count;
275
+ ztrace_collector_->Append(PromiseEndpointWriteTrace{frame_count});
276
+ return EndpointWrite(write_cycle.SerializeRegularFrames(
277
+ WriteCycle::SerializeStats{should_reset_ping_clock_}));
278
+ },
279
+ []() { return absl::OkStatus(); }));
280
+ }
281
+
282
+ //////////////////////////////////////////////////////////////////////////////
283
+ // Transport Read Path
284
+
285
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(Http2DataFrame&& frame) {
286
+ // https://www.rfc-editor.org/rfc/rfc9113.html#name-data
287
+ GRPC_HTTP2_SERVER_DLOG
288
+ << "Http2ServerTransport::ProcessIncomingFrame(DataFrame) { stream_id="
289
+ << frame.stream_id << ", end_stream:" << frame.end_stream
290
+ << ", payload length=" << frame.payload.Length() << "}";
291
+
292
+ ping_manager_->ReceivedDataFrame();
293
+
294
+ RefCountedPtr<Stream> stream = LookupStream(frame.stream_id);
295
+
296
+ if (frame.payload.Length() > 0) {
297
+ // DATA frames with empty payload are legitimate frames. CHTTP2 and PH2 send
298
+ // empty DATA frames with END_Stream flag set to true.
299
+ ValueOrHttp2Status<chttp2::FlowControlAction> flow_control_action =
300
+ ProcessIncomingDataFrameFlowControl(
301
+ read_context_.GetCurrentFrameHeader(), flow_control_, stream.get());
302
+ if (!flow_control_action.IsOk()) {
303
+ return ValueOrHttp2Status<chttp2::FlowControlAction>::TakeStatus(
304
+ std::move(flow_control_action));
305
+ }
306
+ ActOnFlowControlAction(flow_control_action.value(), stream.get());
307
+ }
308
+
309
+ if (stream == nullptr) {
310
+ // TODO(tjagtap) : [PH2][P2] : Implement the correct behaviour later.
311
+ // RFC9113 : If a DATA frame is received whose stream is not in the "open"
312
+ // or "half-closed (local)" state, the recipient MUST respond with a stream
313
+ // error (Section 5.4.2) of type STREAM_CLOSED.
314
+ GRPC_HTTP2_SERVER_DLOG
315
+ << "Http2ServerTransport::ProcessIncomingFrame(DataFrame) { stream_id="
316
+ << frame.stream_id << "} Lookup Failed";
317
+ return Http2Status::Ok();
318
+ }
319
+
320
+ // TODO(akshitpatel) : [PH2][P3] : We should add a check to reset stream if
321
+ // the stream state is kIdle as well.
322
+
323
+ Http2Status stream_status = stream->CanStreamReceiveDataFrames();
324
+ if (!stream_status.IsOk()) {
325
+ return stream_status;
326
+ }
327
+
328
+ GRPC_HTTP2_SERVER_DLOG
329
+ << "Http2ServerTransport::ProcessIncomingFrame(DataFrame) "
330
+ "AppendNewDataFrame";
331
+ GrpcMessageAssembler& assembler = stream->GetGrpcMessageAssembler();
332
+ Http2Status status =
333
+ assembler.AppendNewDataFrame(frame.payload, frame.end_stream);
334
+ if (!status.IsOk()) {
335
+ GRPC_HTTP2_SERVER_DLOG
336
+ << "Http2ServerTransport::ProcessIncomingFrame(DataFrame) "
337
+ "AppendNewDataFrame Failed";
338
+ return status;
339
+ }
340
+
341
+ // Pass the messages up the stack if it is ready.
342
+ while (true) {
343
+ GRPC_HTTP2_SERVER_DLOG
344
+ << "Http2ServerTransport::ProcessIncomingFrame(DataFrame) "
345
+ "ExtractMessage";
346
+ ValueOrHttp2Status<MessageHandle> result = assembler.ExtractMessage();
347
+ if (!result.IsOk()) {
348
+ GRPC_HTTP2_SERVER_DLOG
349
+ << "Http2ServerTransport::ProcessIncomingFrame(DataFrame) "
350
+ "ExtractMessage Failed";
351
+ return ValueOrHttp2Status<MessageHandle>::TakeStatus(std::move(result));
352
+ }
353
+ MessageHandle message = TakeValue(std::move(result));
354
+ if (message != nullptr) {
355
+ GRPC_HTTP2_SERVER_DLOG
356
+ << "Http2ServerTransport::ProcessIncomingFrame(DataFrame) "
357
+ "SpawnPushMessage ";
358
+ stream->GetCallInitiator().SpawnPushMessage(std::move(message));
359
+ continue;
360
+ }
361
+ GRPC_HTTP2_SERVER_DLOG
362
+ << "Http2ServerTransport::ProcessIncomingFrame(DataFrame) While Break";
363
+ break;
364
+ }
365
+
366
+ if (frame.end_stream) {
367
+ HandleStreamStateChange(*stream, stream->OnHalfCloseReceived());
368
+ }
369
+ return Http2Status::Ok();
370
+ }
371
+
372
+ template <typename T>
373
+ Http2Status Http2ServerTransport::ProcessIncomingMetadata(T&& frame) {
374
+ GRPC_HTTP2_SERVER_DLOG
375
+ << "Http2ServerTransport::ProcessIncomingMetadata { stream_id="
376
+ << frame.stream_id << ", end_headers=" << frame.end_headers << " }";
377
+ ping_manager_->ReceivedDataFrame();
378
+
379
+ bool is_new_stream = false;
380
+ RefCountedPtr<Stream> stream = nullptr;
381
+ // State update MUST happen before processing the frame.
382
+ if (!read_context_.IsWaitingForContinuationFrame()) {
383
+ // This is a HEADERS frame.
384
+ stream = LookupStream(frame.stream_id);
385
+ is_new_stream = (stream == nullptr);
386
+ // TODO(tjagtap) : [PH2][P2] : Implement initial stream id checks for new
387
+ // streams.
388
+ last_incoming_stream_id_ = frame.stream_id;
389
+ } else {
390
+ // This is a CONTINUATION frame.
391
+ GRPC_DCHECK(read_context_.GetStreamId() == frame.stream_id);
392
+ GRPC_DCHECK(LookupStream(frame.stream_id) != nullptr);
393
+ is_new_stream = true;
394
+ }
395
+ read_context_.UpdateState(frame, /*is_existing_stream=*/!is_new_stream);
396
+
397
+ if (is_new_stream) {
398
+ // TODO(tjagtap) : [PH2][P3] : Implement this.
399
+ // RFC9113 : The identifier of a newly established stream MUST be
400
+ // numerically greater than all streams that the initiating endpoint has
401
+ // opened or reserved. This governs streams that are opened using a HEADERS
402
+ // frame and streams that are reserved using PUSH_PROMISE. An endpoint that
403
+ // receives an unexpected stream identifier MUST respond with a connection
404
+ // error (Section 5.4.1) of type PROTOCOL_ERROR.
405
+
406
+ if (goaway_manager_.IsFinalGracefulGoawayScheduledOrSent()) {
407
+ return read_context_.ParseAndDiscardHeaders(
408
+ std::move(frame.payload), frame.end_headers, Http2Status::Ok(),
409
+ settings_->acked().max_header_list_size());
410
+ }
411
+
412
+ Http2Status append_result =
413
+ read_context_.header_assembler().AppendFrame(frame);
414
+ if (!append_result.IsOk()) {
415
+ // Frame payload is not consumed if AppendFrame returns a non-OK
416
+ // status. We need to process it to keep our in consistent state.
417
+ return read_context_.ParseAndDiscardHeaders(
418
+ std::move(frame.payload), frame.end_headers, std::move(append_result),
419
+ settings_->acked().max_header_list_size());
420
+ }
421
+ Http2Status status = ProcessMetadata();
422
+ if (!status.IsOk()) {
423
+ // Frame payload has been moved to the HeaderAssembler. So calling
424
+ // ParseAndDiscardHeaders with an empty buffer.
425
+ return read_context_.ParseAndDiscardHeaders(
426
+ SliceBuffer(), frame.end_headers, std::move(status),
427
+ settings_->acked().max_header_list_size());
428
+ }
429
+ } else {
430
+ // Stream already exists.
431
+ // TODO(tjagtap) : [PH2][P1] : Implement/Verify this
432
+ GRPC_HTTP2_SERVER_DLOG
433
+ << "Http2ServerTransport::ProcessIncomingMetadata { stream_id="
434
+ << frame.stream_id << "} Stream already exists.";
435
+ Http2Status validation_status =
436
+ ValidateMetadataFrameState(frame, *stream, read_context_,
437
+ settings_->acked().max_header_list_size());
438
+ if (!validation_status.IsOk()) {
439
+ return validation_status;
440
+ }
441
+ }
442
+ // Frame payload has either been processed or moved to the HeaderAssembler.
443
+ return Http2Status::Ok();
444
+ }
445
+
446
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
447
+ Http2HeaderFrame&& frame) {
448
+ // https://www.rfc-editor.org/rfc/rfc9113.html#name-headers
449
+ GRPC_HTTP2_SERVER_DLOG
450
+ << "Http2ServerTransport::ProcessIncomingFrame(HeaderFrame) end_stream="
451
+ << frame.end_stream;
452
+ return ProcessIncomingMetadata(std::forward<Http2HeaderFrame>(frame));
453
+ }
454
+
455
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
456
+ Http2RstStreamFrame&& frame) {
457
+ // https://www.rfc-editor.org/rfc/rfc9113.html#name-rst_stream
458
+ GRPC_HTTP2_SERVER_DLOG
459
+ << "Http2ServerTransport::ProcessIncomingFrame(ResetStreamFrame) { "
460
+ "stream_id="
461
+ << frame.stream_id << ", error_code=" << frame.error_code << " }";
462
+ read_context_.OnResetFrameReceived();
463
+
464
+ Http2ErrorCode error_code = FrameErrorCodeToHttp2ErrorCode(frame.error_code);
465
+ absl::Status status = absl::Status(ErrorCodeToAbslStatusCode(error_code),
466
+ "Reset stream frame received.");
467
+ RefCountedPtr<Stream> stream = LookupStream(frame.stream_id);
468
+ if (stream != nullptr) {
469
+ if (status.ok()) {
470
+ status =
471
+ absl::UnavailableError("RST_STREAM frame received with no error.");
472
+ }
473
+
474
+ HandleStreamStateChange(*stream,
475
+ stream->OnResetReceived(std::move(status)));
476
+ }
477
+
478
+ // In case of stream error, we do not want the Read Loop to be broken. Hence
479
+ // returning an ok status.
480
+ return Http2Status::Ok();
481
+ }
482
+
483
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
484
+ Http2SettingsFrame&& frame) {
485
+ // https://www.rfc-editor.org/rfc/rfc9113.html#name-settings
486
+
487
+ GRPC_HTTP2_SERVER_DLOG
488
+ << "Http2ServerTransport::ProcessIncomingFrame(SettingsFrame) { ack="
489
+ << frame.ack << ", settings length=" << frame.settings.size() << "}";
490
+
491
+ if (!frame.ack) {
492
+ read_context_.OnSettingsFrameReceived();
493
+ Http2Status s = settings_->BufferPeerSettings(std::move(frame.settings));
494
+ if (!s.IsOk()) {
495
+ return s;
496
+ }
497
+ absl::Status trigger_write_status = TriggerWriteCycle();
498
+ if (!trigger_write_status.ok()) {
499
+ return ToHttpOkOrConnError(trigger_write_status);
500
+ }
501
+ if (GPR_UNLIKELY(!settings_->IsFirstPeerSettingsApplied())) {
502
+ // Apply the first settings before we read any other frames.
503
+ read_context_.SetPauseReadLoop();
504
+ }
505
+ } else {
506
+ Http2Status status = settings_->OnSettingsAckReceived();
507
+ if (!status.IsOk()) {
508
+ return status;
509
+ }
510
+ read_context_.SetMaxHeaderTableSize(settings_->acked().header_table_size());
511
+ read_context_.header_assembler().MaybeSetAllowTrueBinaryMetadataAcked(
512
+ settings_->acked().allow_true_binary_metadata());
513
+ ActOnFlowControlAction(flow_control_.SetAckedInitialWindow(
514
+ settings_->acked().initial_window_size()),
515
+ /*stream=*/nullptr);
516
+ }
517
+
518
+ return Http2Status::Ok();
519
+ }
520
+
521
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(Http2PingFrame&& frame) {
522
+ // https://www.rfc-editor.org/rfc/rfc9113.html#name-ping
523
+ GRPC_HTTP2_SERVER_DLOG
524
+ << "Http2ServerTransport::ProcessIncomingFrame(PingFrame) { ack="
525
+ << frame.ack << ", opaque=" << frame.opaque << " }";
526
+ if (frame.ack) {
527
+ return ToHttpOkOrConnError(AckPing(frame.opaque));
528
+ } else {
529
+ read_context_.OnPingFrameReceived();
530
+ if (test_only_ack_pings_) {
531
+ ping_manager_->AddPendingPingAck(frame.opaque);
532
+ return ToHttpOkOrConnError(TriggerWriteCycle());
533
+ } else {
534
+ GRPC_HTTP2_SERVER_DLOG
535
+ << "Http2ServerTransport::ProcessIncomingFrame(PingFrame) "
536
+ "test_only_ack_pings_ is false. Ignoring the ping request.";
537
+ }
538
+ }
539
+ return Http2Status::Ok();
540
+ }
541
+
542
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
543
+ Http2GoawayFrame&& frame) {
544
+ // https://www.rfc-editor.org/rfc/rfc9113.html#name-goaway
545
+ GRPC_HTTP2_SERVER_DLOG
546
+ << "Http2ServerTransport::ProcessIncomingFrame(GoawayFrame) { "
547
+ "last_stream_id="
548
+ << frame.last_stream_id << ", error_code=" << frame.error_code << "}";
549
+ LOG_IF(ERROR,
550
+ frame.error_code != static_cast<uint32_t>(Http2ErrorCode::kNoError))
551
+ << "Received GOAWAY frame with error code: " << frame.error_code;
552
+
553
+ // uint32_t last_stream_id = 0;
554
+ // absl::Status status(ErrorCodeToAbslStatusCode(
555
+ // FrameErrorCodeToHttp2ErrorCode(frame.error_code)),
556
+ // frame.debug_data.empty()
557
+ // ? absl::string_view("GOAWAY received")
558
+ // : frame.debug_data.as_string_view());
559
+ // if (GoawayManager::IsGracefulGoaway(frame)) {
560
+ // const uint32_t next_stream_id = PeekNextStreamId();
561
+ // last_stream_id = (next_stream_id > 1) ? next_stream_id - 2 : 0;
562
+ // } else {
563
+ // last_stream_id = frame.last_stream_id;
564
+ // }
565
+ // SetMaxAllowedStreamId(last_stream_id);
566
+
567
+ // bool close_transport = false;
568
+ // {
569
+ // MutexLock lock(&transport_mutex_);
570
+ // if (CanCloseTransportLocked()) {
571
+ // close_transport = true;
572
+ // GRPC_HTTP2_SERVER_DLOG <<
573
+ // "Http2ServerTransport::ProcessIncomingFrame("
574
+ // "GoawayFrame) "
575
+ // "stream_list_ is empty";
576
+ // }
577
+ // }
578
+
579
+ // StateWatcher::DisconnectInfo disconnect_info;
580
+ // disconnect_info.reason = Transport::StateWatcher::kGoaway;
581
+ // disconnect_info.http2_error_code =
582
+ // static_cast<Http2ErrorCode>(frame.error_code);
583
+
584
+ // // Throttle keepalive time if the server sends a GOAWAY with error code
585
+ // // ENHANCE_YOUR_CALM and debug data equal to "too_many_pings". This
586
+ // will
587
+ // // apply to any new transport created on by any subchannel of this
588
+ // channel. if (GPR_UNLIKELY(frame.error_code == static_cast<uint32_t>(
589
+ // Http2ErrorCode::kEnhanceYourCalm)
590
+ // &&
591
+ // frame.debug_data == "too_many_pings")) {
592
+ // LOG(ERROR) << ": Received a GOAWAY with error code ENHANCE_YOUR_CALM
593
+ // and
594
+ // "
595
+ // "debug data equal to \"too_many_pings\". Current
596
+ // keepalive " "time (before throttling): "
597
+ // << keepalive_time_.ToString();
598
+ // constexpr int max_keepalive_time_millis =
599
+ // INT_MAX / KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
600
+ // uint64_t throttled_keepalive_time =
601
+ // keepalive_time_.millis() > max_keepalive_time_millis
602
+ // ? INT_MAX
603
+ // : keepalive_time_.millis() *
604
+ // KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
605
+ // if (!IsSubchannelConnectionScalingEnabled()) {
606
+ // status.SetPayload(kKeepaliveThrottlingKey,
607
+ // absl::Cord(std::to_string(throttled_keepalive_time)));
608
+ // }
609
+ // disconnect_info.keepalive_time =
610
+ // Duration::Milliseconds(throttled_keepalive_time);
611
+ // }
612
+
613
+ // if (close_transport) {
614
+ // // TODO(akshitpatel) : [PH2][P3] : Ideally the error here should be
615
+ // // kNoError. However, Http2Status does not support kNoError. We
616
+ // should
617
+ // // revisit this and update the error code.
618
+ // MaybeSpawnCloseTransport(Http2Status::Http2ConnectionError(
619
+ // FrameErrorCodeToHttp2ErrorCode((
620
+ // frame.error_code ==
621
+ // Http2ErrorCodeToFrameErrorCode(Http2ErrorCode::kNoError)
622
+ // ?
623
+ // Http2ErrorCodeToFrameErrorCode(Http2ErrorCode::kInternalError)
624
+ // : frame.error_code)),
625
+ // frame.debug_data.empty()
626
+ // ? std::string("GOAWAY received")
627
+ // : std::string(frame.debug_data.as_string_view())));
628
+ // }
629
+
630
+ // // lie: use transient failure from the transport to indicate goaway has
631
+ // been
632
+ // // received.
633
+ // ReportDisconnection(status, disconnect_info, "got_goaway");
634
+ return Http2Status::Ok();
635
+ }
636
+
637
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
638
+ Http2WindowUpdateFrame&& frame) {
639
+ // https://www.rfc-editor.org/rfc/rfc9113.html#name-window_update
640
+ GRPC_HTTP2_SERVER_DLOG
641
+ << "Http2ServerTransport::ProcessIncomingFrame(WindowUpdateFrame) { "
642
+ " stream_id="
643
+ << frame.stream_id << ", increment=" << frame.increment << "}";
644
+
645
+ RefCountedPtr<Stream> stream = nullptr;
646
+ if (frame.stream_id != 0) {
647
+ stream = LookupStream(frame.stream_id);
648
+ }
649
+
650
+ const bool should_trigger_write = ProcessIncomingWindowUpdateFrameFlowControl(
651
+ frame, flow_control_, stream.get());
652
+
653
+ if (should_trigger_write) {
654
+ return ToHttpOkOrConnError(TriggerWriteCycle());
655
+ }
656
+
657
+ if (stream != nullptr) {
658
+ StreamWritabilityUpdate update =
659
+ stream->UpdateStreamWritability(GetStreamFlowControlTokens(
660
+ stream->GetStreamFlowControl(), settings_->peer()));
661
+ if (update.became_writable) {
662
+ absl::Status status = writable_stream_list_.EnqueueWrapper(
663
+ stream, update.priority, AreTransportFlowControlTokensAvailable());
664
+ if (!status.ok()) {
665
+ return ToHttpOkOrConnError(status);
666
+ }
667
+ }
668
+ }
669
+ return Http2Status::Ok();
670
+ }
671
+
672
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
673
+ Http2ContinuationFrame&& frame) {
674
+ // https://www.rfc-editor.org/rfc/rfc9113.html#name-continuation
675
+ GRPC_HTTP2_SERVER_DLOG
676
+ << "Http2ServerTransport::ProcessIncomingFrame(ContinuationFrame)";
677
+ return ProcessIncomingMetadata(std::forward<Http2ContinuationFrame>(frame));
678
+ }
679
+
680
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
681
+ Http2SecurityFrame&& frame) {
682
+ if (settings_->IsSecurityFrameExpected()) {
683
+ security_frame_handler_->ProcessPayload(std::move(frame.payload));
684
+ }
685
+ return Http2Status::Ok();
686
+ }
687
+
688
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
689
+ GRPC_UNUSED Http2UnknownFrame&& frame) {
690
+ // RFC9113: Implementations MUST ignore and discard frames of
691
+ // unknown types.
692
+ GRPC_HTTP2_SERVER_DLOG
693
+ << "Http2ServerTransport::ProcessIncomingFrame(UnknownFrame) ";
694
+ return Http2Status::Ok();
695
+ }
696
+
697
+ Http2Status Http2ServerTransport::ProcessIncomingFrame(
698
+ GRPC_UNUSED Http2EmptyFrame&& frame) {
699
+ LOG(DFATAL) << "ParseFramePayload should never return a Http2EmptyFrame";
700
+ return Http2Status::Ok();
701
+ }
702
+
703
+ Http2Status Http2ServerTransport::ProcessMetadata() {
704
+ HeaderAssembler& assembler = read_context_.header_assembler();
705
+ // CallInitiator& call = stream->GetCallInitiator();
706
+
707
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::ProcessMetadata";
708
+ if (assembler.IsReady()) {
709
+ ValueOrHttp2Status<ServerMetadataHandle> read_result =
710
+ assembler.ReadMetadata(read_context_.parser(),
711
+ !read_context_.HeaderHasEndStream(),
712
+ /*max_header_list_size_soft_limit=*/
713
+ read_context_.soft_limit(),
714
+ /*max_header_list_size_hard_limit=*/
715
+ settings_->acked().max_header_list_size());
716
+ if (read_result.IsOk()) {
717
+ ServerMetadataHandle metadata = TakeValue(std::move(read_result));
718
+ // TODO(tjagtap): [PH2][P0] : Might be worth differentiating between
719
+ // initial and trailing metadata based on the number of header frames
720
+ // received.
721
+ if (read_context_.HeaderHasEndStream()) {
722
+ // TODO(akshitpatel) [PH2][P1] : Implement receiving trailing metadata.
723
+ // Details:
724
+ // - Standard gRPC clients do not send trailers (only EOS).
725
+ // - If received (HEADERS with END_STREAM), mark stream as half-closed
726
+ // remote.
727
+ // - Upper layers discard client trailers, so we are fine with not
728
+ // propagating them.
729
+ //
730
+ // With these assumptions, the flow will look like this:
731
+ // - If the client sends trailing metadata with an OK status, we will
732
+ // mark the stream as half-closed remote and do nothing else.
733
+ // - If the client sends trailing metadata with a non-OK status, this
734
+ // case needs to be handled.
735
+ // TODO(akshitpatel) : [PH2][P0] : Verify this.
736
+ RefCountedPtr<Stream> stream =
737
+ LookupStream(read_context_.GetStreamId());
738
+ HandleStreamStateChange(
739
+ *stream, stream->OnTrailingMetadataReceived(std::move(metadata)));
740
+ } else {
741
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::ProcessMetadata "
742
+ "SpawnPushServerInitialMetadata";
743
+ metadata->Set(PeerString(), read_context_.peer_string());
744
+ return IncomingStream(std::move(metadata), read_context_.GetStreamId());
745
+ }
746
+ return Http2Status::Ok();
747
+ }
748
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::ProcessMetadata Failed";
749
+ return ValueOrHttp2Status<Arena::PoolPtr<grpc_metadata_batch>>::TakeStatus(
750
+ std::move(read_result));
751
+ }
752
+ return Http2Status::Ok();
753
+ }
754
+
755
+ auto Http2ServerTransport::ReadAndProcessOneFrame() {
756
+ GRPC_HTTP2_SERVER_DLOG
757
+ << "Http2ServerTransport::ReadAndProcessOneFrame Factory";
758
+ return AssertResultType<absl::Status>(TrySeq(
759
+ // Fetch the first kFrameHeaderSize bytes of the Frame, these contain
760
+ // the frame header.
761
+ EndpointReadSlice(kFrameHeaderSize),
762
+ // Parse the frame header.
763
+ [this](Slice header_bytes) {
764
+ Http2FrameHeader header = Http2FrameHeader::Parse(header_bytes.begin());
765
+ // Validate the incoming frame as per the current state of the transport
766
+ Http2Status status = read_context_.ValidateHeader(
767
+ /*max_frame_size_setting=*/settings_->acked().max_frame_size(),
768
+ /*current_frame_header=*/header,
769
+ // TODO(tjagtap) : [PH2][P0] : Fix
770
+ /*last_stream_id=*//*GetLastStreamId()*/
771
+ std::numeric_limits<uint32_t>::max(),
772
+ /*is_first_settings_processed=*/
773
+ settings_->IsFirstPeerSettingsApplied());
774
+
775
+ if (GPR_UNLIKELY(!status.IsOk())) {
776
+ GRPC_DCHECK(status.GetType() ==
777
+ Http2Status::Http2ErrorType::kConnectionError);
778
+ return HandleError(/*stream=*/nullptr, std::move(status));
779
+ }
780
+ read_context_.SetCurrentFrameHeader(header);
781
+ return absl::OkStatus();
782
+ },
783
+ // Read the payload of the frame.
784
+ [this]() {
785
+ GRPC_HTTP2_SERVER_DLOG
786
+ << "Http2ServerTransport::ReadAndProcessOneFrame Read Frame ";
787
+ return AssertResultType<absl::Status>(
788
+ Map(EndpointRead(read_context_.GetCurrentFrameHeader().length),
789
+ [this](absl::StatusOr<SliceBuffer>&& payload) {
790
+ if (GPR_UNLIKELY(!payload.ok())) {
791
+ return payload.status();
792
+ }
793
+ GRPC_HTTP2_SERVER_DLOG
794
+ << "Http2ServerTransport::ReadAndProcessOneFrame "
795
+ "ParseFramePayload payload length: "
796
+ << payload.value().Length();
797
+ ValueOrHttp2Status<Http2Frame> frame =
798
+ ParseFramePayload(read_context_.GetCurrentFrameHeader(),
799
+ TakeValue(std::move(payload)));
800
+ if (GPR_UNLIKELY(!frame.IsOk())) {
801
+ return HandleError(
802
+ LookupStream(
803
+ read_context_.GetCurrentFrameHeader().stream_id),
804
+ ValueOrHttp2Status<Http2Frame>::TakeStatus(
805
+ std::move(frame)));
806
+ }
807
+ Http2Status status =
808
+ ProcessOneIncomingFrame(TakeValue(std::move(frame)));
809
+ if (GPR_UNLIKELY(!status.IsOk())) {
810
+ return HandleError(
811
+ LookupStream(
812
+ read_context_.GetCurrentFrameHeader().stream_id),
813
+ std::move(status));
814
+ }
815
+ return absl::OkStatus();
816
+ }));
817
+ },
818
+ [this]() -> Poll<absl::Status> {
819
+ Poll<absl::Status> poll_result = read_context_.MaybePauseReadLoop();
820
+ if (poll_result.pending()) {
821
+ TriggerWriteCycleOrHandleError();
822
+ }
823
+ return poll_result;
824
+ }));
825
+ }
826
+
827
+ auto Http2ServerTransport::ReadLoop() {
828
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::ReadLoop Factory";
829
+ return AssertResultType<absl::Status>(Loop([this]() {
830
+ return TrySeq(ReadAndProcessOneFrame(), []() -> LoopCtl<absl::Status> {
831
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::ReadLoop Continue";
832
+ return Continue();
833
+ });
834
+ }));
835
+ }
836
+
837
+ //////////////////////////////////////////////////////////////////////////////
838
+ // Transport Write Path
839
+
840
+ absl::Status Http2ServerTransport::PrepareControlFrames() {
841
+ FrameSender frame_sender =
842
+ transport_write_context_.GetWriteCycle().GetFrameSender();
843
+ if (transport_write_context_.IsFirstWrite()) {
844
+ // Send the first settings frame.
845
+ settings_->MaybeGetSettingsAndSettingsAckFrames(flow_control_,
846
+ frame_sender);
847
+ }
848
+
849
+ // Order of Control Frames is important.
850
+ // 1. GOAWAY - This is first because if this is the final GoAway, then we may
851
+ // not need to send anything else to the peer.
852
+ // 2. SETTINGS and SETTINGS ACK
853
+ // 3. PING and PING acks.
854
+ // 4. WINDOW_UPDATE
855
+ // 5. Custom gRPC security frame
856
+
857
+ goaway_manager_.MaybeGetSerializedGoawayFrame(frame_sender);
858
+ ApplySettingsResult apply_settings_result;
859
+
860
+ const uint32_t old_initial_window_size =
861
+ settings_->peer().initial_window_size();
862
+ const http2::Http2ErrorCode apply_status =
863
+ settings_->MaybeReportAndApplyBufferedPeerSettings(event_engine_.get(),
864
+ apply_settings_result);
865
+
866
+ if (apply_status == http2::Http2ErrorCode::kNoError) {
867
+ const uint32_t new_initial_window_size =
868
+ settings_->peer().initial_window_size();
869
+ if (new_initial_window_size > old_initial_window_size) {
870
+ // TODO(akshitpatel) [PH2][P5] : Currently, if calling
871
+ // UpdateAllStreamsWritability() makes one or more streams writable. Once
872
+ // a stream is writable, it is enqueued to the writable stream list.
873
+ // However, these streams are not written out until the next write cycle.
874
+ // Might be worth considering to write out these streams immediately.
875
+ settings_->IncrementInitialWindowSizeIncreaseCount();
876
+ absl::Status status = UpdateAllStreamsWritability();
877
+ if (GPR_UNLIKELY(!status.ok())) {
878
+ return status;
879
+ }
880
+ }
881
+ }
882
+
883
+ if (apply_settings_result.should_spawn_security_frame_loop) {
884
+ const SecurityFrameHandler::EndpointExtensionState state =
885
+ security_frame_handler_->Initialize(event_engine_);
886
+ if (state.is_set) {
887
+ SpawnInfallibleTransportParty("SecurityFrameLoop",
888
+ UntilTransportClosed(SecurityFrameLoop()));
889
+ }
890
+ }
891
+
892
+ if (!goaway_manager_.IsImmediateGoAway() &&
893
+ apply_status == http2::Http2ErrorCode::kNoError) {
894
+ EnforceLatestIncomingSettings();
895
+ settings_->MaybeGetSettingsAndSettingsAckFrames(flow_control_,
896
+ frame_sender);
897
+ MaybeSpawnDelayedPing(ping_manager_->MaybeGetSerializedPingFrames(
898
+ frame_sender, NextAllowedPingInterval()));
899
+ MaybeGetWindowUpdateFrames(frame_sender);
900
+ security_frame_handler_->MaybeAppendSecurityFrame(frame_sender);
901
+ }
902
+
903
+ if (apply_status != http2::Http2ErrorCode::kNoError) {
904
+ return HandleError(/*stream=*/nullptr,
905
+ Http2Status::Http2ConnectionError(
906
+ apply_status, "Failed to apply incoming settings"));
907
+ }
908
+
909
+ return absl::OkStatus();
910
+ }
911
+
912
+ auto Http2ServerTransport::MaybeWriteUrgentFrames() {
913
+ return AssertResultType<absl::Status>(If(
914
+ transport_write_context_.GetWriteCycle().CanSerializeUrgentFrames(),
915
+ [this]() mutable {
916
+ WriteCycle& write_cycle = transport_write_context_.GetWriteCycle();
917
+ const uint64_t buffer_length = write_cycle.GetUrgentFrameCount();
918
+ ztrace_collector_->Append(PromiseEndpointWriteTrace{buffer_length});
919
+ GRPC_HTTP2_SERVER_DLOG
920
+ << "Http2ServerTransport::MaybeWriteUrgentFrames frame count: "
921
+ << buffer_length;
922
+ return EndpointWrite(write_cycle.SerializeUrgentFrames(
923
+ WriteCycle::SerializeStats{should_reset_ping_clock_}));
924
+ },
925
+ []() { return absl::OkStatus(); }));
926
+ }
927
+
928
+ void Http2ServerTransport::NotifyFramesWriteDone() {
929
+ // Notify Control modules that we have sent the frames.
930
+ // All notifications are expected to be synchronous.
931
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::NotifyFramesWriteDone";
932
+ read_context_.ResumeReadLoopIfPaused();
933
+ MaybeSpawnPingTimeout(ping_manager_->NotifyPingSent());
934
+ goaway_manager_.NotifyGoawaySent();
935
+ MaybeSpawnWaitForSettingsTimeout();
936
+ }
937
+
938
+ void Http2ServerTransport::NotifyUrgentFramesWriteDone() {}
939
+
940
+ absl::Status Http2ServerTransport::DequeueStreamFrames(
941
+ RefCountedPtr<Stream> stream, WriteCycle& write_cycle) {
942
+ // write_bytes_remaining_ is passed as an upper bound on the max
943
+ // number of tokens that can be dequeued to prevent dequeuing huge
944
+ // data frames when write_bytes_remaining_ is very low. As the
945
+ // available transport tokens can only range from 0 to 2^31 - 1,
946
+ // we are clamping the write_bytes_remaining_ to that range.
947
+ FrameSender frame_sender = write_cycle.GetFrameSender();
948
+ const uint32_t tokens = GetMaxPermittedDequeue(
949
+ flow_control_, stream->GetStreamFlowControl(),
950
+ write_cycle.GetWriteBytesRemaining(), settings_->peer());
951
+ const uint32_t stream_flow_control_tokens =
952
+ static_cast<uint32_t>(GetStreamFlowControlTokens(
953
+ stream->GetStreamFlowControl(), settings_->peer()));
954
+ stream->GetStreamFlowControl().ReportIfStalled(
955
+ /*is_client=*/kIsClient, stream->GetStreamId(), settings_->peer());
956
+ StreamDataQueue<ClientMetadataHandle>::DequeueResult result =
957
+ stream->DequeueFrames(tokens, stream_flow_control_tokens,
958
+ settings_->peer().max_frame_size(), encoder_,
959
+ frame_sender);
960
+ ProcessOutgoingDataFrameFlowControl(stream->GetStreamFlowControl(),
961
+ result.flow_control_tokens_consumed);
962
+ if (result.is_writable) {
963
+ // Stream is still writable. Enqueue it back to the writable
964
+ // stream list.
965
+ absl::Status status = writable_stream_list_.EnqueueWrapper(
966
+ stream, result.priority, AreTransportFlowControlTokensAvailable());
967
+
968
+ if (GPR_UNLIKELY(!status.ok())) {
969
+ GRPC_HTTP2_SERVER_DLOG
970
+ << "Http2ServerTransport::DequeueStreamFrames Failed to "
971
+ "enqueue stream "
972
+ << stream->GetStreamId() << " with status: " << status;
973
+ // Close transport if we fail to enqueue stream.
974
+ return HandleError(/*stream=*/nullptr, ToHttpOkOrConnError(status));
975
+ }
976
+ }
977
+
978
+ if (result.IsInitialMetadataDequeued()) {
979
+ GRPC_HTTP2_SERVER_DLOG
980
+ << "Http2ServerTransport::DequeueStreamFrames InitialMetadataDequeued "
981
+ "stream_id = "
982
+ << stream->GetStreamId();
983
+ }
984
+
985
+ if (result.IsTrailingMetadataDequeued()) {
986
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::DequeueStreamFrames "
987
+ "TrailingMetadataDequeued stream_id = "
988
+ << stream->GetStreamId();
989
+ // Stream is not marked closed here as TrailingMetadata is always followed
990
+ // by RST_STREAM and we close the stream when we dequeue the RST_STREAM.
991
+ }
992
+
993
+ if (result.IsResetStreamDequeued()) {
994
+ GRPC_HTTP2_SERVER_DLOG
995
+ << "Http2ServerTransport::DequeueStreamFrames ResetStreamDequeued "
996
+ "stream_id = "
997
+ << stream->GetStreamId();
998
+ // As Trailing metadata is already read from CallInitiator, no need to send
999
+ // a status to the application.
1000
+ HandleStreamStateChange(*stream, stream->OnResetSent());
1001
+ }
1002
+
1003
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::DequeueStreamFrames "
1004
+ "After dequeue: "
1005
+ << write_cycle.DebugString()
1006
+ << " stream_id = " << stream->GetStreamId()
1007
+ << " is_writable = " << result.is_writable
1008
+ << " stream_priority = "
1009
+ << static_cast<uint8_t>(result.priority);
1010
+ return absl::OkStatus();
1011
+ }
1012
+
1013
+ // This MultiplexerLoop promise is responsible for Multiplexing multiple gRPC
1014
+ // Requests (HTTP2 Streams) and writing them into one common endpoint.
1015
+ auto Http2ServerTransport::MultiplexerLoop() {
1016
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::MultiplexerLoop Factory";
1017
+ return AssertResultType<absl::Status>(Loop([this]() {
1018
+ return TrySeq(
1019
+ Map(writable_stream_list_.WaitForReady(
1020
+ AreTransportFlowControlTokensAvailable()),
1021
+ [this](absl::StatusOr<Empty> status) -> absl::Status {
1022
+ if (GPR_UNLIKELY(!status.ok())) {
1023
+ return status.status();
1024
+ }
1025
+ transport_write_context_.StartWriteCycle();
1026
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::MultiplexerLoop "
1027
+ "Start Iteration: "
1028
+ << transport_write_context_.DebugString();
1029
+ return PrepareControlFrames();
1030
+ }),
1031
+ [this] {
1032
+ return Map(MaybeWriteUrgentFrames(), [this](absl::Status status) {
1033
+ if (GPR_UNLIKELY(!status.ok())) {
1034
+ return status;
1035
+ }
1036
+ NotifyUrgentFramesWriteDone();
1037
+ WriteCycle& write_cycle = transport_write_context_.GetWriteCycle();
1038
+ // Drain all the writable streams till we have written
1039
+ // max_write_size_ bytes of data or there is no more data to send.
1040
+ // In some cases, we may write more than max_write_size_ bytes(like
1041
+ // writing metadata).
1042
+ while (write_cycle.GetWriteBytesRemaining() > 0) {
1043
+ std::optional<RefCountedPtr<Stream>> optional_stream =
1044
+ writable_stream_list_.ImmediateNext(
1045
+ AreTransportFlowControlTokensAvailable());
1046
+ if (!optional_stream.has_value()) {
1047
+ GRPC_HTTP2_CLIENT_DLOG
1048
+ << "Http2ServerTransport::MultiplexerLoop "
1049
+ "No writable streams available ";
1050
+ break;
1051
+ }
1052
+ RefCountedPtr<Stream> stream = std::move(optional_stream.value());
1053
+ GRPC_HTTP2_SERVER_DLOG
1054
+ << "Http2ServerTransport::MultiplexerLoop "
1055
+ "Next writable stream id = "
1056
+ << stream->GetStreamId()
1057
+ << " is_closed_for_writes = " << stream->IsClosedForWrites();
1058
+ GRPC_DCHECK_NE(stream->GetStreamId(), kInvalidStreamId);
1059
+
1060
+ if (GPR_LIKELY(!stream->IsClosedForWrites())) {
1061
+ absl::Status status = DequeueStreamFrames(
1062
+ std::move(stream),
1063
+ transport_write_context_.GetWriteCycle());
1064
+ if (GPR_UNLIKELY(!status.ok())) {
1065
+ GRPC_HTTP2_SERVER_DLOG
1066
+ << "Http2ServerTransport::MultiplexerLoop "
1067
+ "Failed to dequeue stream frames with status: "
1068
+ << status;
1069
+ return status;
1070
+ }
1071
+ }
1072
+ }
1073
+
1074
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::MultiplexerLoop "
1075
+ "After draining all writable streams "
1076
+ << write_cycle.DebugString();
1077
+
1078
+ return absl::OkStatus();
1079
+ });
1080
+ },
1081
+ [this]() {
1082
+ return Map(SerializeAndWrite(), [this](absl::Status status) {
1083
+ if (GPR_UNLIKELY(!status.ok())) {
1084
+ return status;
1085
+ }
1086
+ NotifyFramesWriteDone();
1087
+ return absl::OkStatus();
1088
+ });
1089
+ },
1090
+ [this]() -> LoopCtl<absl::Status> {
1091
+ if (should_reset_ping_clock_) {
1092
+ GRPC_HTTP2_CLIENT_DLOG
1093
+ << "Http2ClientTransport::MultiplexerLoop ResetPingClock";
1094
+ ping_manager_->ResetPingClock(/*is_client=*/kIsClient);
1095
+ should_reset_ping_clock_ = false;
1096
+ }
1097
+ transport_write_context_.EndWriteCycle();
1098
+ return Continue();
1099
+ });
1100
+ }));
1101
+ }
1102
+
1103
+ //////////////////////////////////////////////////////////////////////////////
1104
+ // Settings
1105
+
1106
+ void Http2ServerTransport::EnforceLatestIncomingSettings() {
1107
+ encoder_.SetMaxTableSize(settings_->peer().header_table_size());
1108
+ }
1109
+
1110
+ auto Http2ServerTransport::WaitForSettingsTimeoutOnDone() {
1111
+ return [self = RefAsSubclass<Http2ServerTransport>()](absl::Status status) {
1112
+ if (!status.ok()) {
1113
+ GRPC_UNUSED absl::Status result = self->HandleError(
1114
+ /*stream=*/nullptr, Http2Status::Http2ConnectionError(
1115
+ Http2ErrorCode::kProtocolError,
1116
+ std::string(RFC9113::kSettingsTimeout)));
1117
+ }
1118
+ };
1119
+ }
1120
+
1121
+ void Http2ServerTransport::MaybeSpawnWaitForSettingsTimeout() {
1122
+ if (settings_->ShouldSpawnWaitForSettingsTimeout()) {
1123
+ GRPC_HTTP2_SERVER_DLOG
1124
+ << "Http2ServerTransport::MaybeSpawnWaitForSettingsTimeout Spawning";
1125
+ SpawnWithOnDoneTransportParty("WaitForSettingsTimeout",
1126
+ settings_->WaitForSettingsTimeout(),
1127
+ WaitForSettingsTimeoutOnDone());
1128
+ }
1129
+ }
1130
+
1131
+ //////////////////////////////////////////////////////////////////////////////
1132
+ // Flow Control and BDP
1133
+
1134
+ // Equivalent to grpc_chttp2_act_on_flowctl_action in chttp2_transport.cc
1135
+ void Http2ServerTransport::ActOnFlowControlAction(
1136
+ const chttp2::FlowControlAction& action, Stream* stream) {
1137
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::ActOnFlowControlAction"
1138
+ << action.DebugString();
1139
+ if (action.send_stream_update() != kNoActionNeeded) {
1140
+ if (GPR_LIKELY(stream != nullptr)) {
1141
+ GRPC_DCHECK_GT(stream->GetStreamId(), 0u);
1142
+ if (stream->CanSendWindowUpdateFrames()) {
1143
+ flow_control_.AddStreamToWindowUpdateList(stream->GetStreamId());
1144
+ GRPC_HTTP2_SERVER_DLOG
1145
+ << "Http2ServerTransport::ActOnFlowControlAction "
1146
+ "added stream "
1147
+ << stream->GetStreamId() << " to window_update_list_";
1148
+ }
1149
+ } else {
1150
+ GRPC_HTTP2_SERVER_DLOG
1151
+ << "Http2ServerTransport::ActOnFlowControlAction stream is null";
1152
+ }
1153
+ }
1154
+
1155
+ ActOnFlowControlActionSettings(action, settings_->mutable_local());
1156
+
1157
+ if (action.AnyUpdateImmediately()) {
1158
+ // Prioritize sending flow control updates over reading data. If we
1159
+ // continue reading while urgent flow control updates are pending, we might
1160
+ // exhaust the flow control window. This prevents us from sending window
1161
+ // updates to the peer, causing the peer to block unnecessarily while
1162
+ // waiting for flow control tokens.
1163
+ read_context_.SetPauseReadLoop();
1164
+ if (!TriggerWriteCycleOrHandleError()) {
1165
+ return;
1166
+ }
1167
+
1168
+ GRPC_HTTP2_SERVER_DLOG << "Update Immediately : "
1169
+ << action.ImmediateUpdateReasons();
1170
+ }
1171
+ }
1172
+
1173
+ void Http2ServerTransport::MaybeGetWindowUpdateFrames(
1174
+ FrameSender& frame_sender) {
1175
+ frame_sender.ReserveRegularFrames(flow_control_.window_update_list_size() +
1176
+ 1);
1177
+ MaybeAddTransportWindowUpdateFrame(flow_control_, frame_sender);
1178
+ for (const uint32_t stream_id : flow_control_.DrainWindowUpdateList()) {
1179
+ RefCountedPtr<Stream> stream = LookupStream(stream_id);
1180
+ if (stream != nullptr) {
1181
+ MaybeAddStreamWindowUpdateFrame(*stream, frame_sender);
1182
+ }
1183
+ }
1184
+ }
1185
+
1186
+ auto Http2ServerTransport::FlowControlPeriodicUpdateLoop() {
1187
+ GRPC_HTTP2_SERVER_DLOG
1188
+ << "Http2ServerTransport::FlowControlPeriodicUpdateLoop Factory";
1189
+ return AssertResultType<absl::Status>(
1190
+ Loop([this]() {
1191
+ GRPC_HTTP2_SERVER_DLOG
1192
+ << "Http2ServerTransport::FlowControlPeriodicUpdateLoop Loop";
1193
+ return TrySeq(
1194
+ // TODO(tjagtap) [PH2][P2][BDP] Remove this static sleep when the
1195
+ // BDP code is done.
1196
+ Sleep(chttp2::kFlowControlPeriodicUpdateTimer),
1197
+ [this]() -> Poll<absl::Status> {
1198
+ GRPC_HTTP2_SERVER_DLOG
1199
+ << "Http2ServerTransport::FlowControlPeriodicUpdateLoop "
1200
+ "PeriodicUpdate()";
1201
+ chttp2::FlowControlAction action = flow_control_.PeriodicUpdate();
1202
+ bool is_action_empty = action == chttp2::FlowControlAction();
1203
+ // This may trigger a write cycle
1204
+ ActOnFlowControlAction(action, nullptr);
1205
+ if (is_action_empty) {
1206
+ // TODO(tjagtap) [PH2][P2][BDP] Remove this when the BDP code is
1207
+ // done. We must continue to do PeriodicUpdate once BDP is in
1208
+ // place.
1209
+ MutexLock lock(&transport_mutex_);
1210
+ if (GetActiveStreamCountLocked() == 0) {
1211
+ AddPeriodicUpdatePromiseWaker();
1212
+ return Pending{};
1213
+ }
1214
+ }
1215
+ return absl::OkStatus();
1216
+ },
1217
+ []() -> LoopCtl<absl::Status> { return Continue{}; });
1218
+ }));
1219
+ }
1220
+
1221
+ //////////////////////////////////////////////////////////////////////////////
1222
+ // Stream List Operations
1223
+
1224
+ RefCountedPtr<Stream> Http2ServerTransport::LookupStream(uint32_t stream_id) {
1225
+ MutexLock lock(&transport_mutex_);
1226
+ auto it = stream_list_.find(stream_id);
1227
+ if (it == stream_list_.end()) {
1228
+ GRPC_HTTP2_SERVER_DLOG
1229
+ << "Http2ServerTransport::LookupStream Stream not found stream_id="
1230
+ << stream_id;
1231
+ return nullptr;
1232
+ }
1233
+ return it->second;
1234
+ }
1235
+
1236
+ void Http2ServerTransport::AddToStreamList(RefCountedPtr<Stream> stream) {
1237
+ bool should_wake_periodic_updates = false;
1238
+ {
1239
+ MutexLock lock(&transport_mutex_);
1240
+ GRPC_DCHECK(stream != nullptr) << "stream is null";
1241
+ GRPC_DCHECK_GT(stream->GetStreamId(), 0u) << "stream id is invalid";
1242
+ GRPC_HTTP2_SERVER_DLOG
1243
+ << "Http2ServerTransport::AddToStreamList for stream id: "
1244
+ << stream->GetStreamId();
1245
+ const uint32_t stream_id = stream->GetStreamId();
1246
+ stream_list_.emplace(stream_id, std::move(stream));
1247
+ // TODO(tjagtap) [PH2][P2][BDP] Remove this when the BDP code is done.
1248
+ if (GetActiveStreamCountLocked() == 1) {
1249
+ should_wake_periodic_updates = true;
1250
+ }
1251
+ }
1252
+ // TODO(tjagtap) [PH2][P2][BDP] Remove this when the BDP code is done.
1253
+ if (should_wake_periodic_updates) {
1254
+ // Release the lock before you wake up another promise on the party.
1255
+ WakeupPeriodicUpdatePromise();
1256
+ }
1257
+ }
1258
+
1259
+ absl::Status Http2ServerTransport::MaybeAddStreamToWritableStreamList(
1260
+ RefCountedPtr<Stream> stream,
1261
+ const StreamDataQueue<ServerMetadataHandle>::StreamWritabilityUpdate
1262
+ result) {
1263
+ if (result.became_writable) {
1264
+ GRPC_HTTP2_SERVER_DLOG
1265
+ << "Http2ServerTransport::MaybeAddStreamToWritableStreamList Stream "
1266
+ "id: "
1267
+ << stream->GetStreamId() << " became writable";
1268
+ // TODO(akshitpatel) [PH2][P4][Perf]: Might be worth exploring if this
1269
+ // function should take a raw stream ptr and take a ref here.
1270
+ absl::Status status =
1271
+ writable_stream_list_.Enqueue(std::move(stream), result.priority);
1272
+ if (!status.ok()) {
1273
+ return HandleError(
1274
+ /*stream=*/nullptr,
1275
+ Http2Status::Http2ConnectionError(
1276
+ Http2ErrorCode::kRefusedStream,
1277
+ std::string(GrpcErrors::kFailedToEnqueueStream)));
1278
+ }
1279
+ }
1280
+ return absl::OkStatus();
1281
+ }
1282
+
1283
+ //////////////////////////////////////////////////////////////////////////////
1284
+ // Stream Operations
1285
+ auto Http2ServerTransport::HandleMetadataAndMessages(
1286
+ RefCountedPtr<Stream> stream) {
1287
+ auto send_message = [this, stream](MessageHandle&& message) mutable {
1288
+ return TrySeq(HandleStreamErrorOnFailure(
1289
+ stream->EnqueueMessage(std::move(message)), stream),
1290
+ [this, stream](const StreamWritabilityUpdate result) mutable {
1291
+ GRPC_HTTP2_SERVER_DLOG
1292
+ << "Http2ServerTransport::HandleMetadataAndMessages "
1293
+ "Enqueued Message";
1294
+ return MaybeAddStreamToWritableStreamList(std::move(stream),
1295
+ result);
1296
+ });
1297
+ };
1298
+
1299
+ auto send_initial_metadata = [this, stream](
1300
+ ServerMetadataHandle&& metadata) mutable {
1301
+ absl::StatusOr<StreamWritabilityUpdate> enqueue_result =
1302
+ stream->EnqueueInitialMetadata(
1303
+ std::forward<ServerMetadataHandle>(metadata));
1304
+ if (GPR_UNLIKELY(!enqueue_result.ok())) {
1305
+ absl::Status status = enqueue_result.status();
1306
+ GRPC_UNUSED absl::Status unused = HandleError(
1307
+ stream, Http2Status::AbslStreamError(status.code(),
1308
+ std::string(status.message())));
1309
+ return status;
1310
+ }
1311
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::HandleMetadataAndMessages "
1312
+ "Enqueued Initial Metadata";
1313
+ return MaybeAddStreamToWritableStreamList(std::move(stream),
1314
+ enqueue_result.value());
1315
+ };
1316
+
1317
+ return TrySeq(
1318
+ Map(stream->GetCallInitiator().PullServerInitialMetadata(),
1319
+ [send_initial_metadata = std::move(send_initial_metadata)](
1320
+ std::optional<ServerMetadataHandle> initial_metadata) mutable {
1321
+ if (initial_metadata.has_value()) {
1322
+ return send_initial_metadata(std::move(initial_metadata).value());
1323
+ }
1324
+ return absl::OkStatus();
1325
+ }),
1326
+ ForEach(MessagesFrom(stream->GetCallInitiator()),
1327
+ std::move(send_message)));
1328
+ }
1329
+
1330
+ auto Http2ServerTransport::CallOutboundLoop(RefCountedPtr<Stream> stream) {
1331
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::CallOutboundLoop";
1332
+ GRPC_DCHECK(stream != nullptr);
1333
+
1334
+ auto send_trailing_metadata =
1335
+ [this, stream](ServerMetadataHandle&& metadata) mutable {
1336
+ absl::StatusOr<StreamWritabilityUpdate> enqueue_result =
1337
+ stream->EnqueueTrailingMetadata(std::move(metadata));
1338
+ if (GPR_UNLIKELY(!enqueue_result.ok())) {
1339
+ GRPC_HTTP2_SERVER_DLOG
1340
+ << "Http2ServerTransport::CallOutboundLoop Failed to enqueue "
1341
+ "trailing metadata: "
1342
+ << enqueue_result.status();
1343
+ return enqueue_result.status();
1344
+ }
1345
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::CallOutboundLoop "
1346
+ "Enqueued Trailing Metadata";
1347
+ return MaybeAddStreamToWritableStreamList(std::move(stream),
1348
+ enqueue_result.value());
1349
+ };
1350
+
1351
+ return GRPC_LATENT_SEE_PROMISE(
1352
+ "Ph2CallOutboundLoop",
1353
+ Seq(Map(HandleMetadataAndMessages(stream),
1354
+ [stream = stream.get()](absl::Status&& status) {
1355
+ GRPC_HTTP2_SERVER_DLOG
1356
+ << "Http2ServerTransport::CallOutboundLoop "
1357
+ "Completed initial metadata and messages with status: "
1358
+ << status;
1359
+ return Empty{};
1360
+ }),
1361
+ [stream, send_trailing_metadata =
1362
+ std::move(send_trailing_metadata)]() mutable {
1363
+ return Map(
1364
+ stream->GetCallInitiator().PullServerTrailingMetadata(),
1365
+ [send_trailing_metadata = std::move(send_trailing_metadata)](
1366
+ ServerMetadataHandle&& metadata) mutable {
1367
+ GRPC_HTTP2_SERVER_DLOG
1368
+ << "Http2ServerTransport::CallOutboundLoop "
1369
+ "Received Server Trailing Metadata";
1370
+ return send_trailing_metadata(std::move(metadata));
1371
+ });
1372
+ }));
1373
+ }
1374
+
1375
+ absl::Status Http2ServerTransport::InitializeStream(
1376
+ GRPC_UNUSED Stream& stream) {
1377
+ GRPC_DCHECK(false) << "Should not be called for server";
1378
+ return absl::OkStatus();
1379
+ }
1380
+
1381
+ std::optional<RefCountedPtr<Stream>> Http2ServerTransport::MakeStream(
1382
+ CallInitiator&& call_initiator, const uint32_t stream_id) {
1383
+ RefCountedPtr<Stream> stream =
1384
+ MakeRefCounted<Stream>(call_initiator, flow_control_, stream_id,
1385
+ settings_->peer().allow_true_binary_metadata());
1386
+ const bool on_done_added = SetOnDone(stream);
1387
+ if (!on_done_added) return std::nullopt;
1388
+ return std::move(stream);
1389
+ }
1390
+
1391
+ Http2Status Http2ServerTransport::IncomingStream(
1392
+ ClientMetadataHandle&& metadata, const uint32_t stream_id) {
1393
+ {
1394
+ MutexLock lock(&transport_mutex_);
1395
+ if (is_transport_closed_) {
1396
+ return Http2Status::Http2ConnectionError(Http2ErrorCode::kRefusedStream,
1397
+ "Transport is closed.");
1398
+ }
1399
+ }
1400
+
1401
+ GRPC_DCHECK(LookupStream(stream_id) == nullptr);
1402
+
1403
+ // TODO(tjagtap) : [PH2][P1] : Evaluate use of
1404
+ // SimpleArenaAllocator vs CallArenaAllocator here.
1405
+ RefCountedPtr<Arena> arena = SimpleArenaAllocator(0)->MakeArena();
1406
+ arena->SetContext<EventEngine>(event_engine_.get());
1407
+ CallInitiatorAndHandler call =
1408
+ MakeCallPair(std::move(metadata), std::move(arena));
1409
+
1410
+ // TODO(akshitpatel) : [PH2][P2] : For the server side, MakeStream most likely
1411
+ // will not fail. Evaluate this.
1412
+ std::optional<RefCountedPtr<Stream>> result =
1413
+ MakeStream(std::move(call.initiator), stream_id);
1414
+ if (!result.has_value()) {
1415
+ return Http2Status::Http2StreamError(
1416
+ Http2ErrorCode::kInternalError,
1417
+ std::string(GrpcErrors::kStreamCreationFailed));
1418
+ }
1419
+ RefCountedPtr<Stream> stream = std::move(result.value());
1420
+ AddToStreamList(stream);
1421
+ stream->SetInitialMetadataReceived();
1422
+
1423
+ stream->GetCallInitiator().SpawnGuarded(
1424
+ "CallOutboundLoop",
1425
+ [self = RefAsSubclass<Http2ServerTransport>(), stream = std::move(stream),
1426
+ call_handler = std::move(call.handler)]() mutable {
1427
+ self->call_destination_->StartCall(std::move(call_handler));
1428
+ return Map(self->CallOutboundLoop(std::move(stream)),
1429
+ [self](absl::Status status) { return status; });
1430
+ });
1431
+ return Http2Status::Ok();
1432
+ }
1433
+
1434
+ void Http2ServerTransport::BeginCloseStream(
1435
+ RefCountedPtr<Stream> stream, uint32_t reset_stream_error_code,
1436
+ absl::Status trailing_metadata_status, DebugLocation whence) {
1437
+ GRPC_DCHECK(!trailing_metadata_status.ok());
1438
+ if (stream == nullptr) {
1439
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::BeginCloseStream stream"
1440
+ "is null reset_stream_error_code="
1441
+ << reset_stream_error_code
1442
+ << " status=" << trailing_metadata_status;
1443
+ return;
1444
+ }
1445
+
1446
+ GRPC_HTTP2_SERVER_DLOG
1447
+ << "Http2ServerTransport::BeginCloseStream for stream id: "
1448
+ << stream->GetStreamId() << " error_code=" << reset_stream_error_code
1449
+ << " Status=" << trailing_metadata_status << " location=" << whence.file()
1450
+ << ":" << whence.line();
1451
+
1452
+ // Enqueue RST_STREAM.
1453
+ absl::StatusOr<StreamWritabilityUpdate> enqueue_result =
1454
+ stream->EnqueueResetStream(reset_stream_error_code);
1455
+ GRPC_HTTP2_SERVER_DLOG << "Enqueued ResetStream with error code="
1456
+ << reset_stream_error_code
1457
+ << " status=" << enqueue_result.status();
1458
+ if (enqueue_result.ok()) {
1459
+ GRPC_UNUSED absl::Status status =
1460
+ MaybeAddStreamToWritableStreamList(stream, enqueue_result.value());
1461
+ }
1462
+ HandleStreamStateChange(
1463
+ *stream, stream->OnInitiateReset(std::move(trailing_metadata_status)));
1464
+ read_context_.OnResetFrameEnqueued(reset_stream_error_code);
1465
+ }
1466
+
1467
+ void Http2ServerTransport::HandleStreamStateChange(Stream& stream,
1468
+ StreamStateChange change) {
1469
+ if (change.reads_became_closed) {
1470
+ // If a stream is closing for reads and was actively waiting for a
1471
+ // continuation frame, parse the buffered HEADER/CONTINUATION frames
1472
+ if (read_context_.IsWaitingForContinuationFrame() &&
1473
+ read_context_.GetStreamId() == stream.GetStreamId()) {
1474
+ Http2Status result = read_context_.ParseAndDiscardHeaders(
1475
+ SliceBuffer(), /*is_end_headers=*/false,
1476
+ /*original_status=*/Http2Status::Ok(),
1477
+ settings_->acked().max_header_list_size());
1478
+ if (result.GetType() == Http2Status::Http2ErrorType::kConnectionError) {
1479
+ GRPC_HTTP2_SERVER_DLOG
1480
+ << "Http2ServerTransport::HandleStreamStateChange (DiscardHeaders) "
1481
+ "for stream id: "
1482
+ << stream.GetStreamId()
1483
+ << " failed to partially process header : " << result.DebugString();
1484
+ GRPC_UNUSED absl::Status status =
1485
+ HandleError(/*stream=*/nullptr, std::move(result));
1486
+ return;
1487
+ }
1488
+ }
1489
+ }
1490
+ if (change.stream_became_closed) {
1491
+ CleanupStream(stream);
1492
+ }
1493
+ }
1494
+
1495
+ void Http2ServerTransport::CleanupStream(Stream& stream) {
1496
+ bool should_close = false;
1497
+ {
1498
+ MutexLock lock(&transport_mutex_);
1499
+ stream_list_.erase(stream.GetStreamId());
1500
+ // Close transport if graceful GOAWAY has been sent and there are no more
1501
+ // streams.
1502
+ if (goaway_manager_.IsFinalGracefulGoawaySent() && stream_list_.empty()) {
1503
+ should_close = true;
1504
+ }
1505
+ }
1506
+ if (should_close) {
1507
+ MaybeSpawnCloseTransport(Http2Status::AbslConnectionError(
1508
+ absl::StatusCode::kUnavailable, "Graceful shutdown complete."));
1509
+ }
1510
+ }
1511
+
1512
+ absl::Status Http2ServerTransport::UpdateAllStreamsWritability() {
1513
+ MutexLock lock(&transport_mutex_);
1514
+ GRPC_HTTP2_SERVER_DLOG
1515
+ << "Http2ServerTransport::UpdateAllStreamsWritability total streams: "
1516
+ << stream_list_.size();
1517
+ // This loop iterates over all active streams. For each stream this would
1518
+ // internally take a stream specific lock and update the stream writability.
1519
+ // This is not optimal but should be fine as this function is only called when
1520
+ // initial window size is increased which in theory should not be very
1521
+ // frequent.
1522
+ for (const auto& [stream_id, stream] : stream_list_) {
1523
+ StreamWritabilityUpdate update =
1524
+ stream->UpdateStreamWritability(GetStreamFlowControlTokens(
1525
+ stream->GetStreamFlowControl(), settings_->peer()));
1526
+ absl::Status status = MaybeAddStreamToWritableStreamList(stream, update);
1527
+ if (GPR_UNLIKELY(!status.ok())) {
1528
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::"
1529
+ "UpdateAllStreamsWritability failed for stream "
1530
+ << stream_id << " with status " << status;
1531
+ return status;
1532
+ }
1533
+ }
1534
+
1535
+ return absl::OkStatus();
1536
+ }
1537
+
1538
+ //////////////////////////////////////////////////////////////////////////////
1539
+ // Ping Keepalive and Goaway
1540
+
1541
+ void Http2ServerTransport::MaybeSpawnPingTimeout(
1542
+ std::optional<uint64_t> opaque_data) {
1543
+ if (opaque_data.has_value()) {
1544
+ SpawnGuardedTransportParty(
1545
+ "PingTimeout", [self = RefAsSubclass<Http2ServerTransport>(),
1546
+ opaque_data = *opaque_data]() {
1547
+ return self->ping_manager_->TimeoutPromise(opaque_data);
1548
+ });
1549
+ }
1550
+ }
1551
+ void Http2ServerTransport::MaybeSpawnDelayedPing(
1552
+ std::optional<Duration> delayed_ping_wait) {
1553
+ if (delayed_ping_wait.has_value()) {
1554
+ SpawnGuardedTransportParty(
1555
+ "DelayedPing", [self = RefAsSubclass<Http2ServerTransport>(),
1556
+ wait = *delayed_ping_wait]() {
1557
+ GRPC_HTTP2_PING_LOG << "Scheduling delayed ping after wait=" << wait;
1558
+ return self->ping_manager_->DelayedPingPromise(wait);
1559
+ });
1560
+ }
1561
+ }
1562
+
1563
+ absl::Status Http2ServerTransport::AckPing(uint64_t opaque_data) {
1564
+ // It is possible that the PingRatePolicy may decide to not send a ping
1565
+ // request (in cases like the number of inflight pings is too high).
1566
+ // When this happens, it becomes important to ensure that if a ping ack
1567
+ // is received and there is an "important" outstanding ping request, we
1568
+ // should retry to send it out now.
1569
+ if (ping_manager_->AckPing(opaque_data)) {
1570
+ if (ping_manager_->ImportantPingRequested()) {
1571
+ return TriggerWriteCycle();
1572
+ }
1573
+ } else {
1574
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::AckPing Unknown ping "
1575
+ "response received for ping id="
1576
+ << opaque_data;
1577
+ }
1578
+
1579
+ return absl::OkStatus();
1580
+ }
1581
+
1582
+ void Http2ServerTransport::MaybeSpawnKeepaliveLoop() {
1583
+ if (keepalive_manager_->IsKeepAliveLoopNeeded()) {
1584
+ SpawnGuardedTransportParty(
1585
+ "KeepaliveLoop", [self = RefAsSubclass<Http2ServerTransport>()]() {
1586
+ return self->keepalive_manager_->KeepaliveLoop();
1587
+ });
1588
+ }
1589
+ }
1590
+
1591
+ auto Http2ServerTransport::SpawnGracefulGoawayPromise(Slice&& debug_data) {
1592
+ SpawnGuardedTransportParty(
1593
+ "GracefulGoaway",
1594
+ [self = RefAsSubclass<Http2ServerTransport>(),
1595
+ debug_data = std::forward<Slice>(debug_data)]() mutable {
1596
+ GRPC_HTTP2_SERVER_DLOG
1597
+ << "Http2ServerTransport::SpawnGracefulGoawayPromise: "
1598
+ "Initiated graceful GOAWAY";
1599
+ return self->UntilTransportClosed(Map(
1600
+ self->goaway_manager_.RequestGoaway(
1601
+ Http2ErrorCode::kNoError, std::move(debug_data),
1602
+ self->last_incoming_stream_id_, /*immediate=*/false),
1603
+ [self](absl::Status status) {
1604
+ bool should_close = false;
1605
+ {
1606
+ MutexLock lock(&self->transport_mutex_);
1607
+ if (self->GetActiveStreamCountLocked() == 0) {
1608
+ should_close = true;
1609
+ }
1610
+ }
1611
+ if (should_close) {
1612
+ self->MaybeSpawnCloseTransport(Http2Status::AbslConnectionError(
1613
+ absl::StatusCode::kUnavailable,
1614
+ "Graceful shutdown complete."));
1615
+ }
1616
+ return status;
1617
+ }));
1618
+ });
1619
+ }
1620
+
1621
+ //////////////////////////////////////////////////////////////////////////////
1622
+ // Error Path and Close Path
1623
+
1624
+ absl::Status Http2ServerTransport::HandleError(RefCountedPtr<Stream> stream,
1625
+ Http2Status status,
1626
+ DebugLocation whence) {
1627
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::HandleError for stream id="
1628
+ << (stream != nullptr
1629
+ ? absl::StrCat(stream->GetStreamId())
1630
+ : "nullopt")
1631
+ << " status=" << status.DebugString()
1632
+ << " location=" << whence.file() << ":"
1633
+ << whence.line();
1634
+ Http2Status::Http2ErrorType error_type = status.GetType();
1635
+ GRPC_DCHECK(error_type != Http2Status::Http2ErrorType::kOk);
1636
+
1637
+ if (error_type == Http2Status::Http2ErrorType::kConnectionError) {
1638
+ GRPC_DCHECK(stream == nullptr);
1639
+ absl::Status absl_status = status.GetAbslConnectionError();
1640
+ MaybeSpawnCloseTransport(std::move(status), whence);
1641
+ return absl_status;
1642
+ } else if (error_type == Http2Status::Http2ErrorType::kStreamError) {
1643
+ uint32_t reset_stream_error_code =
1644
+ Http2ErrorCodeToFrameErrorCode(status.GetStreamErrorCode());
1645
+ if (stream != nullptr) {
1646
+ BeginCloseStream(std::move(stream), reset_stream_error_code,
1647
+ status.GetAbslStreamError(), whence);
1648
+ }
1649
+ return absl::OkStatus();
1650
+ }
1651
+
1652
+ GPR_UNREACHABLE_CODE(return absl::InternalError("Invalid error type"));
1653
+ }
1654
+
1655
+ void Http2ServerTransport::MaybeSpawnCloseTransport(Http2Status http2_status,
1656
+ DebugLocation whence) {
1657
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::MaybeSpawnCloseTransport "
1658
+ "status="
1659
+ << http2_status.DebugString()
1660
+ << " location=" << whence.file() << ":"
1661
+ << whence.line();
1662
+
1663
+ ReleasableMutexLock lock(&transport_mutex_);
1664
+ if (is_transport_closed_) {
1665
+ lock.Release();
1666
+ return;
1667
+ }
1668
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::MaybeSpawnCloseTransport "
1669
+ "Initiating transport close";
1670
+ is_transport_closed_ = true;
1671
+ absl::flat_hash_map<uint32_t, RefCountedPtr<Stream>> stream_list =
1672
+ std::move(stream_list_);
1673
+ stream_list_.clear();
1674
+ ReportDisconnectionLocked(
1675
+ GRPC_CHANNEL_SHUTDOWN, http2_status.GetAbslConnectionError(), {},
1676
+ absl::StrCat("Transport closed: ", http2_status.DebugString()).c_str());
1677
+ lock.Release();
1678
+
1679
+ SpawnInfallibleTransportParty(
1680
+ "CloseTransport",
1681
+ [self = RefAsSubclass<Http2ServerTransport>(),
1682
+ stream_list = std::move(stream_list),
1683
+ http2_status = std::move(http2_status), whence]() mutable {
1684
+ self->security_frame_handler_->OnTransportClosed();
1685
+ GRPC_HTTP2_SERVER_DLOG
1686
+ << "Http2ServerTransport::MaybeSpawnCloseTransport "
1687
+ "Cleaning up call stacks";
1688
+ // Clean up the call stacks for all active streams.
1689
+ for (const auto& pair : stream_list) {
1690
+ RefCountedPtr<Stream> stream = pair.second;
1691
+ self->BeginCloseStream(std::move(stream),
1692
+ Http2ErrorCodeToFrameErrorCode(
1693
+ http2_status.GetConnectionErrorCode()),
1694
+ http2_status.GetAbslConnectionError(), whence);
1695
+ }
1696
+
1697
+ // Sleep for kGoawaySendTimeoutSeconds before closing the transport to
1698
+ // let write buffers drain.
1699
+ return Map(
1700
+ Race(AssertResultType<absl::Status>(
1701
+ self->goaway_manager_.RequestGoaway(
1702
+ http2_status.GetConnectionErrorCode(),
1703
+ Slice::FromCopiedString(std::string(
1704
+ http2_status.GetAbslConnectionError().message())),
1705
+ self->last_incoming_stream_id_, /*immediate=*/true)),
1706
+ Sleep(Duration::Seconds(kGoawaySendTimeoutSeconds))),
1707
+ [self](auto) mutable {
1708
+ self->CloseTransport();
1709
+ return Empty{};
1710
+ });
1711
+ });
1712
+ }
1713
+
1714
+ void Http2ServerTransport::CloseTransport() {
1715
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::CloseTransport";
1716
+
1717
+ transport_closed_latch_.Set();
1718
+ settings_->HandleTransportShutdown(event_engine_.get());
1719
+
1720
+ if (on_close_callback_ != nullptr) {
1721
+ ExecCtx::Run(DEBUG_LOCATION, on_close_callback_, absl::OkStatus());
1722
+ on_close_callback_ = nullptr;
1723
+ }
1724
+
1725
+ general_party_.reset();
1726
+ }
1727
+
1728
+ //////////////////////////////////////////////////////////////////////////////
1729
+ // Misc Transport Stuff
1730
+
1731
+ void Http2ServerTransport::ReportDisconnection(
1732
+ const grpc_connectivity_state state, const absl::Status& status,
1733
+ StateWatcher::DisconnectInfo disconnect_info, const char* reason) {
1734
+ MutexLock lock(&transport_mutex_);
1735
+ ReportDisconnectionLocked(state, status, disconnect_info, reason);
1736
+ }
1737
+
1738
+ void Http2ServerTransport::ReportDisconnectionLocked(
1739
+ const grpc_connectivity_state state, const absl::Status& status,
1740
+ StateWatcher::DisconnectInfo disconnect_info, const char* reason) {
1741
+ GRPC_HTTP2_SERVER_DLOG
1742
+ << "Http2ServerTransport::ReportDisconnectionLocked status="
1743
+ << status.ToString() << "; reason=" << reason;
1744
+ state_tracker_.SetState(state, status, reason);
1745
+ NotifyStateWatcherOnDisconnectLocked(status, disconnect_info);
1746
+ }
1747
+
1748
+ bool Http2ServerTransport::SetOnDone(RefCountedPtr<Stream> stream) {
1749
+ // TODO(akshitpatel) : [PH2][P0] : Implement this.
1750
+ return stream->GetCallInitiator().OnDone(
1751
+ [self = RefAsSubclass<Http2ServerTransport>(),
1752
+ stream = std::move(stream)](GRPC_UNUSED bool cancelled) mutable {});
1753
+ }
1754
+ // return call_handler.OnDone([self = RefAsSubclass<Http2ServerTransport>(),
1755
+ // stream =
1756
+ // std::move(stream)](bool cancelled) mutable
1757
+ // {
1758
+ // GRPC_HTTP2_SERVER_DLOG << "PH2: Client call " << self.get()
1759
+ // << " id=" << stream->GetStreamId()
1760
+ // << " done: cancelled=" << cancelled;
1761
+ // absl::StatusOr<StreamWritabilityUpdate> enqueue_result;
1762
+ // GRPC_HTTP2_SERVER_DLOG << "PH2: Client call " << self.get()
1763
+ // << " id=" << stream->GetStreamId()
1764
+ // << " done: stream=" << stream.get()
1765
+ // << " cancelled=" << cancelled;
1766
+
1767
+ // // If the stream is already closed for writes, then we don't need to
1768
+ // // enqueue the reset stream or the half closed frame.
1769
+ // if (stream->IsClosedForWrites()) {
1770
+ // GRPC_HTTP2_SERVER_DLOG << "PH2: Client call " << self.get()
1771
+ // << " id=" << stream->GetStreamId()
1772
+ // << " done: stream already closed for writes";
1773
+ // return;
1774
+ // }
1775
+
1776
+ // if (cancelled) {
1777
+ // // In most of the cases, EnqueueResetStream would be a no-op as
1778
+ // // BeginCloseStream would have already enqueued the reset stream.
1779
+ // // Currently only Aborts from application will actually enqueue
1780
+ // // the reset stream here.
1781
+ // enqueue_result = stream->EnqueueResetStream(
1782
+ // static_cast<uint32_t>(Http2ErrorCode::kCancel));
1783
+ // GRPC_HTTP2_SERVER_DLOG << "Enqueued ResetStream with error code="
1784
+ // <<
1785
+ // static_cast<uint32_t>(Http2ErrorCode::kCancel)
1786
+ // << " status=" << enqueue_result.status();
1787
+ // } else {
1788
+ // enqueue_result = stream->EnqueueHalfClosed();
1789
+ // GRPC_HTTP2_SERVER_DLOG << "Enqueued HalfClosed with result="
1790
+ // << enqueue_result.status();
1791
+ // }
1792
+
1793
+ // if (GPR_LIKELY(enqueue_result.ok())) {
1794
+ // GRPC_HTTP2_SERVER_DLOG
1795
+ // << "Http2ServerTransport::SetOnDone "
1796
+ // "MaybeAddStreamToWritableStreamList for stream= "
1797
+ // << stream->GetStreamId() << " enqueue_result={became_writable="
1798
+ // << enqueue_result.value().became_writable << ", priority="
1799
+ // << static_cast<uint8_t>(enqueue_result.value().priority) << "}";
1800
+ // GRPC_UNUSED absl::Status status =
1801
+ // self->MaybeAddStreamToWritableStreamList(std::move(stream),
1802
+ // enqueue_result.value());
1803
+ // }
1804
+ // });
1805
+ // }
1806
+
1807
+ void Http2ServerTransport::ReadChannelArgs(const ChannelArgs& channel_args,
1808
+ TransportChannelArgs& args) {
1809
+ http2::ReadChannelArgs(channel_args, args, settings_->mutable_local(),
1810
+ flow_control_,
1811
+ /*is_client=*/kIsClient);
1812
+
1813
+ // Assign the channel args to the member variables.
1814
+ keepalive_time_ = args.keepalive_time;
1815
+ read_context_.set_soft_limit(args.max_header_list_size_soft_limit);
1816
+ keepalive_permit_without_calls_ = args.keepalive_permit_without_calls;
1817
+ test_only_ack_pings_ = args.test_only_ack_pings;
1818
+
1819
+ settings_->SetSettingsTimeout(args.settings_timeout);
1820
+ if (args.max_usable_hpack_table_size >= 0) {
1821
+ encoder_.SetMaxUsableSize(args.max_usable_hpack_table_size);
1822
+ }
1823
+ }
1824
+
1825
+ //////////////////////////////////////////////////////////////////////////////
1826
+ // Inner Classes and Structs
1827
+
1828
+ std::unique_ptr<PingInterface>
1829
+ Http2ServerTransport::PingSystemInterfaceImpl::Make(
1830
+ Http2ServerTransport* transport) {
1831
+ return std::make_unique<PingSystemInterfaceImpl>(
1832
+ PingSystemInterfaceImpl(transport));
1833
+ }
1834
+
1835
+ absl::Status Http2ServerTransport::PingSystemInterfaceImpl::TriggerWrite() {
1836
+ return transport_->TriggerWriteCycle();
1837
+ }
1838
+
1839
+ Promise<absl::Status>
1840
+ Http2ServerTransport::PingSystemInterfaceImpl::PingTimeout() {
1841
+ GRPC_HTTP2_SERVER_DLOG << "PingSystemInterfaceImpl::PingTimeout at time: "
1842
+ << Timestamp::Now();
1843
+
1844
+ // TODO(akshitpatel) : [PH2][P2] : The error code here has been chosen
1845
+ // based on CHTTP2's usage of GRPC_STATUS_UNAVAILABLE (which corresponds
1846
+ // to kRefusedStream). However looking at RFC9113, definition of
1847
+ // kRefusedStream doesn't seem to fit this case. We should revisit this
1848
+ // and update the error code.
1849
+ return Immediate(transport_->HandleError(
1850
+ nullptr,
1851
+ Http2Status::Http2ConnectionError(Http2ErrorCode::kRefusedStream,
1852
+ GRPC_CHTTP2_PING_TIMEOUT_STR)));
1853
+ }
1854
+
1855
+ std::unique_ptr<KeepAliveInterface>
1856
+ Http2ServerTransport::KeepAliveInterfaceImpl::Make(
1857
+ Http2ServerTransport* transport) {
1858
+ return std::make_unique<KeepAliveInterfaceImpl>(
1859
+ KeepAliveInterfaceImpl(transport));
1860
+ }
1861
+
1862
+ Promise<absl::Status>
1863
+ Http2ServerTransport::KeepAliveInterfaceImpl::SendPingAndWaitForAck() {
1864
+ return TrySeq(
1865
+ [transport = transport_] { return transport->TriggerWriteCycle(); },
1866
+ [transport = transport_] { return transport->WaitForPingAck(); });
1867
+ }
1868
+
1869
+ Promise<absl::Status>
1870
+ Http2ServerTransport::KeepAliveInterfaceImpl::OnKeepAliveTimeout() {
1871
+ GRPC_HTTP2_SERVER_DLOG
1872
+ << "KeepAliveInterfaceImpl::OnKeepAliveTimeout triggered";
1873
+ // TODO(akshitpatel) : [PH2][P2] : The error code here has been chosen
1874
+ // based on CHTTP2's usage of GRPC_STATUS_UNAVAILABLE (which corresponds
1875
+ // to kRefusedStream). However looking at RFC9113, definition of
1876
+ // kRefusedStream doesn't seem to fit this case. We should revisit this
1877
+ // and update the error code.
1878
+ return Immediate(transport_->HandleError(
1879
+ nullptr,
1880
+ Http2Status::Http2ConnectionError(Http2ErrorCode::kRefusedStream,
1881
+ GRPC_CHTTP2_KEEPALIVE_TIMEOUT_STR)));
1882
+ }
1883
+
1884
+ bool Http2ServerTransport::KeepAliveInterfaceImpl::NeedToSendKeepAlivePing() {
1885
+ bool need_to_send_ping = false;
1886
+ {
1887
+ MutexLock lock(&transport_->transport_mutex_);
1888
+ need_to_send_ping = (transport_->keepalive_permit_without_calls_ ||
1889
+ transport_->GetActiveStreamCountLocked() > 0);
1890
+ }
1891
+ return need_to_send_ping;
1892
+ }
1893
+
1894
+ std::unique_ptr<GoawayInterface>
1895
+ Http2ServerTransport::GoawayInterfaceImpl::Make(
1896
+ Http2ServerTransport* transport) {
1897
+ return std::make_unique<GoawayInterfaceImpl>(GoawayInterfaceImpl(transport));
1898
+ }
1899
+
1900
+ uint32_t Http2ServerTransport::GoawayInterfaceImpl::GetLastAcceptedStreamId() {
1901
+ return transport_->last_incoming_stream_id_;
1902
+ }
1903
+
1904
+ //////////////////////////////////////////////////////////////////////////////
1905
+ // Constructor, Destructor etc.
1906
+
1907
+ Http2ServerTransport::Http2ServerTransport(
1908
+ PromiseEndpoint endpoint, const ChannelArgs& channel_args,
1909
+ std::shared_ptr<EventEngine> event_engine,
1910
+ absl::AnyInvocable<void(absl::StatusOr<uint32_t>)> on_receive_settings,
1911
+ grpc_closure* on_close_callback)
1912
+ : channelz::DataSource(http2::CreateChannelzSocketNode(
1913
+ endpoint.GetEventEngineEndpoint(), channel_args)),
1914
+ event_engine_(std::move(event_engine)),
1915
+ endpoint_(std::move(endpoint)),
1916
+ settings_(MakeRefCounted<SettingsPromiseManager>(
1917
+ kIsClient, std::move(on_receive_settings))),
1918
+ on_close_callback_(on_close_callback),
1919
+ should_reset_ping_clock_(false),
1920
+ read_context_(MaxNewStreamsPerRead(channel_args), endpoint_, kIsClient,
1921
+ GetMaxSecurityFrameSize(channel_args)),
1922
+ transport_write_context_(kIsClient),
1923
+ ping_manager_(std::nullopt),
1924
+ keepalive_manager_(std::nullopt),
1925
+ goaway_manager_(GoawayInterfaceImpl::Make(this)),
1926
+ memory_owner_(channel_args.GetObject<ResourceQuota>()
1927
+ ->memory_quota()
1928
+ ->CreateMemoryOwner()),
1929
+ flow_control_(
1930
+ /*peer_name=*/read_context_.peer_string().as_string_view(),
1931
+ channel_args.GetBool(GRPC_ARG_HTTP2_BDP_PROBE).value_or(true),
1932
+ &memory_owner_),
1933
+ security_frame_handler_(MakeRefCounted<SecurityFrameHandler>()),
1934
+ ztrace_collector_(std::make_shared<PromiseHttp2ZTraceCollector>()) {
1935
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport Constructor Begin";
1936
+
1937
+ // Initialize the general party and write party.
1938
+ RefCountedPtr<Arena> party_arena = SimpleArenaAllocator(0)->MakeArena();
1939
+ party_arena->SetContext<EventEngine>(event_engine_.get());
1940
+ general_party_ = Party::Make(std::move(party_arena));
1941
+
1942
+ InitLocalSettings(settings_->mutable_local(), /*is_client=*/kIsClient);
1943
+ TransportChannelArgs args;
1944
+ ReadChannelArgs(channel_args, args);
1945
+
1946
+ ping_manager_.emplace(channel_args, args.ping_timeout,
1947
+ PingSystemInterfaceImpl::Make(this), event_engine_);
1948
+
1949
+ // The keepalive loop is only spawned if the keepalive time is not infinity.
1950
+ keepalive_manager_.emplace(
1951
+ KeepAliveInterfaceImpl::Make(this),
1952
+ ((args.keepalive_timeout < args.ping_timeout) ? args.keepalive_timeout
1953
+ : Duration::Infinity()),
1954
+ args.keepalive_time);
1955
+
1956
+ GRPC_DCHECK(ping_manager_.has_value());
1957
+ GRPC_DCHECK(keepalive_manager_.has_value());
1958
+ SourceConstructed();
1959
+
1960
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport Constructor End";
1961
+ }
1962
+
1963
+ Http2ServerTransport::~Http2ServerTransport() {
1964
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport Destructor Begin";
1965
+ // GRPC_DCHECK(stream_list_.empty());
1966
+ // GRPC_DCHECK(general_party_ == nullptr);
1967
+ // memory_owner_.Reset();
1968
+
1969
+ // TODO(akshitpatel) : [PH2][P0][Close] : Remove call to
1970
+ // HandleTransportShutdown() from here and plumb CloseTransport() correctly.
1971
+ settings_->HandleTransportShutdown(event_engine_.get());
1972
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport Destructor End";
1973
+ }
1974
+
1975
+ //////////////////////////////////////////////////////////////////////////////
1976
+ // Transport Functions
1977
+
1978
+ void Http2ServerTransport::SetCallDestination(
1979
+ RefCountedPtr<UnstartedCallDestination> unstarted_call_destination) {
1980
+ // This is called once in the lifetime of the transport.
1981
+ GRPC_CHECK(call_destination_ == nullptr);
1982
+ GRPC_CHECK(unstarted_call_destination != nullptr);
1983
+ call_destination_ = std::move(unstarted_call_destination);
1984
+ InitializeAndSpawnTransportLoops();
1985
+ }
1986
+
1987
+ void Http2ServerTransport::PerformOp(grpc_transport_op* op) {
1988
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport PerformOp Begin";
1989
+ bool did_stuff = false;
1990
+ if (op->start_connectivity_watch != nullptr) {
1991
+ StartConnectivityWatch(op->start_connectivity_watch_state,
1992
+ std::move(op->start_connectivity_watch));
1993
+ did_stuff = true;
1994
+ }
1995
+ if (op->stop_connectivity_watch != nullptr) {
1996
+ StopConnectivityWatch(op->stop_connectivity_watch);
1997
+ did_stuff = true;
1998
+ }
1999
+ if (!op->disconnect_with_error.ok()) {
2000
+ MaybeSpawnCloseTransport(Http2Status::Http2ConnectionError(
2001
+ AbslStatusCodeToErrorCode(op->disconnect_with_error.code()),
2002
+ std::string(op->disconnect_with_error.message())));
2003
+ did_stuff = true;
2004
+ }
2005
+ // We always consider this case as a graceful shutdown.
2006
+ if (!op->goaway_error.ok()) {
2007
+ GRPC_HTTP2_SERVER_DLOG << "GracefulGoaway triggered with error: "
2008
+ << op->goaway_error;
2009
+ SpawnGracefulGoawayPromise(
2010
+ Slice::FromCopiedString(op->goaway_error.message()));
2011
+ did_stuff = true;
2012
+ }
2013
+ GRPC_DCHECK(did_stuff) << "Unimplemented transport perform op ";
2014
+
2015
+ ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, absl::OkStatus());
2016
+
2017
+ // TODO(tjagtap) : [PH2][P2] :
2018
+ // Refer src/core/ext/transport/chttp2/transport/chttp2_transport.cc
2019
+ // perform_transport_op_locked
2020
+ // Maybe more operations needed to be implemented.
2021
+ // TODO(tjagtap) : [PH2][P2] : Consider either not using a transport level
2022
+ // lock, or making this run on the Transport party - whatever is better.
2023
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport PerformOp End";
2024
+ }
2025
+
2026
+ void Http2ServerTransport::Orphan() {
2027
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::Orphan Begin";
2028
+ SourceDestructing();
2029
+ MaybeSpawnCloseTransport(
2030
+ ToHttpOkOrConnError(absl::UnavailableError("Orphaned")));
2031
+ Unref();
2032
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::Orphan End";
2033
+ }
2034
+
2035
+ void Http2ServerTransport::SpawnTransportLoops() {
2036
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::SpawnTransportLoops Begin";
2037
+ MaybeSpawnKeepaliveLoop();
2038
+
2039
+ // SpawnGuardedTransportParty(
2040
+ // "FlowControlPeriodicUpdateLoop",
2041
+ // UntilTransportClosed(FlowControlPeriodicUpdateLoop()));
2042
+
2043
+ if (!TriggerWriteCycleOrHandleError()) {
2044
+ return;
2045
+ }
2046
+ // For Client, write happens before read. So MultiplexerLoop is spawned first.
2047
+ // ReadLoop is spawned after the first write.
2048
+ // For Server, read happens before write. So ReadLoop is spawned first.
2049
+ SpawnGuardedTransportParty("ReadLoop", UntilTransportClosed(ReadLoop()));
2050
+ SpawnGuardedTransportParty("MultiplexerLoop",
2051
+ UntilTransportClosed(MultiplexerLoop()));
2052
+
2053
+ GRPC_HTTP2_SERVER_DLOG << "Http2ServerTransport::SpawnTransportLoops End";
2054
+ }
2055
+
2056
+ void Http2ServerTransport::InitializeAndSpawnTransportLoops() {
2057
+ SpawnGuardedTransportParty(
2058
+ "SpawnTransportLoops", [self = RefAsSubclass<Http2ServerTransport>()] {
2059
+ return Map(self->EndpointReadSlice(GRPC_CHTTP2_CLIENT_CONNECT_STRLEN),
2060
+ [self](absl::StatusOr<Slice> status) -> absl::Status {
2061
+ Http2Status result =
2062
+ ValidateIncomingConnectionPreface(status);
2063
+ if (!result.IsOk()) {
2064
+ return self->HandleError(nullptr, std::move(result));
2065
+ }
2066
+ self->SpawnTransportLoops();
2067
+ return absl::OkStatus();
2068
+ });
2069
+ });
2070
+ }
2071
+
2072
+ } // namespace http2
2073
+ } // namespace grpc_core