grpc 1.83.1 → 1.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +21 -17
  3. data/include/grpc/credentials.h +10 -0
  4. data/include/grpc/grpc_security_constants.h +2 -0
  5. data/include/grpc/impl/channel_arg_names.h +9 -0
  6. data/src/core/call/call_filters.h +4 -2
  7. data/src/core/call/client_call.cc +20 -8
  8. data/src/core/call/client_call.h +4 -0
  9. data/src/core/call/interception_chain.cc +2 -0
  10. data/src/core/call/interception_chain.h +14 -1
  11. data/src/core/call/metadata.cc +1 -3
  12. data/src/core/call/metadata_batch.h +13 -5
  13. data/src/core/call/server_call.cc +31 -14
  14. data/src/core/call/server_call.h +4 -0
  15. data/src/core/channelz/text_encode.cc +9 -4
  16. data/src/core/channelz/v2tov1/convert.cc +2 -2
  17. data/src/core/client_channel/backup_poller.cc +1 -2
  18. data/src/core/client_channel/client_channel.cc +6 -33
  19. data/src/core/client_channel/client_channel_filter.cc +22 -55
  20. data/src/core/client_channel/client_channel_filter.h +2 -2
  21. data/src/core/client_channel/client_channel_service_config.cc +3 -19
  22. data/src/core/client_channel/direct_channel.cc +7 -1
  23. data/src/core/client_channel/direct_channel.h +2 -2
  24. data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
  25. data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
  26. data/src/core/client_channel/subchannel.cc +310 -1058
  27. data/src/core/client_channel/subchannel.h +44 -329
  28. data/src/core/client_channel/subchannel_metrics.cc +48 -0
  29. data/src/core/client_channel/subchannel_metrics.h +60 -0
  30. data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
  31. data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
  32. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
  33. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
  34. data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
  35. data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
  36. data/src/core/credentials/call/json_util.h +1 -0
  37. data/src/core/credentials/call/jwt/json_token.cc +10 -2
  38. data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
  39. data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
  40. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
  41. data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
  42. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
  43. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
  44. data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
  45. data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
  46. data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
  47. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
  48. data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
  49. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
  50. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
  51. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
  52. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
  53. data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
  54. data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
  55. data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
  56. data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
  57. data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
  58. data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
  59. data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
  60. data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
  61. data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
  62. data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
  63. data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
  64. data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
  65. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
  66. data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
  67. data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
  68. data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
  69. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
  70. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
  71. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
  72. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +32 -67
  73. data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
  74. data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
  75. data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
  76. data/src/core/ext/transport/chttp2/transport/frame_data.cc +3 -4
  77. data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
  78. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
  79. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
  80. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
  81. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
  82. data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
  83. data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
  84. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
  85. data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
  86. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
  87. data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
  88. data/src/core/ext/transport/chttp2/transport/parsing.cc +5 -5
  89. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
  90. data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
  91. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
  92. data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
  93. data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
  94. data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
  95. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
  96. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
  97. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
  98. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
  99. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
  100. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
  101. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
  102. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
  103. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
  104. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
  105. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
  106. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
  107. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
  108. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
  109. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
  110. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
  111. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
  112. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
  113. data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
  114. data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
  115. data/src/core/filter/auth/server_auth_filter.cc +2 -3
  116. data/src/core/filter/composite/composite_filter.cc +45 -33
  117. data/src/core/filter/composite/composite_filter.h +5 -4
  118. data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
  119. data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
  120. data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
  121. data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
  122. data/src/core/filter/filter_args.h +13 -2
  123. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
  124. data/src/core/handshaker/security/security_handshaker.cc +9 -6
  125. data/src/core/lib/channel/channel_stack.cc +3 -0
  126. data/src/core/lib/channel/channel_stack.h +2 -0
  127. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
  128. data/src/core/lib/channel/promise_based_filter.cc +132 -20
  129. data/src/core/lib/channel/promise_based_filter.h +42 -12
  130. data/src/core/lib/compression/compression_internal.cc +4 -5
  131. data/src/core/lib/debug/trace_flags.cc +8 -0
  132. data/src/core/lib/debug/trace_flags.h +3 -0
  133. data/src/core/lib/event_engine/ares_resolver.cc +54 -50
  134. data/src/core/lib/event_engine/ares_resolver.h +3 -2
  135. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
  136. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
  137. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
  138. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
  139. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
  140. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
  141. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
  142. data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
  143. data/src/core/lib/experiments/experiments.cc +60 -96
  144. data/src/core/lib/experiments/experiments.h +34 -50
  145. data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
  146. data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
  147. data/src/core/lib/iomgr/error.cc +2 -6
  148. data/src/core/lib/iomgr/error_cfstream.cc +1 -1
  149. data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
  150. data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
  151. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
  152. data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
  153. data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
  154. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
  155. data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
  156. data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
  157. data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
  158. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  159. data/src/core/lib/iomgr/systemd_utils.cc +0 -1
  160. data/src/core/lib/iomgr/tcp_client.h +1 -1
  161. data/src/core/lib/iomgr/tcp_posix.cc +23 -15
  162. data/src/core/lib/iomgr/tcp_server.h +1 -1
  163. data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
  164. data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
  165. data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
  166. data/src/core/lib/iomgr/tcp_windows.cc +5 -10
  167. data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
  168. data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
  169. data/src/core/lib/iomgr/vsock.h +3 -1
  170. data/src/core/lib/resource_quota/memory_quota.cc +1 -1
  171. data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
  172. data/src/core/lib/security/authorization/rbac_policy.h +21 -3
  173. data/src/core/lib/surface/call.cc +3 -9
  174. data/src/core/lib/surface/call_utils.h +113 -0
  175. data/src/core/lib/surface/channel_create.cc +1 -1
  176. data/src/core/lib/surface/channel_create.h +0 -2
  177. data/src/core/lib/surface/channel_init.cc +77 -38
  178. data/src/core/lib/surface/channel_init.h +30 -16
  179. data/src/core/lib/surface/filter_stack_call.cc +5 -10
  180. data/src/core/lib/surface/init.cc +13 -27
  181. data/src/core/lib/surface/version.cc +1 -1
  182. data/src/core/lib/transport/error_utils.cc +0 -27
  183. data/src/core/lib/transport/error_utils.h +0 -16
  184. data/src/core/lib/transport/transport.h +7 -5
  185. data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
  186. data/src/core/load_balancing/rls/rls.cc +28 -11
  187. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
  188. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
  189. data/src/core/load_balancing/xds/cds.cc +3 -1
  190. data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
  191. data/src/core/mitigation_engine/mitigation.h +14 -5
  192. data/src/core/mitigation_engine/mitigation_engine.h +7 -3
  193. data/src/core/mitigation_engine/mitigation_provider.h +2 -1
  194. data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
  195. data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
  196. data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
  197. data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
  198. data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
  199. data/src/core/resolver/endpoint_addresses.h +3 -0
  200. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
  201. data/src/core/resolver/xds/xds_resolver.cc +35 -9
  202. data/src/core/server/server.cc +2 -6
  203. data/src/core/server/server_config_selector.h +18 -3
  204. data/src/core/server/server_config_selector_filter.cc +178 -91
  205. data/src/core/server/server_config_selector_filter.h +58 -3
  206. data/src/core/server/xds_server_config_fetcher.cc +196 -129
  207. data/src/core/server/xds_server_config_fetcher.h +49 -0
  208. data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
  209. data/src/core/telemetry/histogram.h +94 -14
  210. data/src/core/telemetry/instrument.cc +179 -74
  211. data/src/core/telemetry/instrument.h +78 -30
  212. data/src/core/telemetry/metrics.h +5 -0
  213. data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
  214. data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
  215. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
  216. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
  217. data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
  218. data/src/core/tsi/ssl_telemetry_utils.h +12 -2
  219. data/src/core/tsi/ssl_transport_security.cc +238 -80
  220. data/src/core/tsi/ssl_transport_security.h +63 -33
  221. data/src/core/tsi/tls_telemetry.cc +31 -0
  222. data/src/core/tsi/tls_telemetry.h +47 -0
  223. data/src/core/tsi/transport_security.cc +2 -2
  224. data/src/core/tsi/transport_security.h +1 -1
  225. data/src/core/tsi/transport_security_interface.h +1 -1
  226. data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
  227. data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
  228. data/src/core/util/http_client/httpcli.cc +16 -53
  229. data/src/core/util/http_client/httpcli.h +0 -7
  230. data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
  231. data/src/core/util/linux/cpu.cc +1 -1
  232. data/src/core/util/load_file.cc +3 -9
  233. data/src/core/util/load_file.h +3 -4
  234. data/src/core/util/matchers.h +8 -0
  235. data/src/core/util/posix/cpu.cc +1 -1
  236. data/src/core/util/status_helper.cc +0 -20
  237. data/src/core/util/status_helper.h +3 -14
  238. data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
  239. data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
  240. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
  241. data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
  242. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
  243. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
  244. data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
  245. data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
  246. data/src/core/xds/grpc/xds_client_grpc.h +0 -4
  247. data/src/core/xds/grpc/xds_cluster.h +1 -0
  248. data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
  249. data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
  250. data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
  251. data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
  252. data/src/core/xds/grpc/xds_common_types.cc +0 -91
  253. data/src/core/xds/grpc/xds_common_types.h +1 -47
  254. data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
  255. data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
  256. data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
  257. data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
  258. data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
  259. data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
  260. data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
  261. data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
  262. data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
  263. data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
  264. data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
  265. data/src/core/xds/grpc/xds_http_filter.cc +2 -1
  266. data/src/core/xds/grpc/xds_http_filter.h +6 -5
  267. data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
  268. data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
  269. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
  270. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
  271. data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
  272. data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
  273. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
  274. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
  275. data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
  276. data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
  277. data/src/core/xds/grpc/xds_listener.cc +2 -0
  278. data/src/core/xds/grpc/xds_listener.h +5 -0
  279. data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
  280. data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
  281. data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
  282. data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
  283. data/src/core/xds/grpc/xds_route_config.cc +2 -0
  284. data/src/core/xds/grpc/xds_route_config.h +3 -1
  285. data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
  286. data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
  287. data/src/core/xds/grpc/xds_routing.cc +116 -69
  288. data/src/core/xds/grpc/xds_routing.h +19 -8
  289. data/src/core/xds/grpc/xds_tls_context.cc +117 -0
  290. data/src/core/xds/grpc/xds_tls_context.h +76 -0
  291. data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
  292. data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
  293. data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
  294. data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
  295. data/src/ruby/ext/grpc/rb_call.c +26 -15
  296. data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
  297. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  298. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  299. data/src/ruby/lib/grpc/version.rb +1 -1
  300. data/src/ruby/pb/test/client.rb +5 -4
  301. data/src/ruby/spec/call_spec.rb +14 -0
  302. data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
  303. metadata +50 -35
  304. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
  305. data/src/core/lib/iomgr/resolve_address.cc +0 -59
  306. data/src/core/lib/iomgr/resolve_address.h +0 -125
  307. data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
  308. data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
  309. data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
  310. data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
  311. data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
  312. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
  313. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
  314. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
  315. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
  316. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
  317. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
  318. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
  319. data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
  320. data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
  321. data/src/core/util/json/json_util.cc +0 -101
  322. data/src/core/util/json/json_util.h +0 -163
