grpc 1.75.0.pre1 → 1.76.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +18 -5
- data/include/grpc/credentials.h +21 -5
- data/src/core/call/call_filters.cc +4 -4
- data/src/core/call/call_filters.h +36 -36
- data/src/core/call/call_spine.h +27 -27
- data/src/core/call/client_call.cc +6 -5
- data/src/core/call/filter_fusion.h +5 -5
- data/src/core/call/metadata_batch.h +3 -3
- data/src/core/call/security_context.cc +1 -1
- data/src/core/call/server_call.cc +4 -4
- data/src/core/call/server_call.h +1 -1
- data/src/core/channelz/channelz.cc +12 -18
- data/src/core/channelz/channelz.h +32 -16
- data/src/core/channelz/channelz_registry.h +11 -0
- data/src/core/channelz/property_list.cc +18 -0
- data/src/core/channelz/property_list.h +10 -1
- data/src/core/channelz/text_encode.cc +66 -0
- data/src/core/channelz/text_encode.h +29 -0
- data/src/core/channelz/v2tov1/convert.cc +11 -0
- data/src/core/channelz/v2tov1/legacy_api.cc +15 -8
- data/src/core/channelz/ztrace_collector.h +247 -86
- data/src/core/client_channel/backup_poller.cc +5 -6
- data/src/core/client_channel/client_channel.cc +20 -13
- data/src/core/client_channel/client_channel_filter.cc +53 -45
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_internal.h +3 -4
- data/src/core/client_channel/config_selector.h +3 -3
- data/src/core/client_channel/dynamic_filters.cc +3 -3
- data/src/core/client_channel/global_subchannel_pool.cc +0 -37
- data/src/core/client_channel/global_subchannel_pool.h +0 -27
- data/src/core/client_channel/load_balanced_call_destination.cc +7 -7
- data/src/core/client_channel/local_subchannel_pool.cc +4 -4
- data/src/core/client_channel/retry_filter.h +3 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -5
- data/src/core/client_channel/subchannel.cc +8 -8
- data/src/core/client_channel/subchannel_stream_client.cc +4 -4
- data/src/core/config/config_vars.cc +30 -1
- data/src/core/config/config_vars.h +21 -0
- data/src/core/config/core_configuration.cc +5 -5
- data/src/core/config/core_configuration.h +7 -7
- data/src/core/config/load_config.cc +12 -0
- data/src/core/config/load_config.h +2 -0
- data/src/core/credentials/call/call_credentials.h +2 -2
- data/src/core/credentials/call/call_creds_util.cc +4 -3
- data/src/core/credentials/call/composite/composite_call_credentials.cc +4 -4
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +3 -3
- data/src/core/credentials/call/external/external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/iam/iam_credentials.cc +4 -4
- data/src/core/credentials/call/jwt/json_token.cc +3 -3
- data/src/core/credentials/call/jwt/jwt_credentials.cc +2 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +14 -13
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +20 -12
- data/src/core/credentials/call/plugin/plugin_credentials.cc +2 -2
- data/src/core/credentials/transport/alts/alts_credentials.cc +4 -4
- data/src/core/credentials/transport/alts/alts_security_connector.cc +14 -12
- data/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc +22 -2
- data/src/core/credentials/transport/alts/grpc_alts_credentials_options.cc +10 -1
- data/src/core/credentials/transport/alts/grpc_alts_credentials_options.h +31 -0
- data/src/core/credentials/transport/alts/grpc_alts_credentials_server_options.cc +8 -3
- data/src/core/credentials/transport/composite/composite_channel_credentials.cc +5 -5
- data/src/core/credentials/transport/fake/fake_security_connector.cc +2 -2
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +78 -28
- data/src/core/credentials/transport/insecure/insecure_security_connector.cc +3 -3
- data/src/core/credentials/transport/local/local_security_connector.cc +8 -8
- data/src/core/credentials/transport/security_connector.cc +5 -5
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +12 -12
- data/src/core/credentials/transport/ssl/ssl_credentials.h +2 -2
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +3 -3
- data/src/core/credentials/transport/tls/certificate_provider_registry.cc +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +24 -24
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +5 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.cc +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.h +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +17 -17
- data/src/core/credentials/transport/tls/ssl_utils.cc +14 -9
- data/src/core/credentials/transport/tls/tls_credentials.cc +2 -2
- data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -11
- data/src/core/credentials/transport/transport_credentials.cc +2 -2
- data/src/core/credentials/transport/transport_credentials.h +2 -2
- data/src/core/credentials/transport/xds/xds_credentials.cc +5 -5
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +2 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
- data/src/core/ext/filters/http/message_compress/compression_filter.h +3 -3
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +7 -7
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +10 -9
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +96 -88
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.h +12 -7
- data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +60 -0
- data/src/core/ext/transport/chttp2/transport/frame.cc +32 -10
- data/src/core/ext/transport/chttp2/transport/frame.h +16 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +28 -12
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +8 -8
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +27 -27
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +543 -366
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +198 -277
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +11 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +179 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +51 -23
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +13 -6
- data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +115 -71
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -14
- data/src/core/ext/transport/chttp2/transport/message_assembler.h +7 -7
- data/src/core/ext/transport/chttp2/transport/parsing.cc +17 -15
- data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +62 -26
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +58 -22
- data/src/core/ext/transport/chttp2/transport/stream.h +207 -0
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +328 -187
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/transport_common.cc +17 -1
- data/src/core/ext/transport/chttp2/transport/transport_common.h +52 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +2 -2
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +181 -79
- data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +3 -3
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb.h +740 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.c +218 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.h +46 -0
- data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +87 -55
- data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +23 -21
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.c +80 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.c +129 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.h +72 -0
- data/src/core/filter/auth/server_auth_filter.cc +2 -2
- data/src/core/handshaker/handshaker.cc +3 -3
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +2 -2
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +2 -2
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +31 -8
- data/src/core/handshaker/security/secure_endpoint.cc +16 -6
- data/src/core/handshaker/security/security_handshaker.cc +3 -3
- data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +2 -2
- data/src/core/lib/channel/channel_stack.cc +8 -5
- data/src/core/lib/channel/channel_stack.h +3 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -0
- data/src/core/lib/channel/connected_channel.cc +2 -2
- data/src/core/lib/channel/promise_based_filter.cc +69 -64
- data/src/core/lib/channel/promise_based_filter.h +16 -15
- data/src/core/lib/compression/compression_internal.cc +2 -2
- data/src/core/lib/compression/message_compress.cc +7 -7
- data/src/core/lib/event_engine/ares_resolver.cc +22 -20
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -2
- data/src/core/lib/event_engine/extensions/channelz.h +2 -2
- data/src/core/lib/event_engine/extensions/supports_fd.h +5 -5
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +8 -8
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -10
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +23 -22
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +11 -11
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +168 -170
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +33 -54
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +4 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +3 -3
- data/src/core/lib/event_engine/resolved_address.cc +3 -3
- data/src/core/lib/event_engine/shim.cc +8 -11
- data/src/core/lib/event_engine/shim.h +2 -1
- data/src/core/lib/event_engine/slice.cc +2 -2
- data/src/core/lib/event_engine/tcp_socket_utils.cc +11 -11
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +7 -7
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +31 -31
- data/src/core/lib/event_engine/windows/iocp.cc +10 -10
- data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -11
- data/src/core/lib/event_engine/windows/windows_engine.cc +16 -14
- data/src/core/lib/event_engine/windows/windows_listener.cc +7 -7
- data/src/core/lib/experiments/experiments.cc +105 -18
- data/src/core/lib/experiments/experiments.h +43 -11
- data/src/core/lib/iomgr/call_combiner.cc +3 -3
- data/src/core/lib/iomgr/endpoint_cfstream.cc +6 -6
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +5 -5
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +15 -14
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +15 -15
- data/src/core/lib/iomgr/ev_poll_posix.cc +11 -11
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +5 -4
- data/src/core/lib/iomgr/event_engine_shims/endpoint.h +1 -1
- data/src/core/lib/iomgr/iocp_windows.cc +8 -8
- data/src/core/lib/iomgr/iomgr_windows.cc +3 -3
- data/src/core/lib/iomgr/lockfree_event.cc +2 -2
- data/src/core/lib/iomgr/polling_entity.cc +3 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +2 -2
- data/src/core/lib/iomgr/socket_windows.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_windows.cc +4 -4
- data/src/core/lib/iomgr/tcp_posix.cc +42 -42
- data/src/core/lib/iomgr/tcp_server.cc +5 -0
- data/src/core/lib/iomgr/tcp_server.h +7 -0
- data/src/core/lib/iomgr/tcp_server_posix.cc +47 -27
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +2 -2
- data/src/core/lib/iomgr/tcp_server_windows.cc +68 -29
- data/src/core/lib/iomgr/tcp_windows.cc +7 -7
- data/src/core/lib/iomgr/timer_generic.cc +2 -2
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +2 -2
- data/src/core/lib/promise/activity.cc +2 -2
- data/src/core/lib/promise/activity.h +6 -6
- data/src/core/lib/promise/context.h +2 -2
- data/src/core/lib/promise/detail/join_state.h +9 -9
- data/src/core/lib/promise/detail/seq_state.h +13 -13
- data/src/core/lib/promise/detail/status.h +2 -2
- data/src/core/lib/promise/for_each.h +5 -5
- data/src/core/lib/promise/interceptor_list.h +2 -2
- data/src/core/lib/promise/latch.h +7 -7
- data/src/core/lib/promise/mpsc.cc +26 -26
- data/src/core/lib/promise/mpsc.h +2 -2
- data/src/core/lib/promise/observable.h +4 -4
- data/src/core/lib/promise/party.cc +32 -25
- data/src/core/lib/promise/party.h +16 -19
- data/src/core/lib/promise/pipe.h +15 -15
- data/src/core/lib/promise/poll.h +5 -4
- data/src/core/lib/promise/promise.h +0 -2
- data/src/core/lib/promise/sleep.cc +3 -1
- data/src/core/lib/promise/status_flag.h +7 -7
- data/src/core/lib/promise/try_join.h +2 -2
- data/src/core/lib/promise/try_seq.h +2 -2
- data/src/core/lib/resource_quota/arena.h +15 -2
- data/src/core/lib/resource_quota/connection_quota.cc +9 -7
- data/src/core/lib/resource_quota/memory_quota.cc +45 -24
- data/src/core/lib/resource_quota/memory_quota.h +48 -16
- data/src/core/lib/resource_quota/telemetry.h +54 -0
- data/src/core/lib/resource_quota/thread_quota.cc +2 -2
- data/src/core/lib/resource_tracker/resource_tracker.cc +33 -0
- data/src/core/lib/resource_tracker/resource_tracker.h +46 -0
- data/src/core/lib/security/authorization/audit_logging.cc +5 -5
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +2 -2
- data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -2
- data/src/core/lib/surface/call.cc +16 -14
- data/src/core/lib/surface/call.h +1 -1
- data/src/core/lib/surface/call_utils.cc +2 -2
- data/src/core/lib/surface/call_utils.h +2 -2
- data/src/core/lib/surface/channel.cc +4 -4
- data/src/core/lib/surface/channel_create.cc +10 -6
- data/src/core/lib/surface/channel_init.cc +80 -23
- data/src/core/lib/surface/channel_init.h +26 -11
- data/src/core/lib/surface/completion_queue.cc +17 -16
- data/src/core/lib/surface/completion_queue_factory.cc +7 -7
- data/src/core/lib/surface/connection_context.h +45 -2
- data/src/core/lib/surface/filter_stack_call.cc +12 -23
- data/src/core/lib/surface/filter_stack_call.h +3 -4
- data/src/core/lib/surface/legacy_channel.cc +7 -7
- data/src/core/lib/surface/validate_metadata.h +2 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.h +3 -3
- data/src/core/lib/transport/promise_endpoint.cc +3 -3
- data/src/core/lib/transport/promise_endpoint.h +8 -8
- data/src/core/lib/transport/timeout_encoding.cc +4 -4
- data/src/core/load_balancing/child_policy_handler.cc +4 -4
- data/src/core/load_balancing/endpoint_list.cc +2 -2
- data/src/core/load_balancing/grpclb/grpclb.cc +24 -24
- data/src/core/load_balancing/health_check_client.cc +4 -4
- data/src/core/load_balancing/health_check_client_internal.h +2 -2
- data/src/core/load_balancing/lb_policy_registry.cc +2 -2
- data/src/core/load_balancing/oob_backend_metric.cc +4 -4
- data/src/core/load_balancing/oob_backend_metric_internal.h +2 -2
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +2 -2
- data/src/core/load_balancing/pick_first/pick_first.cc +14 -14
- data/src/core/load_balancing/priority/priority.cc +23 -24
- data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -3
- data/src/core/load_balancing/rls/rls.cc +13 -13
- data/src/core/load_balancing/round_robin/round_robin.cc +9 -9
- data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +3 -3
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -26
- data/src/core/load_balancing/weighted_target/weighted_target.cc +5 -5
- data/src/core/load_balancing/xds/cds.cc +76 -32
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +3 -3
- data/src/core/load_balancing/xds/xds_override_host.cc +4 -4
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +33 -33
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +10 -10
- data/src/core/resolver/dns/dns_resolver_plugin.cc +6 -3
- data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +2 -2
- data/src/core/resolver/endpoint_addresses.cc +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/fake/fake_resolver.cc +2 -2
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +41 -54
- data/src/core/resolver/polling_resolver.cc +3 -3
- data/src/core/resolver/resolver_registry.cc +5 -4
- data/src/core/resolver/xds/xds_dependency_manager.cc +5 -5
- data/src/core/resolver/xds/xds_resolver.cc +9 -9
- data/src/core/server/server.cc +38 -38
- data/src/core/server/server_call_tracer_filter.h +4 -4
- data/src/core/server/server_config_selector_filter.cc +2 -2
- data/src/core/server/xds_server_config_fetcher.cc +9 -8
- data/src/core/service_config/service_config_impl.h +2 -2
- data/src/core/telemetry/call_tracer.cc +39 -49
- data/src/core/telemetry/call_tracer.h +199 -22
- data/src/core/telemetry/histogram.h +205 -0
- data/src/core/telemetry/instrument.cc +719 -0
- data/src/core/telemetry/instrument.h +932 -0
- data/src/core/telemetry/metrics.cc +13 -5
- data/src/core/telemetry/metrics.h +3 -1
- data/src/core/telemetry/stats_data.cc +0 -19
- data/src/core/telemetry/stats_data.h +0 -19
- data/src/core/transport/auth_context.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +78 -45
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -0
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +39 -31
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +7 -7
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +3 -3
- data/src/core/tsi/fake_transport_security.cc +4 -4
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +9 -9
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +3 -3
- data/src/core/tsi/ssl_transport_security.cc +26 -25
- data/src/core/tsi/ssl_transport_security_utils.cc +9 -9
- data/src/core/util/chunked_vector.h +4 -4
- data/src/core/util/event_log.cc +2 -2
- data/src/core/util/gcp_metadata_query.cc +2 -2
- data/src/core/util/grpc_check.cc +22 -0
- data/src/core/util/grpc_check.h +103 -0
- data/src/core/util/http_client/httpcli.cc +3 -3
- data/src/core/util/http_client/parser.cc +4 -4
- data/src/core/util/latent_see.h +7 -4
- data/src/core/util/lru_cache.h +4 -4
- data/src/core/util/memory_usage.h +16 -0
- data/src/core/util/posix/directory_reader.cc +3 -2
- data/src/core/util/posix/sync.cc +24 -24
- data/src/core/util/postmortem_emit.cc +52 -0
- data/src/core/util/postmortem_emit.h +30 -0
- data/src/core/util/ref_counted_ptr.h +5 -0
- data/src/core/util/trie_lookup.h +170 -0
- data/src/core/util/unique_ptr_with_bitset.h +5 -5
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +6 -1
- data/src/core/xds/grpc/xds_certificate_provider.cc +3 -3
- data/src/core/xds/grpc/xds_client_grpc.cc +34 -15
- data/src/core/xds/grpc/xds_client_grpc.h +4 -1
- data/src/core/xds/grpc/xds_cluster_parser.cc +2 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
- data/src/core/xds/grpc/xds_endpoint_parser.cc +2 -2
- data/src/core/xds/grpc/xds_http_filter_registry.cc +4 -3
- data/src/core/xds/grpc/xds_listener_parser.cc +3 -3
- data/src/core/xds/grpc/xds_matcher.cc +277 -0
- data/src/core/xds/grpc/xds_matcher.h +432 -0
- data/src/core/xds/grpc/xds_matcher_action.cc +47 -0
- data/src/core/xds/grpc/xds_matcher_action.h +48 -0
- data/src/core/xds/grpc/xds_matcher_context.cc +29 -0
- data/src/core/xds/grpc/xds_matcher_context.h +46 -0
- data/src/core/xds/grpc/xds_matcher_input.cc +79 -0
- data/src/core/xds/grpc/xds_matcher_input.h +105 -0
- data/src/core/xds/grpc/xds_matcher_parse.cc +356 -0
- data/src/core/xds/grpc/xds_matcher_parse.h +39 -0
- data/src/core/xds/grpc/xds_metadata.cc +4 -3
- data/src/core/xds/grpc/xds_route_config_parser.cc +6 -6
- data/src/core/xds/grpc/xds_routing.cc +3 -3
- data/src/core/xds/grpc/xds_transport_grpc.cc +10 -10
- data/src/core/xds/xds_client/lrs_client.cc +6 -6
- data/src/core/xds/xds_client/xds_client.cc +9 -9
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/abseil-cpp/absl/container/internal/node_slot_policy.h +95 -0
- data/third_party/abseil-cpp/absl/container/node_hash_map.h +687 -0
- metadata +37 -2
@@ -19,26 +19,33 @@
|
|
19
19
|
#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_CLIENT_TRANSPORT_H
|
20
20
|
#define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_CLIENT_TRANSPORT_H
|
21
21
|
|
22
|
+
#include <grpc/support/port_platform.h>
|
23
|
+
|
22
24
|
#include <cstdint>
|
23
25
|
#include <utility>
|
24
26
|
|
25
27
|
#include "src/core/call/call_spine.h"
|
28
|
+
#include "src/core/ext/transport/chttp2/transport/flow_control.h"
|
29
|
+
#include "src/core/ext/transport/chttp2/transport/flow_control_manager.h"
|
26
30
|
#include "src/core/ext/transport/chttp2/transport/frame.h"
|
27
31
|
#include "src/core/ext/transport/chttp2/transport/header_assembler.h"
|
28
32
|
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
|
29
33
|
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
|
30
34
|
#include "src/core/ext/transport/chttp2/transport/http2_settings_manager.h"
|
35
|
+
#include "src/core/ext/transport/chttp2/transport/http2_settings_promises.h"
|
31
36
|
#include "src/core/ext/transport/chttp2/transport/http2_status.h"
|
32
37
|
#include "src/core/ext/transport/chttp2/transport/http2_transport.h"
|
38
|
+
#include "src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h"
|
33
39
|
#include "src/core/ext/transport/chttp2/transport/keepalive.h"
|
34
40
|
#include "src/core/ext/transport/chttp2/transport/message_assembler.h"
|
35
41
|
#include "src/core/ext/transport/chttp2/transport/ping_promise.h"
|
36
|
-
#include "src/core/ext/transport/chttp2/transport/
|
42
|
+
#include "src/core/ext/transport/chttp2/transport/stream.h"
|
37
43
|
#include "src/core/ext/transport/chttp2/transport/writable_streams.h"
|
38
44
|
#include "src/core/lib/promise/inter_activity_mutex.h"
|
39
45
|
#include "src/core/lib/promise/loop.h"
|
40
46
|
#include "src/core/lib/promise/mpsc.h"
|
41
47
|
#include "src/core/lib/promise/party.h"
|
48
|
+
#include "src/core/lib/resource_quota/memory_quota.h"
|
42
49
|
#include "src/core/lib/transport/connectivity_state.h"
|
43
50
|
#include "src/core/lib/transport/promise_endpoint.h"
|
44
51
|
#include "src/core/lib/transport/transport.h"
|
@@ -84,7 +91,8 @@ namespace http2 {
|
|
84
91
|
// familiar with the PH2 project (Moving chttp2 to promises.)
|
85
92
|
// TODO(tjagtap) : [PH2][P3] : Update the experimental status of the code before
|
86
93
|
// http2 rollout begins.
|
87
|
-
class Http2ClientTransport final : public ClientTransport
|
94
|
+
class Http2ClientTransport final : public ClientTransport,
|
95
|
+
public channelz::DataSource {
|
88
96
|
// TODO(tjagtap) : [PH2][P3] Move the definitions to the header for better
|
89
97
|
// inlining. For now definitions are in the cc file to
|
90
98
|
// reduce cognitive load in the header.
|
@@ -124,21 +132,20 @@ class Http2ClientTransport final : public ClientTransport {
|
|
124
132
|
void AbortWithError();
|
125
133
|
|
126
134
|
RefCountedPtr<channelz::SocketNode> GetSocketNode() const override {
|
135
|
+
return const_cast<channelz::BaseNode*>(
|
136
|
+
channelz::DataSource::channelz_node())
|
137
|
+
->RefAsSubclass<channelz::SocketNode>();
|
138
|
+
}
|
139
|
+
|
140
|
+
std::unique_ptr<channelz::ZTrace> GetZTrace(absl::string_view name) override {
|
141
|
+
if (name == "transport_frames") return ztrace_collector_->MakeZTrace();
|
127
142
|
return nullptr;
|
128
143
|
}
|
129
144
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
return
|
134
|
-
outgoing_frames_.MakeSender().Send(std::move(frame), 1),
|
135
|
-
[](StatusFlag status) {
|
136
|
-
GRPC_HTTP2_CLIENT_DLOG
|
137
|
-
<< "Http2ClientTransport::TestOnlyEnqueueOutgoingFrame status="
|
138
|
-
<< status;
|
139
|
-
return (status.ok()) ? absl::OkStatus()
|
140
|
-
: absl::InternalError("Failed to enqueue frame");
|
141
|
-
}));
|
145
|
+
void AddData(channelz::DataSink sink) override;
|
146
|
+
|
147
|
+
auto TestOnlyTriggerWriteCycle() {
|
148
|
+
return Immediate(writable_stream_list_.ForceReadyForWrite());
|
142
149
|
}
|
143
150
|
|
144
151
|
auto TestOnlySendPing(absl::AnyInvocable<void()> on_initiate,
|
@@ -151,6 +158,22 @@ class Http2ClientTransport final : public ClientTransport {
|
|
151
158
|
return general_party_->Spawn(name, std::move(factory), [](auto) {});
|
152
159
|
}
|
153
160
|
|
161
|
+
int64_t TestOnlyTransportFlowControlWindow() {
|
162
|
+
return flow_control_.remote_window();
|
163
|
+
}
|
164
|
+
|
165
|
+
int64_t TestOnlyGetStreamFlowControlWindow(const uint32_t stream_id) {
|
166
|
+
RefCountedPtr<Stream> stream = LookupStream(stream_id);
|
167
|
+
if (stream == nullptr) {
|
168
|
+
return -1;
|
169
|
+
}
|
170
|
+
return stream->flow_control.remote_window_delta();
|
171
|
+
}
|
172
|
+
|
173
|
+
bool AreTransportFlowControlTokensAvailable() {
|
174
|
+
return flow_control_.remote_window() > 0;
|
175
|
+
}
|
176
|
+
|
154
177
|
private:
|
155
178
|
// Promise factory for processing each type of frame
|
156
179
|
Http2Status ProcessHttp2DataFrame(Http2DataFrame frame);
|
@@ -162,10 +185,7 @@ class Http2ClientTransport final : public ClientTransport {
|
|
162
185
|
Http2Status ProcessHttp2WindowUpdateFrame(Http2WindowUpdateFrame frame);
|
163
186
|
Http2Status ProcessHttp2ContinuationFrame(Http2ContinuationFrame frame);
|
164
187
|
Http2Status ProcessHttp2SecurityFrame(Http2SecurityFrame frame);
|
165
|
-
Http2Status ProcessMetadata(
|
166
|
-
CallHandler& call,
|
167
|
-
bool& did_push_initial_metadata,
|
168
|
-
bool& did_push_trailing_metadata);
|
188
|
+
Http2Status ProcessMetadata(RefCountedPtr<Stream> stream);
|
169
189
|
|
170
190
|
// Reading from the endpoint.
|
171
191
|
|
@@ -184,195 +204,56 @@ class Http2ClientTransport final : public ClientTransport {
|
|
184
204
|
|
185
205
|
// Writing to the endpoint.
|
186
206
|
|
187
|
-
//
|
188
|
-
|
189
|
-
|
190
|
-
//
|
191
|
-
//
|
192
|
-
|
193
|
-
|
194
|
-
//
|
195
|
-
|
196
|
-
|
197
|
-
//
|
198
|
-
//
|
199
|
-
//
|
200
|
-
|
201
|
-
|
202
|
-
|
207
|
+
// Write time sensitive control frames to the endpoint. Frames sent from here
|
208
|
+
// will be:
|
209
|
+
// 1. SETTINGS - This is first because for a new connection, SETTINGS MUST be
|
210
|
+
// the first frame to be written onto a connection as per
|
211
|
+
// RFC9113.
|
212
|
+
// 2. GOAWAY - This is second because if this is the final GoAway, then we may
|
213
|
+
// not need to send anything else to the peer.
|
214
|
+
// 3. PING and PING acks.
|
215
|
+
// 4. WINDOW_UPDATE
|
216
|
+
// 5. Custom gRPC security frame
|
217
|
+
// These frames are written to the endpoint in a single endpoint write. If any
|
218
|
+
// module needs to take action after the write (for cases like spawning
|
219
|
+
// timeout promises), they MUST plug the call in the
|
220
|
+
// NotifyControlFramesWriteDone.
|
221
|
+
auto WriteControlFrames();
|
222
|
+
|
223
|
+
// Notify the control frames modules that the endpoint write is done.
|
224
|
+
void NotifyControlFramesWriteDone();
|
225
|
+
|
226
|
+
// Returns a promise to keep draining control frames and data frames from all
|
227
|
+
// the writable streams and write to the endpoint.
|
228
|
+
auto MultiplexerLoop();
|
229
|
+
|
230
|
+
// Returns a promise that will do the cleanup after the MultiplexerLoop
|
203
231
|
// ends.
|
204
|
-
auto
|
232
|
+
auto OnMultiplexerLoopEnded();
|
205
233
|
|
206
234
|
// Returns a promise to fetch data from the callhandler and pass it further
|
207
235
|
// down towards the endpoint.
|
208
|
-
auto CallOutboundLoop(CallHandler call_handler,
|
236
|
+
auto CallOutboundLoop(CallHandler call_handler, RefCountedPtr<Stream> stream,
|
209
237
|
InterActivityMutex<uint32_t>::Lock lock,
|
210
238
|
ClientMetadataHandle metadata);
|
211
239
|
|
212
|
-
//
|
213
|
-
auto
|
214
|
-
|
215
|
-
// and using that always would be more efficient.
|
216
|
-
return AssertResultType<absl::Status>(Map(
|
217
|
-
outgoing_frames_.MakeSender().Send(std::move(frame), 1),
|
218
|
-
[self = RefAsSubclass<Http2ClientTransport>()](StatusFlag status) {
|
219
|
-
GRPC_HTTP2_CLIENT_DLOG
|
220
|
-
<< "Http2ClientTransport::EnqueueOutgoingFrame status=" << status;
|
221
|
-
return (status.ok())
|
222
|
-
? absl::OkStatus()
|
223
|
-
: self->HandleError(Http2Status::AbslConnectionError(
|
224
|
-
absl::StatusCode::kInternal,
|
225
|
-
"Failed to enqueue frame"));
|
226
|
-
}));
|
240
|
+
// Force triggers a transport write cycle
|
241
|
+
auto TriggerWriteCycle() {
|
242
|
+
return Immediate(writable_stream_list_.ForceReadyForWrite());
|
227
243
|
}
|
228
244
|
|
229
|
-
//
|
230
|
-
|
245
|
+
// Processes the flow control action and take necessary steps.
|
246
|
+
void ActOnFlowControlAction(const chttp2::FlowControlAction& action,
|
247
|
+
uint32_t stream_id);
|
231
248
|
|
232
249
|
RefCountedPtr<Party> general_party_;
|
233
250
|
|
234
251
|
PromiseEndpoint endpoint_;
|
235
252
|
Http2SettingsManager settings_;
|
236
|
-
|
253
|
+
SettingsTimeoutManager transport_settings_;
|
237
254
|
|
238
255
|
Http2FrameHeader current_frame_header_;
|
239
256
|
|
240
|
-
// Managing the streams
|
241
|
-
struct Stream : public RefCounted<Stream> {
|
242
|
-
explicit Stream(CallHandler call, const uint32_t stream_id1)
|
243
|
-
: call(std::move(call)),
|
244
|
-
stream_state(HttpStreamState::kIdle),
|
245
|
-
stream_id(stream_id1),
|
246
|
-
header_assembler(stream_id1),
|
247
|
-
did_push_initial_metadata(false),
|
248
|
-
did_push_trailing_metadata(false),
|
249
|
-
data_queue(MakeRefCounted<StreamDataQueue<ClientMetadataHandle>>(
|
250
|
-
/*is_client*/ true, /*stream_id*/ stream_id1,
|
251
|
-
/*queue_size*/ kStreamQueueSize)) {}
|
252
|
-
|
253
|
-
////////////////////////////////////////////////////////////////////////////
|
254
|
-
// Data Queue Helpers
|
255
|
-
|
256
|
-
auto EnqueueInitialMetadata(ClientMetadataHandle&& metadata) {
|
257
|
-
GRPC_HTTP2_CLIENT_DLOG
|
258
|
-
<< "Http2ClientTransport::Stream::EnqueueInitialMetadata stream_id="
|
259
|
-
<< stream_id;
|
260
|
-
return data_queue->EnqueueInitialMetadata(std::move(metadata));
|
261
|
-
}
|
262
|
-
|
263
|
-
auto EnqueueTrailingMetadata(ClientMetadataHandle&& metadata) {
|
264
|
-
GRPC_HTTP2_CLIENT_DLOG
|
265
|
-
<< "Http2ClientTransport::Stream::EnqueueTrailingMetadata stream_id="
|
266
|
-
<< stream_id;
|
267
|
-
return data_queue->EnqueueTrailingMetadata(std::move(metadata));
|
268
|
-
}
|
269
|
-
|
270
|
-
auto EnqueueMessage(MessageHandle&& message) {
|
271
|
-
GRPC_HTTP2_CLIENT_DLOG
|
272
|
-
<< "Http2ClientTransport::Stream::EnqueueMessage stream_id="
|
273
|
-
<< stream_id
|
274
|
-
<< " with payload size = " << message->payload()->Length();
|
275
|
-
return data_queue->EnqueueMessage(std::move(message));
|
276
|
-
}
|
277
|
-
|
278
|
-
auto EnqueueHalfClosed() {
|
279
|
-
GRPC_HTTP2_CLIENT_DLOG
|
280
|
-
<< "Http2ClientTransport::Stream::EnqueueHalfClosed stream_id="
|
281
|
-
<< stream_id;
|
282
|
-
return data_queue->EnqueueHalfClosed();
|
283
|
-
}
|
284
|
-
|
285
|
-
auto EnqueueResetStream(const uint32_t error_code) {
|
286
|
-
GRPC_HTTP2_CLIENT_DLOG
|
287
|
-
<< "Http2ClientTransport::Stream::EnqueueResetStream stream_id="
|
288
|
-
<< stream_id << " with error_code = " << error_code;
|
289
|
-
return data_queue->EnqueueResetStream(error_code);
|
290
|
-
}
|
291
|
-
|
292
|
-
auto DequeueFrames(const uint32_t transport_tokens,
|
293
|
-
const uint32_t max_frame_length,
|
294
|
-
HPackCompressor& encoder) {
|
295
|
-
return data_queue->DequeueFrames(transport_tokens, max_frame_length,
|
296
|
-
encoder);
|
297
|
-
}
|
298
|
-
|
299
|
-
////////////////////////////////////////////////////////////////////////////
|
300
|
-
// Stream State Management
|
301
|
-
|
302
|
-
// Modify the stream state
|
303
|
-
// The possible stream transitions are as follows:
|
304
|
-
// kIdle -> kOpen
|
305
|
-
// kOpen -> kClosed/kHalfClosedLocal/kHalfClosedRemote
|
306
|
-
// kHalfClosedLocal/kHalfClosedRemote -> kClosed
|
307
|
-
// kClosed -> kClosed
|
308
|
-
void SentInitialMetadata() {
|
309
|
-
DCHECK(stream_state == HttpStreamState::kIdle);
|
310
|
-
stream_state = HttpStreamState::kOpen;
|
311
|
-
}
|
312
|
-
|
313
|
-
void MarkHalfClosedLocal() {
|
314
|
-
switch (stream_state) {
|
315
|
-
case HttpStreamState::kIdle:
|
316
|
-
DCHECK(false) << "MarkHalfClosedLocal called for an idle stream";
|
317
|
-
break;
|
318
|
-
case HttpStreamState::kOpen:
|
319
|
-
stream_state = HttpStreamState::kHalfClosedLocal;
|
320
|
-
break;
|
321
|
-
case HttpStreamState::kHalfClosedRemote:
|
322
|
-
stream_state = HttpStreamState::kClosed;
|
323
|
-
break;
|
324
|
-
case HttpStreamState::kHalfClosedLocal:
|
325
|
-
break;
|
326
|
-
case HttpStreamState::kClosed:
|
327
|
-
DCHECK(false) << "MarkHalfClosedLocal called for a closed stream";
|
328
|
-
break;
|
329
|
-
}
|
330
|
-
}
|
331
|
-
|
332
|
-
void MarkHalfClosedRemote() {
|
333
|
-
switch (stream_state) {
|
334
|
-
case HttpStreamState::kIdle:
|
335
|
-
DCHECK(false) << "MarkHalfClosedRemote called for an idle stream";
|
336
|
-
break;
|
337
|
-
case HttpStreamState::kOpen:
|
338
|
-
stream_state = HttpStreamState::kHalfClosedRemote;
|
339
|
-
break;
|
340
|
-
case HttpStreamState::kHalfClosedLocal:
|
341
|
-
stream_state = HttpStreamState::kClosed;
|
342
|
-
break;
|
343
|
-
case HttpStreamState::kHalfClosedRemote:
|
344
|
-
break;
|
345
|
-
case HttpStreamState::kClosed:
|
346
|
-
DCHECK(false) << "MarkHalfClosedRemote called for a closed stream";
|
347
|
-
break;
|
348
|
-
}
|
349
|
-
}
|
350
|
-
|
351
|
-
HttpStreamState GetStreamState() const { return stream_state; }
|
352
|
-
|
353
|
-
inline bool IsClosed() const {
|
354
|
-
return stream_state == HttpStreamState::kClosed;
|
355
|
-
}
|
356
|
-
|
357
|
-
CallHandler call;
|
358
|
-
// TODO(akshitpatel) : [PH2][P3] : Investigate if this needs to be atomic.
|
359
|
-
HttpStreamState stream_state;
|
360
|
-
const uint32_t stream_id;
|
361
|
-
GrpcMessageAssembler assembler;
|
362
|
-
HeaderAssembler header_assembler;
|
363
|
-
// TODO(akshitpatel) : [PH2][P2] : StreamQ should maintain a flag that
|
364
|
-
// tracks if the half close has been sent for this stream. This flag is used
|
365
|
-
// to notify the mixer that this stream is closed for
|
366
|
-
// writes(HalfClosedLocal). When the mixer dequeues the last message for
|
367
|
-
// the streamQ, it will mark the stream as closed for writes and send a
|
368
|
-
// frame with end_stream or set the end_stream flag in the last data
|
369
|
-
// frame being sent out. This is done as the stream state should not
|
370
|
-
// transition to HalfClosedLocal till the end_stream frame is sent.
|
371
|
-
bool did_push_initial_metadata;
|
372
|
-
bool did_push_trailing_metadata;
|
373
|
-
RefCountedPtr<StreamDataQueue<ClientMetadataHandle>> data_queue;
|
374
|
-
};
|
375
|
-
|
376
257
|
uint32_t NextStreamId(
|
377
258
|
InterActivityMutex<uint32_t>::Lock& next_stream_id_lock) {
|
378
259
|
const uint32_t stream_id = *next_stream_id_lock;
|
@@ -393,8 +274,6 @@ class Http2ClientTransport final : public ClientTransport {
|
|
393
274
|
return stream_id;
|
394
275
|
}
|
395
276
|
|
396
|
-
MpscReceiver<Http2Frame> outgoing_frames_;
|
397
|
-
|
398
277
|
Mutex transport_mutex_;
|
399
278
|
// TODO(tjagtap) : [PH2][P2] : Add to map in StartCall and clean this
|
400
279
|
// mapping up in the on_done of the CallInitiator or CallHandler
|
@@ -407,51 +286,87 @@ class Http2ClientTransport final : public ClientTransport {
|
|
407
286
|
HPackCompressor encoder_;
|
408
287
|
HPackParser parser_;
|
409
288
|
bool is_transport_closed_ ABSL_GUARDED_BY(transport_mutex_) = false;
|
289
|
+
Latch<void> transport_closed_latch_;
|
290
|
+
|
291
|
+
template <typename Promise>
|
292
|
+
auto UntilTransportClosed(Promise promise) {
|
293
|
+
return Race(Map(transport_closed_latch_.Wait(),
|
294
|
+
[](Empty) {
|
295
|
+
GRPC_HTTP2_CLIENT_DLOG << "Transport closed";
|
296
|
+
return absl::CancelledError("Transport closed");
|
297
|
+
}),
|
298
|
+
std::move(promise));
|
299
|
+
}
|
410
300
|
|
411
301
|
ConnectivityStateTracker state_tracker_ ABSL_GUARDED_BY(transport_mutex_){
|
412
302
|
"http2_client", GRPC_CHANNEL_READY};
|
413
303
|
|
414
|
-
|
304
|
+
std::optional<RefCountedPtr<Stream>> MakeStream(CallHandler call_handler,
|
305
|
+
uint32_t stream_id);
|
415
306
|
|
416
307
|
struct CloseStreamArgs {
|
417
308
|
bool close_reads;
|
418
309
|
bool close_writes;
|
419
|
-
bool send_rst_stream;
|
420
|
-
bool push_trailing_metadata;
|
421
310
|
};
|
422
311
|
|
423
312
|
// This function MUST be idempotent.
|
424
|
-
void CloseStream(
|
425
|
-
|
313
|
+
void CloseStream(RefCountedPtr<Stream> stream, CloseStreamArgs args,
|
314
|
+
DebugLocation whence = {});
|
315
|
+
|
316
|
+
void BeginCloseStream(uint32_t stream_id,
|
317
|
+
std::optional<uint32_t> reset_stream_error_code,
|
318
|
+
ServerMetadataHandle&& metadata,
|
319
|
+
DebugLocation whence = {});
|
426
320
|
|
427
|
-
RefCountedPtr<
|
321
|
+
RefCountedPtr<Stream> LookupStream(uint32_t stream_id);
|
428
322
|
|
429
323
|
auto EndpointReadSlice(const size_t num_bytes) {
|
430
324
|
return Map(endpoint_.ReadSlice(num_bytes),
|
431
|
-
[self = RefAsSubclass<Http2ClientTransport>()
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
// success cases which would be way more common.
|
439
|
-
self->keepalive_manager_.GotData();
|
325
|
+
[self = RefAsSubclass<Http2ClientTransport>(),
|
326
|
+
num_bytes](absl::StatusOr<Slice> status) {
|
327
|
+
if (status.ok()) {
|
328
|
+
self->keepalive_manager_.GotData();
|
329
|
+
self->ztrace_collector_->Append(
|
330
|
+
PromiseEndpointReadTrace{num_bytes});
|
331
|
+
}
|
440
332
|
return status;
|
441
333
|
});
|
442
334
|
}
|
443
335
|
|
336
|
+
// HTTP2 Settings
|
337
|
+
void MarkPeerSettingsResolved() {
|
338
|
+
settings_.SetPreviousSettingsPromiseResolved(true);
|
339
|
+
}
|
340
|
+
auto WaitForSettingsTimeoutDone() {
|
341
|
+
return [self = RefAsSubclass<Http2ClientTransport>()](absl::Status status) {
|
342
|
+
if (!status.ok()) {
|
343
|
+
GRPC_UNUSED absl::Status result = self->HandleError(
|
344
|
+
std::nullopt, Http2Status::Http2ConnectionError(
|
345
|
+
Http2ErrorCode::kProtocolError,
|
346
|
+
std::string(RFC9113::kSettingsTimeout)));
|
347
|
+
} else {
|
348
|
+
self->MarkPeerSettingsResolved();
|
349
|
+
}
|
350
|
+
};
|
351
|
+
}
|
352
|
+
// TODO(tjagtap) : [PH2][P1] : Plumbing. Call this after the SETTINGS frame
|
353
|
+
// has been written to endpoint_.
|
354
|
+
void SpawnWaitForSettingsTimeout() {
|
355
|
+
settings_.SetPreviousSettingsPromiseResolved(false);
|
356
|
+
general_party_->Spawn("WaitForSettingsTimeout",
|
357
|
+
transport_settings_.WaitForSettingsTimeout(),
|
358
|
+
WaitForSettingsTimeoutDone());
|
359
|
+
}
|
360
|
+
|
444
361
|
auto EndpointRead(const size_t num_bytes) {
|
445
362
|
return Map(endpoint_.Read(num_bytes),
|
446
|
-
[self = RefAsSubclass<Http2ClientTransport>()
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
// success cases which would be way more common.
|
454
|
-
self->keepalive_manager_.GotData();
|
363
|
+
[self = RefAsSubclass<Http2ClientTransport>(),
|
364
|
+
num_bytes](absl::StatusOr<SliceBuffer> status) {
|
365
|
+
if (status.ok()) {
|
366
|
+
self->keepalive_manager_.GotData();
|
367
|
+
self->ztrace_collector_->Append(
|
368
|
+
PromiseEndpointReadTrace{num_bytes});
|
369
|
+
}
|
455
370
|
return status;
|
456
371
|
});
|
457
372
|
}
|
@@ -470,20 +385,18 @@ class Http2ClientTransport final : public ClientTransport {
|
|
470
385
|
// should not be cancelled in case of stream errors.
|
471
386
|
// If the error is a connection error, it closes the transport and returns the
|
472
387
|
// corresponding (failed) absl status.
|
473
|
-
absl::Status HandleError(
|
388
|
+
absl::Status HandleError(const std::optional<uint32_t> stream_id,
|
389
|
+
Http2Status status, DebugLocation whence = {}) {
|
474
390
|
auto error_type = status.GetType();
|
475
391
|
DCHECK(error_type != Http2Status::Http2ErrorType::kOk);
|
476
392
|
|
477
393
|
if (error_type == Http2Status::Http2ErrorType::kStreamError) {
|
478
394
|
LOG(ERROR) << "Stream Error: " << status.DebugString();
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
/*push_trailing_metadata=*/true,
|
485
|
-
},
|
486
|
-
whence);
|
395
|
+
DCHECK(stream_id.has_value());
|
396
|
+
BeginCloseStream(
|
397
|
+
*stream_id,
|
398
|
+
Http2ErrorCodeToRstFrameErrorCode(status.GetStreamErrorCode()),
|
399
|
+
ServerMetadataFromStatus(status.GetAbslStreamError()), whence);
|
487
400
|
return absl::OkStatus();
|
488
401
|
} else if (error_type == Http2Status::Http2ErrorType::kConnectionError) {
|
489
402
|
LOG(ERROR) << "Connection Error: " << status.DebugString();
|
@@ -494,7 +407,7 @@ class Http2ClientTransport final : public ClientTransport {
|
|
494
407
|
GPR_UNREACHABLE_CODE(return absl::InternalError("Invalid error type"));
|
495
408
|
}
|
496
409
|
|
497
|
-
bool
|
410
|
+
bool should_reset_ping_clock_;
|
498
411
|
bool incoming_header_in_progress_;
|
499
412
|
bool incoming_header_end_stream_;
|
500
413
|
bool is_first_write_;
|
@@ -503,6 +416,27 @@ class Http2ClientTransport final : public ClientTransport {
|
|
503
416
|
|
504
417
|
uint32_t max_header_list_size_soft_limit_;
|
505
418
|
|
419
|
+
// The target number of bytes to write in a single write cycle. We may not
|
420
|
+
// always honour this max_write_size. We MAY overshoot it at most once per
|
421
|
+
// write cycle.
|
422
|
+
size_t max_write_size_;
|
423
|
+
// The number of bytes remaining to be written in the current write cycle.
|
424
|
+
size_t write_bytes_remaining_;
|
425
|
+
|
426
|
+
// The max_write_size will be decided dynamically based on the available
|
427
|
+
// bandwidth on the wire. We aim to keep the time spent in the write loop to
|
428
|
+
// about 100ms.
|
429
|
+
void SetMaxWriteSize(const size_t max_write_size) {
|
430
|
+
GRPC_HTTP2_CLIENT_DLOG << "Http2ClientTransport SetMaxWriteSize "
|
431
|
+
<< " max_write_size changed: " << max_write_size_
|
432
|
+
<< " -> " << max_write_size;
|
433
|
+
max_write_size_ = max_write_size;
|
434
|
+
}
|
435
|
+
|
436
|
+
size_t GetMaxWriteSize() const { return max_write_size_; }
|
437
|
+
|
438
|
+
auto SerializeAndWrite(std::vector<Http2Frame>&& frames);
|
439
|
+
|
506
440
|
// Ping related members
|
507
441
|
// TODO(akshitpatel) : [PH2][P2] : Consider removing the timeout related
|
508
442
|
// members.
|
@@ -514,7 +448,6 @@ class Http2ClientTransport final : public ClientTransport {
|
|
514
448
|
// Duration to wait for ping ack before triggering timeout
|
515
449
|
const Duration ping_timeout_;
|
516
450
|
PingManager ping_manager_;
|
517
|
-
std::vector<uint64_t> pending_ping_acks_;
|
518
451
|
KeepaliveManager keepalive_manager_;
|
519
452
|
|
520
453
|
// Flags
|
@@ -525,16 +458,14 @@ class Http2ClientTransport final : public ClientTransport {
|
|
525
458
|
}
|
526
459
|
auto WaitForPingAck() { return ping_manager_.WaitForPingAck(); }
|
527
460
|
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
SliceBuffer output_buf;
|
534
|
-
Serialize(absl::Span<Http2Frame>(&frame, 1), output_buf);
|
535
|
-
return endpoint_.Write(std::move(output_buf), {});
|
461
|
+
void MaybeGetSettingsFrame(SliceBuffer& output_buf) {
|
462
|
+
std::optional<Http2Frame> settings_frame = settings_.MaybeSendUpdate();
|
463
|
+
if (settings_frame.has_value()) {
|
464
|
+
Serialize(absl::Span<Http2Frame>(&settings_frame.value(), 1), output_buf);
|
465
|
+
}
|
536
466
|
}
|
537
467
|
|
468
|
+
// Ping Helper functions
|
538
469
|
Duration NextAllowedPingInterval() {
|
539
470
|
MutexLock lock(&transport_mutex_);
|
540
471
|
return (!keepalive_permit_without_calls_ && stream_list_.empty())
|
@@ -542,27 +473,6 @@ class Http2ClientTransport final : public ClientTransport {
|
|
542
473
|
: Duration::Seconds(1);
|
543
474
|
}
|
544
475
|
|
545
|
-
auto MaybeSendPing() {
|
546
|
-
return ping_manager_.MaybeSendPing(NextAllowedPingInterval(),
|
547
|
-
ping_timeout_);
|
548
|
-
}
|
549
|
-
|
550
|
-
auto MaybeSendPingAcks() {
|
551
|
-
return AssertResultType<absl::Status>(If(
|
552
|
-
pending_ping_acks_.empty(), [] { return absl::OkStatus(); },
|
553
|
-
[this] {
|
554
|
-
std::vector<Http2Frame> frames;
|
555
|
-
frames.reserve(pending_ping_acks_.size());
|
556
|
-
for (auto& opaque_data : pending_ping_acks_) {
|
557
|
-
frames.emplace_back(Http2PingFrame{true, opaque_data});
|
558
|
-
}
|
559
|
-
pending_ping_acks_.clear();
|
560
|
-
SliceBuffer output_buf;
|
561
|
-
Serialize(absl::Span<Http2Frame>(frames), output_buf);
|
562
|
-
return endpoint_.Write(std::move(output_buf), {});
|
563
|
-
}));
|
564
|
-
}
|
565
|
-
|
566
476
|
auto AckPing(uint64_t opaque_data) {
|
567
477
|
bool valid_ping_ack_received = true;
|
568
478
|
|
@@ -598,12 +508,6 @@ class Http2ClientTransport final : public ClientTransport {
|
|
598
508
|
PingSystemInterfaceImpl(transport));
|
599
509
|
}
|
600
510
|
|
601
|
-
// Returns a promise that resolves once a ping frame is written to the
|
602
|
-
// endpoint.
|
603
|
-
Promise<absl::Status> SendPing(SendPingArgs args) override {
|
604
|
-
return transport_->CreateAndWritePing(args.ack, args.opaque_data);
|
605
|
-
}
|
606
|
-
|
607
511
|
Promise<absl::Status> TriggerWrite() override {
|
608
512
|
return transport_->TriggerWriteCycle();
|
609
513
|
}
|
@@ -618,9 +522,9 @@ class Http2ClientTransport final : public ClientTransport {
|
|
618
522
|
// to kRefusedStream). However looking at RFC9113, definition of
|
619
523
|
// kRefusedStream doesn't seem to fit this case. We should revisit this
|
620
524
|
// and update the error code.
|
621
|
-
return Immediate(
|
622
|
-
|
623
|
-
|
525
|
+
return Immediate(transport_->HandleError(
|
526
|
+
std::nullopt, Http2Status::Http2ConnectionError(
|
527
|
+
Http2ErrorCode::kRefusedStream, "Ping timeout")));
|
624
528
|
}
|
625
529
|
|
626
530
|
private:
|
@@ -658,9 +562,10 @@ class Http2ClientTransport final : public ClientTransport {
|
|
658
562
|
// to kRefusedStream). However looking at RFC9113, definition of
|
659
563
|
// kRefusedStream doesn't seem to fit this case. We should revisit this
|
660
564
|
// and update the error code.
|
661
|
-
return Immediate(
|
662
|
-
|
663
|
-
|
565
|
+
return Immediate(transport_->HandleError(
|
566
|
+
std::nullopt,
|
567
|
+
Http2Status::Http2ConnectionError(Http2ErrorCode::kRefusedStream,
|
568
|
+
"Keepalive timeout")));
|
664
569
|
}
|
665
570
|
|
666
571
|
bool NeedToSendKeepAlivePing() override {
|
@@ -680,24 +585,40 @@ class Http2ClientTransport final : public ClientTransport {
|
|
680
585
|
Http2ClientTransport* transport_;
|
681
586
|
};
|
682
587
|
|
683
|
-
WritableStreams writable_stream_list_;
|
588
|
+
WritableStreams<RefCountedPtr<Stream>> writable_stream_list_;
|
684
589
|
|
685
|
-
|
686
|
-
|
687
|
-
|
590
|
+
absl::Status MaybeAddStreamToWritableStreamList(
|
591
|
+
const RefCountedPtr<Stream> stream,
|
592
|
+
const StreamDataQueue<ClientMetadataHandle>::EnqueueResult result) {
|
593
|
+
if (result.became_writable) {
|
688
594
|
GRPC_HTTP2_CLIENT_DLOG
|
689
595
|
<< "Http2ClientTransport MaybeAddStreamToWritableStreamList "
|
690
596
|
" Stream id: "
|
691
|
-
<<
|
692
|
-
absl::Status status =
|
693
|
-
|
597
|
+
<< stream->GetStreamId() << " became writable";
|
598
|
+
absl::Status status =
|
599
|
+
writable_stream_list_.Enqueue(stream, result.priority);
|
694
600
|
if (!status.ok()) {
|
695
|
-
return HandleError(
|
696
|
-
|
601
|
+
return HandleError(
|
602
|
+
std::nullopt,
|
603
|
+
Http2Status::Http2ConnectionError(
|
604
|
+
Http2ErrorCode::kRefusedStream,
|
605
|
+
"Failed to enqueue stream to writable stream list"));
|
697
606
|
}
|
698
607
|
}
|
699
608
|
return absl::OkStatus();
|
700
609
|
}
|
610
|
+
bool SetOnDone(CallHandler call_handler, RefCountedPtr<Stream> stream);
|
611
|
+
absl::StatusOr<std::vector<Http2Frame>> DequeueStreamFrames(
|
612
|
+
RefCountedPtr<Stream> stream);
|
613
|
+
|
614
|
+
/// Based on channel args, preferred_rx_crypto_frame_sizes are advertised to
|
615
|
+
/// the peer
|
616
|
+
// TODO(tjagtap) : [PH2][P1] : Plumb this with the necessary frame size flow
|
617
|
+
// control workflow corresponding to grpc_chttp2_act_on_flowctl_action
|
618
|
+
GRPC_UNUSED bool enable_preferred_rx_crypto_frame_advertisement_;
|
619
|
+
MemoryOwner memory_owner_;
|
620
|
+
chttp2::TransportFlowControl flow_control_;
|
621
|
+
std::shared_ptr<PromiseHttp2ZTraceCollector> ztrace_collector_;
|
701
622
|
};
|
702
623
|
|
703
624
|
// Since the corresponding class in CHTTP2 is about 3.9KB, our goal is to
|