grpc 1.81.0 → 1.82.0.pre1

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