@@ -65,8 +65,6 @@
65
65
  #include "src/core/lib/iomgr/event_engine_shims/endpoint.h"
66
66
  #include "src/core/lib/iomgr/iomgr_fwd.h"
67
67
  #include "src/core/lib/iomgr/pollset_set.h"
68
- #include "src/core/lib/iomgr/resolve_address.h"
69
- #include "src/core/lib/iomgr/resolved_address.h"
70
68
  #include "src/core/lib/iomgr/tcp_server.h"
71
69
  #include "src/core/lib/iomgr/unix_sockets_posix.h"
72
70
  #include "src/core/lib/iomgr/vsock.h"
@@ -744,24 +742,12 @@ absl::StatusOr<int> Chttp2ServerAddPort(Server* server, const char* addr,
744
742
  resolved = grpc_resolve_vsock_address(parsed_addr_unprefixed);
745
743
  GRPC_RETURN_IF_ERROR(resolved.status());
746
744
  } else {
747
- if (IsEventEngineDnsNonClientChannelEnabled()) {
748
- absl::StatusOr<std::unique_ptr<EventEngine::DNSResolver>> ee_resolver =
749
- args.GetObjectRef<EventEngine>()->GetDNSResolver(
750
- EventEngine::DNSResolver::ResolverOptions());
751
- GRPC_RETURN_IF_ERROR(ee_resolver.status());
752
- results = grpc_event_engine::experimental::LookupHostnameBlocking(
753
- ee_resolver->get(), parsed_addr, "https");
754
- } else {
755
- // TODO(yijiem): Remove this after event_engine_dns_non_client_channel
756
- // is fully enabled.
757
- absl::StatusOr<std::vector<grpc_resolved_address>> iomgr_results =
758
- GetDNSResolver()->LookupHostnameBlocking(parsed_addr, "https");
759
- GRPC_RETURN_IF_ERROR(iomgr_results.status());
760
- for (const auto& addr : *iomgr_results) {
761
- results->push_back(
762
- grpc_event_engine::experimental::CreateResolvedAddress(addr));
763
- }
764
- }
745
+ absl::StatusOr<std::unique_ptr<EventEngine::DNSResolver>> ee_resolver =
746
+ args.GetObjectRef<EventEngine>()->GetDNSResolver(
747
+ EventEngine::DNSResolver::ResolverOptions());
748
+ GRPC_RETURN_IF_ERROR(ee_resolver.status());
749
+ results = grpc_event_engine::experimental::LookupHostnameBlocking(
750
+ ee_resolver->get(), parsed_addr, "https");
765
751
  }
