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.
- checksums.yaml +4 -4
- data/Makefile +21 -17
- data/include/grpc/credentials.h +10 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +9 -0
- data/src/core/call/call_filters.h +4 -2
- data/src/core/call/client_call.cc +20 -8
- data/src/core/call/client_call.h +4 -0
- data/src/core/call/interception_chain.cc +2 -0
- data/src/core/call/interception_chain.h +14 -1
- data/src/core/call/metadata.cc +1 -3
- data/src/core/call/metadata_batch.h +13 -5
- data/src/core/call/server_call.cc +31 -14
- data/src/core/call/server_call.h +4 -0
- data/src/core/channelz/text_encode.cc +9 -4
- data/src/core/channelz/v2tov1/convert.cc +2 -2
- data/src/core/client_channel/backup_poller.cc +1 -2
- data/src/core/client_channel/client_channel.cc +6 -33
- data/src/core/client_channel/client_channel_filter.cc +22 -55
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_service_config.cc +3 -19
- data/src/core/client_channel/direct_channel.cc +7 -1
- data/src/core/client_channel/direct_channel.h +2 -2
- data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
- data/src/core/client_channel/subchannel.cc +310 -1058
- data/src/core/client_channel/subchannel.h +44 -329
- data/src/core/client_channel/subchannel_metrics.cc +48 -0
- data/src/core/client_channel/subchannel_metrics.h +60 -0
- data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
- data/src/core/credentials/call/json_util.h +1 -0
- data/src/core/credentials/call/jwt/json_token.cc +10 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
- data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
- data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
- data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
- data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
- data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
- data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
- data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
- data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
- data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
- data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
- data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
- data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
- data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
- data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
- data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
- data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
- data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
- data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +32 -67
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
- data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
- data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
- data/src/core/ext/transport/chttp2/transport/parsing.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
- data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
- data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
- data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
- data/src/core/filter/auth/server_auth_filter.cc +2 -3
- data/src/core/filter/composite/composite_filter.cc +45 -33
- data/src/core/filter/composite/composite_filter.h +5 -4
- data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
- data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
- data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
- data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
- data/src/core/filter/filter_args.h +13 -2
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
- data/src/core/handshaker/security/security_handshaker.cc +9 -6
- data/src/core/lib/channel/channel_stack.cc +3 -0
- data/src/core/lib/channel/channel_stack.h +2 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
- data/src/core/lib/channel/promise_based_filter.cc +132 -20
- data/src/core/lib/channel/promise_based_filter.h +42 -12
- data/src/core/lib/compression/compression_internal.cc +4 -5
- data/src/core/lib/debug/trace_flags.cc +8 -0
- data/src/core/lib/debug/trace_flags.h +3 -0
- data/src/core/lib/event_engine/ares_resolver.cc +54 -50
- data/src/core/lib/event_engine/ares_resolver.h +3 -2
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
- data/src/core/lib/experiments/experiments.cc +60 -96
- data/src/core/lib/experiments/experiments.h +34 -50
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
- data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
- data/src/core/lib/iomgr/error.cc +2 -6
- data/src/core/lib/iomgr/error_cfstream.cc +1 -1
- data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
- data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
- data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
- data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/systemd_utils.cc +0 -1
- data/src/core/lib/iomgr/tcp_client.h +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +23 -15
- data/src/core/lib/iomgr/tcp_server.h +1 -1
- data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.cc +5 -10
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/vsock.h +3 -1
- data/src/core/lib/resource_quota/memory_quota.cc +1 -1
- data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
- data/src/core/lib/security/authorization/rbac_policy.h +21 -3
- data/src/core/lib/surface/call.cc +3 -9
- data/src/core/lib/surface/call_utils.h +113 -0
- data/src/core/lib/surface/channel_create.cc +1 -1
- data/src/core/lib/surface/channel_create.h +0 -2
- data/src/core/lib/surface/channel_init.cc +77 -38
- data/src/core/lib/surface/channel_init.h +30 -16
- data/src/core/lib/surface/filter_stack_call.cc +5 -10
- data/src/core/lib/surface/init.cc +13 -27
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/error_utils.cc +0 -27
- data/src/core/lib/transport/error_utils.h +0 -16
- data/src/core/lib/transport/transport.h +7 -5
- data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
- data/src/core/load_balancing/rls/rls.cc +28 -11
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
- data/src/core/load_balancing/xds/cds.cc +3 -1
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
- data/src/core/mitigation_engine/mitigation.h +14 -5
- data/src/core/mitigation_engine/mitigation_engine.h +7 -3
- data/src/core/mitigation_engine/mitigation_provider.h +2 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
- data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
- data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
- data/src/core/resolver/xds/xds_resolver.cc +35 -9
- data/src/core/server/server.cc +2 -6
- data/src/core/server/server_config_selector.h +18 -3
- data/src/core/server/server_config_selector_filter.cc +178 -91
- data/src/core/server/server_config_selector_filter.h +58 -3
- data/src/core/server/xds_server_config_fetcher.cc +196 -129
- data/src/core/server/xds_server_config_fetcher.h +49 -0
- data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
- data/src/core/telemetry/histogram.h +94 -14
- data/src/core/telemetry/instrument.cc +179 -74
- data/src/core/telemetry/instrument.h +78 -30
- data/src/core/telemetry/metrics.h +5 -0
- data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
- data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
- data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
- data/src/core/tsi/ssl_telemetry_utils.h +12 -2
- data/src/core/tsi/ssl_transport_security.cc +238 -80
- data/src/core/tsi/ssl_transport_security.h +63 -33
- data/src/core/tsi/tls_telemetry.cc +31 -0
- data/src/core/tsi/tls_telemetry.h +47 -0
- data/src/core/tsi/transport_security.cc +2 -2
- data/src/core/tsi/transport_security.h +1 -1
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
- data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
- data/src/core/util/http_client/httpcli.cc +16 -53
- data/src/core/util/http_client/httpcli.h +0 -7
- data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
- data/src/core/util/linux/cpu.cc +1 -1
- data/src/core/util/load_file.cc +3 -9
- data/src/core/util/load_file.h +3 -4
- data/src/core/util/matchers.h +8 -0
- data/src/core/util/posix/cpu.cc +1 -1
- data/src/core/util/status_helper.cc +0 -20
- data/src/core/util/status_helper.h +3 -14
- data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
- data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
- data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
- data/src/core/xds/grpc/xds_client_grpc.h +0 -4
- data/src/core/xds/grpc/xds_cluster.h +1 -0
- data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
- data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
- data/src/core/xds/grpc/xds_common_types.cc +0 -91
- data/src/core/xds/grpc/xds_common_types.h +1 -47
- data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
- data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
- data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
- data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
- data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
- data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
- data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
- data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
- data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
- data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
- data/src/core/xds/grpc/xds_http_filter.cc +2 -1
- data/src/core/xds/grpc/xds_http_filter.h +6 -5
- data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
- data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
- data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
- data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
- data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
- data/src/core/xds/grpc/xds_listener.cc +2 -0
- data/src/core/xds/grpc/xds_listener.h +5 -0
- data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
- data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
- data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
- data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
- data/src/core/xds/grpc/xds_route_config.cc +2 -0
- data/src/core/xds/grpc/xds_route_config.h +3 -1
- data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
- data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
- data/src/core/xds/grpc/xds_routing.cc +116 -69
- data/src/core/xds/grpc/xds_routing.h +19 -8
- data/src/core/xds/grpc/xds_tls_context.cc +117 -0
- data/src/core/xds/grpc/xds_tls_context.h +76 -0
- data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
- data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
- data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_call.c +26 -15
- data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/test/client.rb +5 -4
- data/src/ruby/spec/call_spec.rb +14 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
- metadata +50 -35
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
- data/src/core/lib/iomgr/resolve_address.cc +0 -59
- data/src/core/lib/iomgr/resolve_address.h +0 -125
- data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
- data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
- data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
- data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
- data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
- data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
- data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
- data/src/core/util/json/json_util.cc +0 -101
- data/src/core/util/json/json_util.h +0 -163
|
@@ -161,7 +161,7 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
161
161
|
|
|
162
162
|
template <typename Factory>
|
|
163
163
|
void TestOnlySpawnPromise(absl::string_view name, Factory&& factory) {
|
|
164
|
-
SpawnInfallible(
|
|
164
|
+
SpawnInfallible(transport_party_, name, std::forward<Factory>(factory));
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
absl::Status TestOnlyTriggerWriteCycle() { return TriggerWriteCycle(); }
|
|
@@ -172,12 +172,16 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
int64_t TestOnlyTransportFlowControlWindow();
|
|
175
|
-
int64_t TestOnlyGetStreamFlowControlWindow(
|
|
175
|
+
int64_t TestOnlyGetStreamFlowControlWindow(uint32_t stream_id);
|
|
176
176
|
|
|
177
177
|
uint32_t TestOnlyLastIncomingStreamId() const {
|
|
178
178
|
return last_incoming_stream_id_;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
Duration TestOnlyNextAllowedPingInterval() {
|
|
182
|
+
return NextAllowedPingInterval();
|
|
183
|
+
}
|
|
184
|
+
|
|
181
185
|
private:
|
|
182
186
|
//////////////////////////////////////////////////////////////////////////////
|
|
183
187
|
// Endpoint Helpers
|
|
@@ -361,7 +365,7 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
361
365
|
Poll<absl::Status>>,
|
|
362
366
|
bool> = true>
|
|
363
367
|
auto UntilTransportClosed(Promise&& promise) {
|
|
364
|
-
return Race(Map(
|
|
368
|
+
return Race(Map(shutdown_tracker_.WaitShutdownComplete(),
|
|
365
369
|
[self = RefAsSubclass<Http2ServerTransport>()](Empty) {
|
|
366
370
|
GRPC_HTTP2_SERVER_DLOG << "Transport closed";
|
|
367
371
|
return absl::CancelledError("Transport closed");
|
|
@@ -374,7 +378,7 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
374
378
|
Poll<Empty>>,
|
|
375
379
|
bool> = true>
|
|
376
380
|
auto UntilTransportClosed(Promise&& promise) {
|
|
377
|
-
return Race(Map(
|
|
381
|
+
return Race(Map(shutdown_tracker_.WaitShutdownComplete(),
|
|
378
382
|
[self = RefAsSubclass<Http2ServerTransport>()](Empty) {
|
|
379
383
|
GRPC_HTTP2_SERVER_DLOG << "Transport closed";
|
|
380
384
|
return Empty{};
|
|
@@ -393,7 +397,7 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
393
397
|
template <typename Factory>
|
|
394
398
|
void SpawnInfallibleTransportParty(absl::string_view name,
|
|
395
399
|
Factory&& factory) {
|
|
396
|
-
SpawnInfallible(
|
|
400
|
+
SpawnInfallible(transport_party_, name, std::forward<Factory>(factory));
|
|
397
401
|
}
|
|
398
402
|
|
|
399
403
|
// Spawns a promise on the transport party. If the promise returns a non-ok
|
|
@@ -401,7 +405,7 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
401
405
|
// status.
|
|
402
406
|
template <typename Factory>
|
|
403
407
|
void SpawnGuardedTransportParty(absl::string_view name, Factory&& factory) {
|
|
404
|
-
|
|
408
|
+
transport_party_->Spawn(
|
|
405
409
|
name, std::forward<Factory>(factory),
|
|
406
410
|
[self = RefAsSubclass<Http2ServerTransport>()](absl::Status status) {
|
|
407
411
|
if (!status.ok()) {
|
|
@@ -414,8 +418,8 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
414
418
|
template <typename Factory, typename OnDone>
|
|
415
419
|
void SpawnWithOnDoneTransportParty(absl::string_view name, Factory&& factory,
|
|
416
420
|
OnDone&& on_done) {
|
|
417
|
-
|
|
418
|
-
|
|
421
|
+
transport_party_->Spawn(name, std::forward<Factory>(factory),
|
|
422
|
+
std::forward<OnDone>(on_done));
|
|
419
423
|
}
|
|
420
424
|
|
|
421
425
|
//////////////////////////////////////////////////////////////////////////////
|
|
@@ -461,35 +465,26 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
461
465
|
RefCountedPtr<Stream> stream,
|
|
462
466
|
StreamDataQueue<ServerMetadataHandle>::StreamWritabilityUpdate result);
|
|
463
467
|
|
|
464
|
-
// Returns the number of active streams.
|
|
465
|
-
//
|
|
466
|
-
//
|
|
467
|
-
|
|
468
|
-
// 1. Reading a RST_STREAM frame: In this case, the stream is immediately
|
|
469
|
-
// closed for reads and writes and removed from the stream_list_
|
|
470
|
-
// (effectively tracking the number of active streams).
|
|
471
|
-
// 2. Reading a Trailing Metadata frame: In this case, the stream MAY be
|
|
472
|
-
// closed for reads and writes immediately which follows the above case. In
|
|
473
|
-
// other cases, the transport either reads RST_STREAM frame from the server
|
|
474
|
-
// (and follows case 1) or sends a half close frame and closes the stream
|
|
475
|
-
// for reads and writes (in the multiplexer loop).
|
|
476
|
-
// 3. Hitting error condition in the transport: In this case, RST_STREAM is
|
|
477
|
-
// is enqueued and the stream is closed for reads immediately. This means
|
|
478
|
-
// we effectively reduce the number of active streams inline (because we
|
|
479
|
-
// remove the stream from the stream_list_). This is fine because the
|
|
480
|
-
// priority logic in list of writable streams ensures that the RST_STREAM
|
|
481
|
-
// frame is given priority over any new streams being created by the
|
|
482
|
-
// client.
|
|
483
|
-
// 4. Application abort: In this case, multiplexer loop will write RST_STREAM
|
|
484
|
-
// frame to the endpoint and close the stream from reads and writes. This
|
|
485
|
-
// then follows the same reasoning as case 1.
|
|
486
|
-
inline uint32_t GetActiveStreamCountLocked() const
|
|
468
|
+
// Returns the number of active streams.
|
|
469
|
+
// A stream is removed from the `active` list once both client and server
|
|
470
|
+
// agree to close the stream.
|
|
471
|
+
uint32_t GetActiveStreamCountLocked() const
|
|
487
472
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(transport_mutex_) {
|
|
488
|
-
// TODO(tjagtap) : [PH2][P1] : Check if impl needs to change for server.
|
|
489
|
-
// TODO(tjagtap) : [PH2][P1] : Check if comment needs to change for server.
|
|
490
473
|
return stream_list_.size();
|
|
491
474
|
}
|
|
492
475
|
|
|
476
|
+
bool IsPingWithoutCallsAllowed() const {
|
|
477
|
+
return keepalive_permit_without_calls_;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
bool IsTransportIdle() {
|
|
481
|
+
MutexLock lock(&transport_mutex_);
|
|
482
|
+
return GetActiveStreamCountLocked() == 0;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
void EnqueueResetStreamFromTransportParty(RefCountedPtr<Stream> stream,
|
|
486
|
+
uint32_t reset_stream_error_code);
|
|
487
|
+
|
|
493
488
|
//////////////////////////////////////////////////////////////////////////////
|
|
494
489
|
// Stream Operations
|
|
495
490
|
|
|
@@ -497,7 +492,7 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
497
492
|
|
|
498
493
|
// Runs on the call party.
|
|
499
494
|
std::optional<RefCountedPtr<Stream>> MakeStream(
|
|
500
|
-
CallInitiator&& call_initiator,
|
|
495
|
+
CallInitiator&& call_initiator, uint32_t stream_id);
|
|
501
496
|
|
|
502
497
|
Http2Status IncomingStream(ClientMetadataHandle&& metadata,
|
|
503
498
|
uint32_t stream_id);
|
|
@@ -508,15 +503,24 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
508
503
|
// reads. Writes will be closed by the write loop after the RST_STREAM frame
|
|
509
504
|
// is written to the wire.
|
|
510
505
|
// Prefer calling HandleError over this API.
|
|
506
|
+
// Note: Use override_tarpit with caution. This would bypass the TarpitManager
|
|
507
|
+
// and would result in immediate stream closure. Currently the use of this
|
|
508
|
+
// parameter is limited to two places:
|
|
509
|
+
// 1. Transport closure path.
|
|
510
|
+
// 2. Stream reset triggered by reclaimer.
|
|
511
511
|
// Parameters:
|
|
512
512
|
// stream: The stream to close.
|
|
513
513
|
// reset_stream_error_code: The error code to use for the RST_STREAM frame.
|
|
514
514
|
// trailing_metadata_status: The failure status to propagate to the
|
|
515
515
|
// application.
|
|
516
|
+
// tarpit: Whether stream closure should be delayed via TarpitManager.
|
|
517
|
+
// override_tarpit: When true, bypasses any ongoing tarpit delay or check
|
|
518
|
+
// and forces immediate reset frame emission and cleanup.
|
|
516
519
|
// whence: The location of the caller.
|
|
517
520
|
void BeginCloseStream(RefCountedPtr<Stream> stream,
|
|
518
521
|
uint32_t reset_stream_error_code,
|
|
519
|
-
absl::Status trailing_metadata_status,
|
|
522
|
+
absl::Status trailing_metadata_status, bool tarpit,
|
|
523
|
+
bool override_tarpit = false,
|
|
520
524
|
DebugLocation whence = {});
|
|
521
525
|
|
|
522
526
|
// Handles stream state changes by discarding pending header parsing if reads
|
|
@@ -543,23 +547,31 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
543
547
|
auto WaitForPingAck() { return ping_manager_->WaitForPingAck(); }
|
|
544
548
|
|
|
545
549
|
Duration NextAllowedPingInterval() {
|
|
546
|
-
|
|
547
|
-
|
|
550
|
+
if (goaway_manager_.IsGracefulGoawayInProgress()) {
|
|
551
|
+
return Duration::Zero();
|
|
552
|
+
}
|
|
553
|
+
return keepalive_time_ == Duration::Infinity() ? Duration::Seconds(20)
|
|
554
|
+
: keepalive_time_ / 2;
|
|
548
555
|
}
|
|
549
556
|
|
|
550
557
|
absl::Status AckPing(uint64_t opaque_data);
|
|
551
558
|
|
|
552
559
|
void MaybeSpawnKeepaliveLoop();
|
|
553
560
|
|
|
554
|
-
// uint32_t GetMaxAllowedStreamId() const;
|
|
555
|
-
// void SetMaxAllowedStreamId(uint32_t max_allowed_stream_id);
|
|
556
|
-
|
|
557
561
|
//////////////////////////////////////////////////////////////////////////////
|
|
558
562
|
// Error Path and Close Path
|
|
559
563
|
|
|
560
564
|
void MaybeSpawnCloseTransport(Http2Status http2_status,
|
|
561
565
|
DebugLocation whence = {});
|
|
562
566
|
|
|
567
|
+
auto CloseTransportFactory(
|
|
568
|
+
absl::flat_hash_map<uint32_t, RefCountedPtr<Stream>> stream_list,
|
|
569
|
+
Http2Status http2_status, DebugLocation whence = {});
|
|
570
|
+
|
|
571
|
+
void CloseAllActiveStreams(
|
|
572
|
+
absl::flat_hash_map<uint32_t, RefCountedPtr<Stream>>&& stream_list,
|
|
573
|
+
const Http2Status& http2_status, DebugLocation whence);
|
|
574
|
+
|
|
563
575
|
// bool CanCloseTransportLocked() const
|
|
564
576
|
// ABSL_EXCLUSIVE_LOCKS_REQUIRED(transport_mutex_);
|
|
565
577
|
|
|
@@ -577,6 +589,15 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
577
589
|
absl::Status HandleError(RefCountedPtr<Stream> stream, Http2Status status,
|
|
578
590
|
DebugLocation whence = {});
|
|
579
591
|
|
|
592
|
+
auto PingOnResetStream() {
|
|
593
|
+
read_context_.SetPingOnRstStreamInProgress(true);
|
|
594
|
+
TriggerWriteCycleOrHandleError();
|
|
595
|
+
return Map(ping_manager_->WaitForPingAck(), [this](absl::Status status) {
|
|
596
|
+
read_context_.SetPingOnRstStreamInProgress(false);
|
|
597
|
+
return Empty{};
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
|
|
580
601
|
//////////////////////////////////////////////////////////////////////////////
|
|
581
602
|
// Misc Transport Stuff
|
|
582
603
|
|
|
@@ -591,8 +612,6 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
591
612
|
const char* reason)
|
|
592
613
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&transport_mutex_);
|
|
593
614
|
|
|
594
|
-
bool SetOnDone(RefCountedPtr<Stream> stream);
|
|
595
|
-
|
|
596
615
|
void ReadChannelArgs(const ChannelArgs& channel_args,
|
|
597
616
|
TransportChannelArgs& args);
|
|
598
617
|
|
|
@@ -616,6 +635,19 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
616
635
|
|
|
617
636
|
auto SpawnGracefulGoawayPromise(Slice&& debug_data);
|
|
618
637
|
|
|
638
|
+
//////////////////////////////////////////////////////////////////////////////
|
|
639
|
+
// Tarpit
|
|
640
|
+
|
|
641
|
+
// Returns a promise running the tarpit drain loop which receives incoming
|
|
642
|
+
// tarpit entries and enqueues them into TarpitManager.
|
|
643
|
+
auto MakeTarpitDrainLoop();
|
|
644
|
+
// Returns a promise running the tarpit timer loop which waits for timer
|
|
645
|
+
// expiration and performs final actions on expired tarpit entries.
|
|
646
|
+
auto MakeTarpitTimerLoop();
|
|
647
|
+
// Performs final actions on expired tarpit entries (sending reset, trailing
|
|
648
|
+
// metadata, or cleaning up stream state).
|
|
649
|
+
void ActOnTarpitEntries(std::vector<TarpitEntry>&& entries);
|
|
650
|
+
|
|
619
651
|
//////////////////////////////////////////////////////////////////////////////
|
|
620
652
|
// Inner Classes and Structs
|
|
621
653
|
|
|
@@ -680,7 +712,8 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
680
712
|
|
|
681
713
|
RefCountedPtr<UnstartedCallDestination> call_destination_;
|
|
682
714
|
|
|
683
|
-
|
|
715
|
+
// Refer AGENTS.md for party slot usage
|
|
716
|
+
RefCountedPtr<Party> transport_party_;
|
|
684
717
|
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine_;
|
|
685
718
|
|
|
686
719
|
PromiseEndpoint endpoint_;
|
|
@@ -692,14 +725,14 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
692
725
|
ABSL_GUARDED_BY(transport_mutex_);
|
|
693
726
|
|
|
694
727
|
HPackCompressor encoder_;
|
|
695
|
-
|
|
696
|
-
Latch<void> transport_closed_latch_;
|
|
728
|
+
TransportShutdownTracker shutdown_tracker_;
|
|
697
729
|
grpc_closure* on_close_callback_;
|
|
698
730
|
|
|
699
731
|
ConnectivityStateTracker state_tracker_ ABSL_GUARDED_BY(transport_mutex_){
|
|
700
732
|
"http2_server", GRPC_CHANNEL_READY};
|
|
701
733
|
|
|
702
734
|
RefCountedPtr<StateWatcher> watcher_ ABSL_GUARDED_BY(transport_mutex_);
|
|
735
|
+
bool is_goaway_received_;
|
|
703
736
|
|
|
704
737
|
bool should_reset_ping_clock_;
|
|
705
738
|
ReadContext read_context_;
|
|
@@ -708,11 +741,8 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
708
741
|
// transport during write cycles.
|
|
709
742
|
TransportWriteContext transport_write_context_;
|
|
710
743
|
|
|
711
|
-
// Tracks the max allowed stream id. Currently this is only set on receiving a
|
|
712
|
-
// graceful GOAWAY frame.
|
|
713
|
-
GRPC_UNUSED uint32_t max_allowed_stream_id_ = RFC9113::kMaxStreamId31Bit;
|
|
714
744
|
// Tracks last stream id received by the transport.
|
|
715
|
-
uint32_t last_incoming_stream_id_
|
|
745
|
+
uint32_t last_incoming_stream_id_;
|
|
716
746
|
|
|
717
747
|
// Duration between two consecutive keepalive pings.
|
|
718
748
|
Duration keepalive_time_;
|
|
@@ -733,6 +763,7 @@ class Http2ServerTransport final : public ServerTransport,
|
|
|
733
763
|
|
|
734
764
|
// TODO(tjagtap) [PH2][P2][BDP] Remove this when the BDP code is done.
|
|
735
765
|
Waker periodic_updates_waker_;
|
|
766
|
+
TarpitManager tarpit_manager_;
|
|
736
767
|
};
|
|
737
768
|
|
|
738
769
|
// TODO(tjagtap) : [PH2][P1] : Handle the case where a Server receives two
|
|
@@ -71,8 +71,7 @@ struct ApplySettingsResult {
|
|
|
71
71
|
bool should_spawn_security_frame_loop = false;
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
// This class can only be used only from a promise based HTTP2 transports
|
|
75
|
-
// general_party_ .
|
|
74
|
+
// This class can only be used only from a promise based HTTP2 transports party.
|
|
76
75
|
// This class is designed with the assumption that only 1 SETTINGS frame will be
|
|
77
76
|
// in flight at a time. And we do not send a second SETTINGS frame till we
|
|
78
77
|
// receive and process the SETTINGS ACK and resolve the ACK promise.
|
|
@@ -208,7 +208,8 @@ class GRPC_MUST_USE_RESULT Http2Status {
|
|
|
208
208
|
bool IsOk() const { return (http2_code_ == Http2ErrorCode::kNoError); }
|
|
209
209
|
|
|
210
210
|
std::string DebugString() const {
|
|
211
|
-
return absl::StrCat(DebugGetType(),
|
|
211
|
+
return absl::StrCat(DebugGetType(),
|
|
212
|
+
": {Error Code:", DebugGetCode(http2_code_),
|
|
212
213
|
", Message:", message_, "}");
|
|
213
214
|
}
|
|
214
215
|
|
|
@@ -227,6 +228,42 @@ class GRPC_MUST_USE_RESULT Http2Status {
|
|
|
227
228
|
Http2Status(const Http2Status&) = delete;
|
|
228
229
|
Http2Status& operator=(const Http2Status&) = delete;
|
|
229
230
|
|
|
231
|
+
static absl::string_view DebugGetCode(Http2ErrorCode code) {
|
|
232
|
+
switch (code) {
|
|
233
|
+
case Http2ErrorCode::kNoError:
|
|
234
|
+
return "NO_ERROR";
|
|
235
|
+
case Http2ErrorCode::kProtocolError:
|
|
236
|
+
return "PROTOCOL_ERROR";
|
|
237
|
+
case Http2ErrorCode::kInternalError:
|
|
238
|
+
return "INTERNAL_ERROR";
|
|
239
|
+
case Http2ErrorCode::kFlowControlError:
|
|
240
|
+
return "FLOW_CONTROL_ERROR";
|
|
241
|
+
case Http2ErrorCode::kSettingsTimeout:
|
|
242
|
+
return "SETTINGS_TIMEOUT";
|
|
243
|
+
case Http2ErrorCode::kStreamClosed:
|
|
244
|
+
return "STREAM_CLOSED";
|
|
245
|
+
case Http2ErrorCode::kFrameSizeError:
|
|
246
|
+
return "FRAME_SIZE_ERROR";
|
|
247
|
+
case Http2ErrorCode::kRefusedStream:
|
|
248
|
+
return "REFUSED_STREAM";
|
|
249
|
+
case Http2ErrorCode::kCancel:
|
|
250
|
+
return "CANCEL";
|
|
251
|
+
case Http2ErrorCode::kCompressionError:
|
|
252
|
+
return "COMPRESSION_ERROR";
|
|
253
|
+
case Http2ErrorCode::kConnectError:
|
|
254
|
+
return "CONNECT_ERROR";
|
|
255
|
+
case Http2ErrorCode::kEnhanceYourCalm:
|
|
256
|
+
return "ENHANCE_YOUR_CALM";
|
|
257
|
+
case Http2ErrorCode::kInadequateSecurity:
|
|
258
|
+
return "INADEQUATE_SECURITY";
|
|
259
|
+
case Http2ErrorCode::kDoNotUse:
|
|
260
|
+
return "HTTP_1_1_REQUIRED";
|
|
261
|
+
default:
|
|
262
|
+
DCHECK(false);
|
|
263
|
+
}
|
|
264
|
+
GPR_UNREACHABLE_CODE(return "Invalid");
|
|
265
|
+
}
|
|
266
|
+
|
|
230
267
|
private:
|
|
231
268
|
explicit Http2Status()
|
|
232
269
|
: http2_code_(Http2ErrorCode::kNoError),
|
|
@@ -284,42 +321,6 @@ class GRPC_MUST_USE_RESULT Http2Status {
|
|
|
284
321
|
GPR_UNREACHABLE_CODE(return "Invalid");
|
|
285
322
|
}
|
|
286
323
|
|
|
287
|
-
std::string DebugGetCode() const {
|
|
288
|
-
switch (http2_code_) {
|
|
289
|
-
case Http2ErrorCode::kNoError:
|
|
290
|
-
return "NO_ERROR";
|
|
291
|
-
case Http2ErrorCode::kProtocolError:
|
|
292
|
-
return "PROTOCOL_ERROR";
|
|
293
|
-
case Http2ErrorCode::kInternalError:
|
|
294
|
-
return "INTERNAL_ERROR";
|
|
295
|
-
case Http2ErrorCode::kFlowControlError:
|
|
296
|
-
return "FLOW_CONTROL_ERROR";
|
|
297
|
-
case Http2ErrorCode::kSettingsTimeout:
|
|
298
|
-
return "SETTINGS_TIMEOUT";
|
|
299
|
-
case Http2ErrorCode::kStreamClosed:
|
|
300
|
-
return "STREAM_CLOSED";
|
|
301
|
-
case Http2ErrorCode::kFrameSizeError:
|
|
302
|
-
return "FRAME_SIZE_ERROR";
|
|
303
|
-
case Http2ErrorCode::kRefusedStream:
|
|
304
|
-
return "REFUSED_STREAM";
|
|
305
|
-
case Http2ErrorCode::kCancel:
|
|
306
|
-
return "CANCEL";
|
|
307
|
-
case Http2ErrorCode::kCompressionError:
|
|
308
|
-
return "COMPRESSION_ERROR";
|
|
309
|
-
case Http2ErrorCode::kConnectError:
|
|
310
|
-
return "CONNECT_ERROR";
|
|
311
|
-
case Http2ErrorCode::kEnhanceYourCalm:
|
|
312
|
-
return "ENHANCE_YOUR_CALM";
|
|
313
|
-
case Http2ErrorCode::kInadequateSecurity:
|
|
314
|
-
return "INADEQUATE_SECURITY";
|
|
315
|
-
case Http2ErrorCode::kDoNotUse:
|
|
316
|
-
return "HTTP_1_1_REQUIRED";
|
|
317
|
-
default:
|
|
318
|
-
DCHECK(false);
|
|
319
|
-
}
|
|
320
|
-
GPR_UNREACHABLE_CODE(return "Invalid");
|
|
321
|
-
}
|
|
322
|
-
|
|
323
324
|
const Http2ErrorCode http2_code_;
|
|
324
325
|
const Http2ErrorType error_type_;
|
|
325
326
|
const absl::StatusCode absl_code_;
|
|
@@ -21,18 +21,24 @@
|
|
|
21
21
|
#include <grpc/event_engine/event_engine.h>
|
|
22
22
|
#include <grpc/grpc.h>
|
|
23
23
|
#include <grpc/impl/channel_arg_names.h>
|
|
24
|
+
#include <grpc/support/port_platform.h>
|
|
24
25
|
|
|
25
26
|
#include <algorithm>
|
|
26
27
|
#include <climits>
|
|
28
|
+
#include <cstddef>
|
|
27
29
|
#include <cstdint>
|
|
30
|
+
#include <limits>
|
|
28
31
|
#include <memory>
|
|
29
32
|
#include <optional>
|
|
30
33
|
#include <string>
|
|
31
34
|
#include <utility>
|
|
35
|
+
#include <variant>
|
|
32
36
|
#include <vector>
|
|
33
37
|
|
|
38
|
+
#include "src/core/call/metadata.h"
|
|
34
39
|
#include "src/core/call/metadata_info.h"
|
|
35
40
|
#include "src/core/channelz/channelz.h"
|
|
41
|
+
#include "src/core/channelz/property_list.h"
|
|
36
42
|
#include "src/core/ext/transport/chttp2/transport/flow_control.h"
|
|
37
43
|
#include "src/core/ext/transport/chttp2/transport/frame.h"
|
|
38
44
|
#include "src/core/ext/transport/chttp2/transport/header_assembler.h"
|
|
@@ -42,17 +48,23 @@
|
|
|
42
48
|
#include "src/core/ext/transport/chttp2/transport/http2_status.h"
|
|
43
49
|
#include "src/core/ext/transport/chttp2/transport/internal_channel_arg_names.h"
|
|
44
50
|
#include "src/core/ext/transport/chttp2/transport/stream.h"
|
|
51
|
+
#include "src/core/ext/transport/chttp2/transport/transport_common.h"
|
|
45
52
|
#include "src/core/ext/transport/chttp2/transport/write_cycle.h"
|
|
46
53
|
#include "src/core/lib/channel/channel_args.h"
|
|
47
54
|
#include "src/core/lib/event_engine/tcp_socket_utils.h"
|
|
55
|
+
#include "src/core/lib/promise/status_flag.h"
|
|
48
56
|
#include "src/core/lib/slice/slice_buffer.h"
|
|
49
57
|
#include "src/core/util/grpc_check.h"
|
|
50
58
|
#include "src/core/util/ref_counted_ptr.h"
|
|
51
59
|
#include "src/core/util/time.h"
|
|
60
|
+
#include "src/core/util/useful.h"
|
|
52
61
|
#include "absl/log/log.h"
|
|
53
62
|
#include "absl/status/status.h"
|
|
54
63
|
#include "absl/strings/str_cat.h"
|
|
55
64
|
|
|
65
|
+
#define GRPC_ARG_HTTP2_PING_ON_RST_STREAM_PERCENT \
|
|
66
|
+
"grpc.http2.ping_on_rst_stream_percent"
|
|
67
|
+
|
|
56
68
|
namespace grpc_core {
|
|
57
69
|
namespace http2 {
|
|
58
70
|
|
|
@@ -144,7 +156,7 @@ std::string TransportChannelArgs::DebugString() const {
|
|
|
144
156
|
void ReadChannelArgs(const ChannelArgs& channel_args,
|
|
145
157
|
TransportChannelArgs& args, Http2Settings& local_settings,
|
|
146
158
|
chttp2::TransportFlowControl& flow_control,
|
|
147
|
-
bool is_client) {
|
|
159
|
+
const bool is_client) {
|
|
148
160
|
ReadSettingsFromChannelArgs(channel_args, local_settings, flow_control,
|
|
149
161
|
is_client);
|
|
150
162
|
|
|
@@ -279,6 +291,14 @@ uint32_t GetMaxSecurityFrameSize(const ChannelArgs& channel_args) {
|
|
|
279
291
|
static_cast<int>(GrpcErrors::kMaxSecurityFrameSize)));
|
|
280
292
|
}
|
|
281
293
|
|
|
294
|
+
uint8_t GetPingOnRstStreamPercent(const ChannelArgs& channel_args,
|
|
295
|
+
const bool is_client) {
|
|
296
|
+
if (is_client) return 0;
|
|
297
|
+
return Clamp(channel_args.GetInt(GRPC_ARG_HTTP2_PING_ON_RST_STREAM_PERCENT)
|
|
298
|
+
.value_or(1),
|
|
299
|
+
0, 100);
|
|
300
|
+
}
|
|
301
|
+
|
|
282
302
|
///////////////////////////////////////////////////////////////////////////////
|
|
283
303
|
// ChannelZ helpers
|
|
284
304
|
|
|
@@ -288,10 +308,12 @@ RefCountedPtr<channelz::SocketNode> CreateChannelzSocketNode(
|
|
|
288
308
|
const ChannelArgs& args) {
|
|
289
309
|
if (args.GetBool(GRPC_ARG_ENABLE_CHANNELZ)
|
|
290
310
|
.value_or(GRPC_ENABLE_CHANNELZ_DEFAULT)) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
311
|
+
absl::StatusOr<std::string> local_addr =
|
|
312
|
+
grpc_event_engine::experimental::ResolvedAddressToString(
|
|
313
|
+
event_engine_endpoint->GetLocalAddress());
|
|
314
|
+
absl::StatusOr<std::string> peer_addr =
|
|
315
|
+
grpc_event_engine::experimental::ResolvedAddressToString(
|
|
316
|
+
event_engine_endpoint->GetPeerAddress());
|
|
295
317
|
GRPC_HTTP2_COMMON_DLOG << "CreateChannelzSocketNode: local_addr: "
|
|
296
318
|
<< local_addr.value_or("unknown")
|
|
297
319
|
<< " peer_addr: " << peer_addr.value_or("unknown");
|
|
@@ -324,6 +346,7 @@ ProcessIncomingDataFrameFlowControl(const Http2FrameHeader& frame_header,
|
|
|
324
346
|
Stream* stream) {
|
|
325
347
|
GRPC_DCHECK_EQ(frame_header.type, 0u);
|
|
326
348
|
if (frame_header.length > 0) {
|
|
349
|
+
flow_control.OnReceiveDataFrame(frame_header.length);
|
|
327
350
|
if (stream == nullptr) {
|
|
328
351
|
// This flow control bookkeeping needs to happen even though the stream is
|
|
329
352
|
// gone because otherwise we will go out-of-sync with the peer.
|
|
@@ -457,5 +480,155 @@ void MaybeAddStreamWindowUpdateFrame(Stream& stream,
|
|
|
457
480
|
}
|
|
458
481
|
}
|
|
459
482
|
|
|
483
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
484
|
+
// TarpitEntry implementation
|
|
485
|
+
|
|
486
|
+
std::string TarpitEntry::DebugString() const {
|
|
487
|
+
std::string payload_str;
|
|
488
|
+
const OutgoingResetPayload* const reset =
|
|
489
|
+
std::get_if<OutgoingResetPayload>(&payload_);
|
|
490
|
+
const OutgoingTrailingMetadataPayload* const trailers =
|
|
491
|
+
std::get_if<OutgoingTrailingMetadataPayload>(&payload_);
|
|
492
|
+
const IncomingResetPayload* const incoming_reset =
|
|
493
|
+
std::get_if<IncomingResetPayload>(&payload_);
|
|
494
|
+
if (reset != nullptr) {
|
|
495
|
+
payload_str = absl::StrCat(
|
|
496
|
+
"OutgoingReset(error_code=", reset->http2_error_code,
|
|
497
|
+
", status=", reset->trailing_metadata_status.ToString(), ")");
|
|
498
|
+
} else if (trailers != nullptr) {
|
|
499
|
+
payload_str = absl::StrCat("OutgoingTrailingMetadata(",
|
|
500
|
+
trailers->metadata != nullptr
|
|
501
|
+
? trailers->metadata->DebugString()
|
|
502
|
+
: "null",
|
|
503
|
+
")");
|
|
504
|
+
} else if (incoming_reset != nullptr) {
|
|
505
|
+
payload_str = absl::StrCat(
|
|
506
|
+
"IncomingReset(status=", incoming_reset->status.ToString(), ")");
|
|
507
|
+
} else {
|
|
508
|
+
payload_str = "unknown type";
|
|
509
|
+
}
|
|
510
|
+
return absl::StrCat("TarpitEntry{stream_id=", stream_id_,
|
|
511
|
+
", expire_time=", expire_time_.ToString(),
|
|
512
|
+
", payload=", payload_str, "}");
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
516
|
+
// TarpitManager implementation
|
|
517
|
+
|
|
518
|
+
TarpitManager::TarpitManager(const ChannelArgs& channel_args)
|
|
519
|
+
: allow_tarpit_(
|
|
520
|
+
channel_args.GetBool(GRPC_ARG_HTTP_ALLOW_TARPIT).value_or(true)),
|
|
521
|
+
min_tarpit_duration_(
|
|
522
|
+
channel_args
|
|
523
|
+
.GetDurationFromIntMillis(GRPC_ARG_HTTP_TARPIT_MIN_DURATION_MS)
|
|
524
|
+
.value_or(Duration::Milliseconds(100))),
|
|
525
|
+
max_tarpit_duration_(
|
|
526
|
+
channel_args
|
|
527
|
+
.GetDurationFromIntMillis(GRPC_ARG_HTTP_TARPIT_MAX_DURATION_MS)
|
|
528
|
+
.value_or(Duration::Seconds(1))),
|
|
529
|
+
receiver_(std::numeric_limits<size_t>::max()),
|
|
530
|
+
sender_(receiver_.MakeSender()) {
|
|
531
|
+
GRPC_CHECK_LE(min_tarpit_duration_, max_tarpit_duration_);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
Duration TarpitManager::GetTarpitDuration() const {
|
|
535
|
+
return TarpitDuration(static_cast<int>(min_tarpit_duration_.millis()),
|
|
536
|
+
static_cast<int>(max_tarpit_duration_.millis()));
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
StatusFlag TarpitManager::RequestCloseStream(
|
|
540
|
+
const uint32_t stream_id, const uint32_t reset_stream_error_code,
|
|
541
|
+
absl::Status trailing_metadata_status) {
|
|
542
|
+
GRPC_DCHECK(allow_tarpit_);
|
|
543
|
+
GRPC_DCHECK_NE(stream_id, kInvalidStreamId);
|
|
544
|
+
GRPC_HTTP2_COMMON_DLOG << "TarpitManager::RequestCloseStream Stream id: "
|
|
545
|
+
<< stream_id << " reset_stream_error_code: "
|
|
546
|
+
<< reset_stream_error_code
|
|
547
|
+
<< " trailing_metadata_status: "
|
|
548
|
+
<< trailing_metadata_status;
|
|
549
|
+
const Timestamp expire_time = Timestamp::Now() + GetTarpitDuration();
|
|
550
|
+
TarpitEntry entry = TarpitEntry::CreateOutgoingReset(
|
|
551
|
+
stream_id, reset_stream_error_code, std::move(trailing_metadata_status),
|
|
552
|
+
expire_time);
|
|
553
|
+
const StatusFlag status =
|
|
554
|
+
sender_.UnbufferedImmediateSend(std::move(entry), 1);
|
|
555
|
+
return status;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
StatusFlag TarpitManager::StartTarpitTrailers(const uint32_t stream_id,
|
|
559
|
+
ServerMetadataHandle metadata) {
|
|
560
|
+
GRPC_DCHECK(allow_tarpit_);
|
|
561
|
+
GRPC_DCHECK_NE(stream_id, kInvalidStreamId);
|
|
562
|
+
GRPC_HTTP2_COMMON_DLOG << "TarpitManager::StartTarpitTrailers Stream id: "
|
|
563
|
+
<< stream_id;
|
|
564
|
+
const Timestamp expire_time = Timestamp::Now() + GetTarpitDuration();
|
|
565
|
+
TarpitEntry entry = TarpitEntry::CreateOutgoingTrailingMetadata(
|
|
566
|
+
stream_id, std::move(metadata), expire_time);
|
|
567
|
+
const StatusFlag status =
|
|
568
|
+
sender_.UnbufferedImmediateSend(std::move(entry), 1);
|
|
569
|
+
return status;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
StatusFlag TarpitManager::RequestTarpitIncomingReset(const uint32_t stream_id,
|
|
573
|
+
absl::Status status) {
|
|
574
|
+
GRPC_DCHECK(allow_tarpit_);
|
|
575
|
+
GRPC_DCHECK_NE(stream_id, kInvalidStreamId);
|
|
576
|
+
GRPC_HTTP2_COMMON_DLOG
|
|
577
|
+
<< "TarpitManager::RequestTarpitIncomingReset Stream id: " << stream_id
|
|
578
|
+
<< " status: " << status;
|
|
579
|
+
|
|
580
|
+
const Timestamp expire_time = Timestamp::Now() + GetTarpitDuration();
|
|
581
|
+
TarpitEntry entry = TarpitEntry::CreateIncomingReset(
|
|
582
|
+
stream_id, std::move(status), expire_time);
|
|
583
|
+
const StatusFlag send_status =
|
|
584
|
+
sender_.UnbufferedImmediateSend(std::move(entry), 1);
|
|
585
|
+
return send_status;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
StreamStateChange TarpitManager::OnTarpit(Stream& stream) {
|
|
589
|
+
stream.SetTarpitActive();
|
|
590
|
+
return stream.OnInitiateReset(absl::CancelledError("Stream tarpitted"));
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
void TarpitManager::AddToQueue(TarpitEntry&& entry) {
|
|
594
|
+
if (GPR_UNLIKELY(shutdown_)) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
tarpit_queue_.Push(std::forward<TarpitEntry>(entry));
|
|
598
|
+
empty_queue_waker_.Wakeup();
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
std::vector<TarpitEntry> TarpitManager::OnTimerExpired() {
|
|
602
|
+
const Timestamp now = Timestamp::Now();
|
|
603
|
+
std::vector<TarpitEntry> expired_entries;
|
|
604
|
+
while (!tarpit_queue_.IsEmpty() &&
|
|
605
|
+
tarpit_queue_.Top().GetExpireTime() <= now) {
|
|
606
|
+
expired_entries.push_back(tarpit_queue_.Pop());
|
|
607
|
+
}
|
|
608
|
+
return expired_entries;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
void TarpitManager::Shutdown() {
|
|
612
|
+
shutdown_ = true;
|
|
613
|
+
tarpit_queue_.Clear();
|
|
614
|
+
receiver_.MarkClosed();
|
|
615
|
+
empty_queue_waker_.Wakeup();
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
channelz::PropertyList TarpitManager::ChannelzProperties() const {
|
|
619
|
+
channelz::PropertyList properties;
|
|
620
|
+
properties.Set("allow_tarpit", allow_tarpit_)
|
|
621
|
+
.Set("min_tarpit_duration", min_tarpit_duration_)
|
|
622
|
+
.Set("max_tarpit_duration", max_tarpit_duration_)
|
|
623
|
+
.Set("is_shutdown", shutdown_)
|
|
624
|
+
.Set("current_tarpitted_streams_count", tarpit_queue_.Size())
|
|
625
|
+
.Set("is_queue_empty", tarpit_queue_.IsEmpty());
|
|
626
|
+
if (!tarpit_queue_.IsEmpty()) {
|
|
627
|
+
properties.Set("earliest_expiration_time",
|
|
628
|
+
tarpit_queue_.Top().GetExpireTime());
|
|
629
|
+
}
|
|
630
|
+
return properties;
|
|
631
|
+
}
|
|
632
|
+
|
|
460
633
|
} // namespace http2
|
|
461
634
|
} // namespace grpc_core
|