766
752
  if (resolved.ok()) {
767
753
  for (const auto& addr : *resolved) {
@@ -698,13 +698,13 @@ void grpc_chttp2_transport::WriteSecurityFrameLocked(
698
698
  if (data == nullptr) {
699
699
  return;
700
700
  }
701
+ if (!closed_with_error.ok()) {
702
+ return;
703
+ }
701
704
  if (!settings.peer().allow_security_frame()) {
702
705
  close_transport_locked(
703
- this,
704
- grpc_error_set_int(
705
- GRPC_ERROR_CREATE("Unexpected SECURITY frame scheduled for write"),
706
- grpc_core::StatusIntProperty::kRpcStatus,
707
- GRPC_STATUS_FAILED_PRECONDITION));
706
+ this, absl::FailedPreconditionError(
707
+ "Unexpected SECURITY frame scheduled for write"));
708
708
  return;
709
709
  }
710
710
  grpc_core::SliceBuffer security_frame;
@@ -889,10 +889,9 @@ static void close_transport_locked(grpc_chttp2_transport* t,
889
889
  t->transport_framing_endpoint_extension = nullptr;
890
890
  }
891
891
  if (t->closed_with_error.ok()) {
892
- if (!grpc_error_has_clear_grpc_status(error)) {
892
+ if (absl::IsUnknown(error)) {
893
893
  error =
894
- grpc_error_set_int(error, grpc_core::StatusIntProperty::kRpcStatus,
895
- GRPC_STATUS_UNAVAILABLE);
894
+ grpc_core::ReplaceStatusCode(error, absl::StatusCode::kUnavailable);
896
895
  }
897
896
  if (t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE) {
898
897
  if (t->close_transport_on_writes_finished.ok()) {
@@ -1385,13 +1384,12 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
1385
1384
  uint32_t goaway_error,
1386
1385
  uint32_t last_stream_id,
1387
1386
  absl::string_view goaway_text) {
1388
- t->goaway_error = grpc_error_set_int(
1387
+ t->goaway_error =
1389
1388
  grpc_error_set_int(absl::UnavailableError(absl::StrFormat(
1390
1389
  "GOAWAY received; Error code: %u; Debug Text: %s",
1391
1390
  goaway_error, goaway_text)),
1392
1391
  grpc_core::StatusIntProperty::kHttp2Error,
1393
- static_cast<intptr_t>(goaway_error)),
1394
- grpc_core::StatusIntProperty::kRpcStatus, GRPC_STATUS_UNAVAILABLE);
1392
+ static_cast<intptr_t>(goaway_error));
1395
1393
 
1396
1394
  GRPC_TRACE_LOG(http, INFO)
1397
1395
  << "transport " << t << " got goaway with last stream id "
@@ -1419,7 +1417,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
1419
1417
  grpc_chttp2_cancel_stream(s->t.get(), s, s->t->goaway_error, false);
1420
1418
  }
1421
1419
  }
1422
- absl::Status status = grpc_error_to_absl_status(t->goaway_error);
1420
+ absl::Status status = t->goaway_error;
1423
1421
  grpc_core::Transport::StateWatcher::DisconnectInfo disconnect_info;
1424
1422
  disconnect_info.reason = grpc_core::Transport::StateWatcher::kGoaway;
1425
1423
  disconnect_info.http2_error_code = static_cast<Http2ErrorCode>(goaway_error);
@@ -1442,10 +1440,6 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
1442
1440
  t->keepalive_time.millis() > max_keepalive_time_millis
1443
1441
  ? INT_MAX
1444
1442
  : t->keepalive_time.millis() * KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
1445
- if (!grpc_core::IsSubchannelConnectionScalingEnabled()) {
1446
- status.SetPayload(grpc_core::kKeepaliveThrottlingKey,
1447
- absl::Cord(std::to_string(throttled_keepalive_time)));
1448
- }
1449
1443
  disconnect_info.keepalive_time =
1450
1444
  grpc_core::Duration::Milliseconds(throttled_keepalive_time);
1451
1445
  }
@@ -1502,11 +1496,7 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
1502
1496
  grpc_core::GrpcStreamNetworkState(),
1503
1497
  grpc_core::GrpcStreamNetworkState::kNotSentOnWire);
1504
1498
  grpc_chttp2_cancel_stream(
1505
- t, s,
1506
- grpc_error_set_int(GRPC_ERROR_CREATE("Stream IDs exhausted"),
1507
- grpc_core::StatusIntProperty::kRpcStatus,
1508
- GRPC_STATUS_UNAVAILABLE),
1509
- false);
1499
+ t, s, absl::UnavailableError("Stream IDs exhausted"), false);
1510
1500
  }
1511
1501
  }
1512
1502
  }
@@ -1640,14 +1630,10 @@ static void send_initial_metadata_locked(
1640
1630
  s->trailing_metadata_buffer.Set(
1641
1631
  grpc_core::GrpcStreamNetworkState(),
1642
1632
  grpc_core::GrpcStreamNetworkState::kNotSentOnWire);
1643
- grpc_chttp2_cancel_stream(
1644
- t, s,
1645
- grpc_error_set_int(
1646
- GRPC_ERROR_CREATE_REFERENCING("Too many streams",
1647
- &t->closed_with_error, 1),
1648
- grpc_core::StatusIntProperty::kRpcStatus,
1649
- GRPC_STATUS_RESOURCE_EXHAUSTED),
1650
- false);
1633
+ absl::Status status =
1634
+ absl::ResourceExhaustedError("Too many streams");
1635
+ grpc_core::StatusAddChild(&status, t->closed_with_error);
1636
+ grpc_chttp2_cancel_stream(t, s, std::move(status), false);
1651
1637
  } else {
1652
1638
  grpc_chttp2_list_add_waiting_for_concurrency(t, s);
1653
1639
  maybe_start_some_streams(t);
@@ -1656,14 +1642,9 @@ static void send_initial_metadata_locked(
1656
1642
  s->trailing_metadata_buffer.Set(
1657
1643
  grpc_core::GrpcStreamNetworkState(),
1658
1644
  grpc_core::GrpcStreamNetworkState::kNotSentOnWire);
1659
- grpc_chttp2_cancel_stream(
1660
- t, s,
1661
- grpc_error_set_int(
1662
- GRPC_ERROR_CREATE_REFERENCING("Transport closed",
1663
- &t->closed_with_error, 1),
1664
- grpc_core::StatusIntProperty::kRpcStatus,
1665
- GRPC_STATUS_UNAVAILABLE),
1666
- false);
1645
+ absl::Status status = absl::UnavailableError("Transport closed");
1646
+ grpc_core::StatusAddChild(&status, t->closed_with_error);
1647
+ grpc_chttp2_cancel_stream(t, s, std::move(status), false);
1667
1648
  }
1668
1649
  } else {
1669
1650
  GRPC_CHECK_NE(s->id, 0u);
@@ -2075,11 +2056,8 @@ void grpc_chttp2_keepalive_timeout(
2075
2056
  grpc_core::StatusIntProperty::kHttp2Error,
2076
2057
  static_cast<intptr_t>(Http2ErrorCode::kEnhanceYourCalm)),
2077
2058
  /*immediate_disconnect_hint=*/true);
2078
- close_transport_locked(
2079
- t.get(),
2080
- grpc_error_set_int(GRPC_ERROR_CREATE("keepalive timeout"),
2081
- grpc_core::StatusIntProperty::kRpcStatus,
2082
- GRPC_STATUS_UNAVAILABLE));
2059
+ close_transport_locked(t.get(),
2060
+ absl::UnavailableError("keepalive timeout"));
2083
2061
  }),
2084
2062
  absl::OkStatus());
2085
2063
  }
@@ -2097,11 +2075,7 @@ void grpc_chttp2_ping_timeout(
2097
2075
  grpc_core::StatusIntProperty::kHttp2Error,
2098
2076
  static_cast<intptr_t>(Http2ErrorCode::kEnhanceYourCalm)),
2099
2077
  /*immediate_disconnect_hint=*/true);
2100
- close_transport_locked(
2101
- t.get(),
2102
- grpc_error_set_int(GRPC_ERROR_CREATE("ping timeout"),
2103
- grpc_core::StatusIntProperty::kRpcStatus,
2104
- GRPC_STATUS_UNAVAILABLE));
2078
+ close_transport_locked(t.get(), absl::UnavailableError("ping timeout"));
2105
2079
  }),
2106
2080
  absl::OkStatus());
2107
2081
  }
@@ -2119,11 +2093,8 @@ void grpc_chttp2_settings_timeout(
2119
2093
  grpc_core::StatusIntProperty::kHttp2Error,
2120
2094
  static_cast<intptr_t>(Http2ErrorCode::kSettingsTimeout)),
2121
2095
  /*immediate_disconnect_hint=*/true);
2122
- close_transport_locked(
2123
- t.get(),
2124
- grpc_error_set_int(GRPC_ERROR_CREATE("settings timeout"),
2125
- grpc_core::StatusIntProperty::kRpcStatus,
2126
- GRPC_STATUS_UNAVAILABLE));
2096
+ close_transport_locked(t.get(),
2097
+ absl::UnavailableError("settings timeout"));
2127
2098
  }),
2128
2099
  absl::OkStatus());
2129
2100
  }
@@ -2256,10 +2227,7 @@ void grpc_chttp2_exceeded_ping_strikes(grpc_chttp2_transport* t) {
2256
2227
  static_cast<intptr_t>(Http2ErrorCode::kEnhanceYourCalm)),
2257
2228
  /*immediate_disconnect_hint=*/true);
2258
2229
  // The transport will be closed after the write is done
2259
- close_transport_locked(
2260
- t, grpc_error_set_int(GRPC_ERROR_CREATE("Too many pings"),
2261
- grpc_core::StatusIntProperty::kRpcStatus,
2262
- GRPC_STATUS_UNAVAILABLE));
2230
+ close_transport_locked(t, absl::UnavailableError("Too many pings"));
2263
2231
  }
2264
2232
 
2265
2233
  void grpc_chttp2_reset_ping_clock(grpc_chttp2_transport* t) {
@@ -2554,8 +2522,7 @@ void grpc_chttp2_cancel_stream(
2554
2522
  grpc_error_handle due_to_error, bool tarpit,
2555
2523
  grpc_core::ServerMetadataHandle send_trailing_metadata) {
2556
2524
  if (!t->is_client && !s->sent_trailing_metadata &&
2557
- grpc_error_has_clear_grpc_status(due_to_error) &&
2558
- !(s->read_closed && s->write_closed)) {
2525
+ !absl::IsUnknown(due_to_error) && !(s->read_closed && s->write_closed)) {
2559
2526
  close_from_api(t, s, due_to_error, tarpit,
2560
2527
  std::move(send_trailing_metadata));
2561
2528
  return;
@@ -2955,11 +2922,10 @@ static void end_all_the_calls(grpc_chttp2_transport* t,
2955
2922
  grpc_error_handle error) {
2956
2923
  intptr_t http2_error;
2957
2924
  // If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server.
2958
- if (!t->is_client && !grpc_error_has_clear_grpc_status(error) &&
2925
+ if (!t->is_client && absl::IsUnknown(error) &&
2959
2926
  !grpc_error_get_int(error, grpc_core::StatusIntProperty::kHttp2Error,
2960
2927
  &http2_error)) {
2961
- error = grpc_error_set_int(error, grpc_core::StatusIntProperty::kRpcStatus,
2962
- GRPC_STATUS_UNAVAILABLE);
2928
+ error = grpc_core::ReplaceStatusCode(error, absl::StatusCode::kUnavailable);
2963
2929
  }
2964
2930
  cancel_unstarted_streams(t, error, false);
2965
2931
  std::vector<grpc_chttp2_stream*> to_cancel;
@@ -3042,12 +3008,11 @@ static grpc_error_handle try_http_parsing(grpc_chttp2_transport* t) {
3042
3008
  }
3043
3009
  if (parse_error.ok() &&
3044
3010
  (parse_error = grpc_http_parser_eof(&parser)) == absl::OkStatus()) {
3045
- error = grpc_error_set_int(
3046
- GRPC_ERROR_CREATE(
3047
- absl::StrCat("Trying to connect an http1.x server (HTTP status ",
3048
- response.status, ")")),
3049
- grpc_core::StatusIntProperty::kRpcStatus,
3050
- grpc_http2_status_to_grpc_status(response.status));
3011
+ error = absl::Status(
3012
+ static_cast<absl::StatusCode>(
3013
+ grpc_http2_status_to_grpc_status(response.status)),
3014
+ absl::StrCat("Trying to connect an http1.x server (HTTP status ",
3015
+ response.status, ")"));
3051
3016
  }
3052
3017
 
3053
3018
  grpc_http_parser_destroy(&parser);
@@ -124,6 +124,7 @@ TransportFlowControl::TransportFlowControl(absl::string_view peer_name,
124
124
  MemoryOwner* memory_owner)
125
125
  : memory_owner_(memory_owner),
126
126
  enable_bdp_probe_(enable_bdp_probe),
127
+ bdp_ping_blocked_(true),
127
128
  bdp_estimator_(peer_name) {}
128
129
 
129
130
  uint32_t TransportFlowControl::DesiredAnnounceSize(bool writing_anyway) const {
@@ -348,6 +349,7 @@ std::string TransportFlowControl::Stats::ToString() const {
348
349
  " announced_stream_total_over_incoming_window: ",
349
350
  announced_stream_total_over_incoming_window,
350
351
  " bdp_accumulator: ", bdp_accumulator,
352
+ " bdp_ping_blocked: ", bdp_ping_blocked,
351
353
  " bdp_estimate: ", bdp_estimate,
352
354
  " bdp_bw_est: ", bdp_bw_est);
353
355
  }
@@ -24,6 +24,7 @@
24
24
  #include <stdint.h>
25
25
 
26
26
  #include <algorithm>
27
+ #include <cstddef>
27
28
  #include <iosfwd>
28
29
  #include <optional>
29
30
  #include <string>
@@ -370,6 +371,7 @@ class TransportFlowControl final {
370
371
  int64_t bdp_accumulator;
371
372
  int64_t bdp_estimate;
372
373
  double bdp_bw_est;
374
+ bool bdp_ping_blocked;
373
375
 
374
376
  std::string ToString() const;
375
377
  channelz::PropertyList ChannelzProperties() const {
@@ -386,6 +388,7 @@ class TransportFlowControl final {
386
388
  .Set("announced_stream_total_over_incoming_window",
387
389
  announced_stream_total_over_incoming_window)
388
390
  .Set("bdp_accumulator", bdp_accumulator)
391
+ .Set("bdp_ping_blocked", bdp_ping_blocked)
389
392
  .Set("bdp_estimate", bdp_estimate)
390
393
  .Set("bdp_bw_est", bdp_bw_est);
391
394
  }
@@ -405,6 +408,7 @@ class TransportFlowControl final {
405
408
  stats.announced_stream_total_over_incoming_window =
406
409
  announced_stream_total_over_incoming_window();
407
410
  stats.bdp_accumulator = bdp_estimator_.accumulator();
411
+ stats.bdp_ping_blocked = bdp_ping_blocked_;
408
412
  stats.bdp_estimate = bdp_estimator_.EstimateBdp();
409
413
  stats.bdp_bw_est = bdp_estimator_.EstimateBandwidth();
410
414
  return stats;
@@ -418,6 +422,67 @@ class TransportFlowControl final {
418
422
  }
419
423
  size_t window_update_list_size() const { return window_update_list_.size(); }
420
424
 
425
+ //////////////////////////////////////////////////////////////////////////////
426
+ // BDP Ping related functions.
427
+
428
+ // The current implementation of BDP relies on the assumption that our
429
+ // transport will not send out a new ping till it has received an ACK for the
430
+ // previous ping.
431
+
432
+ // CHTTP2 reference : schedule_bdp_ping_locked
433
+ void ScheduleBdpPing() {
434
+ GRPC_DCHECK(enable_bdp_probe_);
435
+ bdp_estimator_.SchedulePing();
436
+ }
437
+
438
+ // CHTTP2 reference : start_bdp_ping_locked
439
+ void StartBdpPing() {
440
+ // TODO(tjagtap) : [PH2][P1] : Reset the keepalive ping timer
441
+ bdp_estimator_.StartPing();
442
+ }
443
+
444
+ // CHTTP2 reference : finish_bdp_ping_locked
445
+ Duration CompleteBdpPing() {
446
+ return bdp_estimator_.CompletePing() - Timestamp::Now();
447
+ }
448
+
449
+ // CHTTP2 reference : init_data_frame_parser
450
+ void OnReceiveDataFrame(const uint32_t bytes) {
451
+ if (enable_bdp_probe_) {
452
+ bdp_estimator_.AddIncomingBytes(bytes);
453
+ if (bdp_ping_blocked_ && (bytes > 0)) {
454
+ // Once we receive a data frame, we can start sending BDP pings again.
455
+ bdp_ping_blocked_ = false;
456
+ bdp_waker_.Wakeup();
457
+ }
458
+ }
459
+ }
460
+
461
+ // CHTTP2 reference : grpc_chttp2_transport::bdp_ping_blocked
462
+ bool IsBdpPingBlocked() const { return bdp_ping_blocked_; }
463
+
464
+ auto WaitForBdpActivation() {
465
+ GRPC_HTTP2_FLOW_CONTROL_DLOG
466
+ << "TransportFlowControl::WaitForBdpActivation Factory";
467
+ return [this]() -> Poll<absl::Status> {
468
+ GRPC_DCHECK(enable_bdp_probe_);
469
+ if (bdp_estimator_.accumulator() == 0) {
470
+ // Block BDP ping till we receive data in a DATA frame on the transport.
471
+ bdp_ping_blocked_ = true;
472
+ }
473
+ if (bdp_ping_blocked_) {
474
+ bdp_waker_ = GetContext<Activity>()->MakeNonOwningWaker();
475
+ GRPC_HTTP2_FLOW_CONTROL_DLOG
476
+ << "TransportFlowControl::WaitForBdpActivation Pending";
477
+ return Pending{};
478
+ }
479
+ GRPC_HTTP2_FLOW_CONTROL_DLOG
480
+ << "TransportFlowControl::WaitForBdpActivation Resolved";
481
+ ScheduleBdpPing();
482
+ return absl::OkStatus();
483
+ };
484
+ }
485
+
421
486
  private:
422
487
  friend class StreamFlowControl;
423
488
 
@@ -461,10 +526,12 @@ class TransportFlowControl final {
461
526
  /// incoming_window = total_over - max(bdp - total_under, 0)
462
527
  int64_t announced_stream_total_over_incoming_window_ = 0;
463
528
 
464
- /// should we probe bdp?
529
+ // Transport level channel argument GRPC_ARG_HTTP2_BDP_PROBE decides if we
530
+ // should probe for bdp.
465
531
  const bool enable_bdp_probe_;
466
-
467
- // bdp estimation
532
+ // CHTTP2 reference : grpc_chttp2_transport::bdp_ping_blocked
533
+ bool bdp_ping_blocked_;
534
+ Waker bdp_waker_;
468
535
  BdpEstimator bdp_estimator_;
469
536
 
470
537
  int64_t remote_window_ = kDefaultWindow;
@@ -490,10 +557,17 @@ class TransportFlowControl final {
490
557
  class StreamFlowControl final {
491
558
  public:
492
559
  explicit StreamFlowControl(TransportFlowControl* tfc);
560
+ // TODO(ritulb) : [PH2][P5] : When CHTTP2 is removed, delete this
561
+ // destructor(no-op).
493
562
  ~StreamFlowControl() {
494
563
  tfc_->RemoveAnnouncedWindowDelta(announced_window_delta_);
495
564
  }
496
565
 
566
+ void OnStreamClosed() {
567
+ tfc_->RemoveAnnouncedWindowDelta(announced_window_delta_);
568
+ announced_window_delta_ = 0;
569
+ }
570
+
497
571
  // Track an update to the incoming flow control counters - that is how many
498
572
  // tokens we report to our peer that we're willing to accept.
499
573
  // Instantiators *must* call MakeAction before destruction of this value.
@@ -526,7 +600,7 @@ class StreamFlowControl final {
526
600
  // `min_progress_size` bytes to make progress on reading the current stream.
527
601
  // An example usage of this would be, say we receive the first 1000 bytes of
528
602
  // a 2000 byte gRPC message, we can call SetMinProgressSize(1000)
529
- // TODO(tjagtap) [PH2][P2] Plumb with PH2 flow control.
603
+ // TODO(tjagtap) [PH2][P2][FCV3] Plumb with PH2 flow control.
530
604
  void SetMinProgressSize(int64_t min_progress_size) {
531
605
  sfc_->min_progress_size_ = min_progress_size;
532
606
  }
@@ -398,6 +398,8 @@ inline constexpr absl::string_view kSettingsTimeout =
398
398
  "timeout. Connection will be closed";
399
399
  inline constexpr absl::string_view kLastStreamClosed =
400
400
  "Closing last stream and cannot create any more streams.";
401
+ inline constexpr absl::string_view kReceivedStreamAfterGoaway =
402
+ "Received new stream after GOAWAY was received.";
401
403
  inline constexpr absl::string_view kFirstSettingsFrameClient =
402
404
  "RFC9113: The server connection preface consists of a potentially empty "
403
405
  "SETTINGS frame that MUST be the first frame the server sends in the "
@@ -133,10 +133,9 @@ grpc_core::Poll<grpc_error_handle> grpc_deframe_unprocessed_incoming_frames(
133
133
  *(s->max_recv_message_length)));
134
134
  error = grpc_error_set_int(error, grpc_core::StatusIntProperty::kStreamId,
135
135
  static_cast<intptr_t>(s->id));
136
- // Attach the explicit gRPC status code to fail the RPC correctly.
137
- error =
138
- grpc_error_set_int(error, grpc_core::StatusIntProperty::kRpcStatus,
139
- GRPC_STATUS_RESOURCE_EXHAUSTED);
136
+ // Attach the explicit gRPC status code to fail the RPC correctly
137
+ error = grpc_core::ReplaceStatusCode(
138
+ error, absl::StatusCode::kResourceExhausted);
140
139
  s->message_size_limit_exceeded = true;
141
140
  return error;
142
141
  }
@@ -365,6 +365,13 @@ class GoawayManager {
365
365
  !context_->was_immediate;
366
366
  }
367
367
 
368
+ bool IsGracefulGoawayInProgress() const {
369
+ return context_->goaway_state ==
370
+ GoawayState::kInitialGracefulGoawayScheduled ||
371
+ context_->goaway_state == GoawayState::kInitialGracefulGoawaySent ||
372
+ context_->goaway_state == GoawayState::kFinalGracefulGoawayScheduled;
373
+ }
374
+
368
375
  // Called from the transport write cycle to notify the GOAWAY manager that a
369
376
  // GOAWAY frame may have been sent. If a GOAWAY frame is sent in current
370
377
  // write cycle, this function handles the needed state transition.
@@ -1009,7 +1009,7 @@ class HPackParser::Parser {
1009
1009
  key_string.size() + value.wire_size + hpack_constants::kEntryOverhead;
1010
1010
  if (state_.mitigation_engine != nullptr) {
1011
1011
  auto action = state_.mitigation_engine->EvaluateIncomingMetadata(
1012
- key_string, value_slice.as_string_view());
1012
+ key_string, value_slice.as_string_view(), state_.peer_address);
1013
1013
  if (action.has_value()) {
1014
1014
  if (action.value() == MitigationEngine::Action::kCloseConnection) {
1015
1015
  input_->SetErrorAndStopParsing(
@@ -1118,7 +1118,8 @@ void HPackParser::BeginFrame(grpc_metadata_batch* metadata_buffer,
1118
1118
  uint32_t metadata_size_hard_limit,
1119
1119
  Boundary boundary, Priority priority,
1120
1120
  LogInfo log_info,
1121
- MitigationEngine* mitigation_engine) {
1121
+ MitigationEngine* mitigation_engine,
1122
+ absl::string_view peer_address) {
1122
1123
  metadata_buffer_ = metadata_buffer;
1123
1124
  if (metadata_buffer != nullptr) {
1124
1125
  metadata_buffer->Set(GrpcStatusFromWire(), true);
@@ -1126,6 +1127,7 @@ void HPackParser::BeginFrame(grpc_metadata_batch* metadata_buffer,
1126
1127
  boundary_ = boundary;
1127
1128
  priority_ = priority;
1128
1129
  state_.mitigation_engine = mitigation_engine;
1130
+ state_.peer_address = peer_address;
1129
1131
  state_.dynamic_table_updates_allowed = 2;
1130
1132
  state_.metadata_early_detection.SetLimits(
1131
1133
  /*soft_limit=*/metadata_size_soft_limit,
@@ -1162,7 +1164,7 @@ grpc_error_handle HPackParser::ParseInput(Input input, bool is_last,
1162
1164
  if (is_last && is_boundary()) {
1163
1165
  if (state_.mitigation_engine != nullptr && metadata_buffer_ != nullptr) {
1164
1166
  auto action = state_.mitigation_engine->EvaluateAllIncomingMetadata(
1165
- *metadata_buffer_);
1167
+ *metadata_buffer_, state_.peer_address);
1166
1168
  if (action.has_value()) {
1167
1169
  if (action.value() == MitigationEngine::Action::kCloseConnection) {
1168
1170
  input.SetErrorAndStopParsing(HpackParseResult::MitigationEngineError(
@@ -101,7 +101,8 @@ class HPackParser {
101
101
  uint32_t metadata_size_soft_limit,
102
102
  uint32_t metadata_size_hard_limit, Boundary boundary,
103
103
  Priority priority, LogInfo log_info,
104
- MitigationEngine* mitigation_engine);
104
+ MitigationEngine* mitigation_engine,
105
+ absl::string_view peer_address = "");
105
106
  // Start throwing away any received headers after parsing them.
106
107
  void StopBufferingFrame() { metadata_buffer_ = nullptr; }
107
108
  // Parse one slice worth of data
@@ -255,6 +256,7 @@ class HPackParser {
255
256
  // Current parse state
256
257
  ParseState parse_state = ParseState::kTop;
257
258
  MitigationEngine* mitigation_engine = nullptr;
259
+ absl::string_view peer_address;
258
260
  std::variant<const HPackTable::Memento*, Slice> key;
259
261
  };
260
262