grpc 1.47.0 → 1.48.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +105 -47
- data/include/grpc/compression.h +1 -1
- data/include/grpc/event_engine/event_engine.h +20 -11
- data/include/grpc/event_engine/slice_buffer.h +8 -2
- data/include/grpc/grpc.h +3 -3
- data/include/grpc/impl/codegen/compression_types.h +2 -1
- data/include/grpc/impl/codegen/connectivity_state.h +2 -1
- data/include/grpc/impl/codegen/gpr_types.h +2 -1
- data/include/grpc/impl/codegen/grpc_types.h +2 -1
- data/include/grpc/impl/codegen/port_platform.h +6 -3
- data/src/core/ext/filters/census/grpc_context.cc +3 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +17 -5
- data/src/core/ext/filters/channel_idle/channel_idle_filter.h +16 -0
- data/src/core/ext/filters/channel_idle/idle_filter_state.h +2 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +2 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +51 -65
- data/src/core/ext/filters/client_channel/client_channel.h +19 -4
- data/src/core/ext/filters/client_channel/config_selector.h +1 -1
- data/src/core/ext/filters/client_channel/connector.h +1 -1
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +6 -4
- data/src/core/ext/filters/client_channel/dynamic_filters.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +73 -43
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +0 -1
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +33 -35
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +106 -112
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +91 -42
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +177 -138
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +4 -1
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +47 -44
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +118 -103
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +83 -78
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +57 -67
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +5 -7
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +13 -17
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy.h +0 -7
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +3 -5
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +0 -1
- data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +3 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +6 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +5 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +10 -5
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +12 -3
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +5 -5
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +3 -4
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +24 -15
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +3 -1
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +7 -7
- data/src/core/ext/filters/client_channel/retry_filter.cc +35 -36
- data/src/core/ext/filters/client_channel/retry_filter.h +1 -0
- data/src/core/ext/filters/client_channel/retry_service_config.cc +4 -4
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +2 -1
- data/src/core/ext/filters/client_channel/subchannel.cc +53 -50
- data/src/core/ext/filters/client_channel/subchannel.h +6 -22
- data/src/core/ext/filters/client_channel/subchannel_interface.h +10 -18
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +12 -97
- data/src/core/ext/filters/client_channel/subchannel_stream_client.h +5 -9
- data/src/core/ext/filters/deadline/deadline_filter.cc +12 -7
- data/src/core/ext/filters/deadline/deadline_filter.h +8 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +21 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -3
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +7 -4
- data/src/core/ext/filters/fault_injection/service_config_parser.h +17 -3
- data/src/core/ext/filters/http/client/http_client_filter.cc +16 -5
- data/src/core/ext/filters/http/client/http_client_filter.h +8 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +11 -10
- data/src/core/ext/filters/http/client_authority_filter.h +5 -2
- data/src/core/ext/filters/http/http_filters_plugin.cc +9 -1
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +64 -187
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +1 -2
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +42 -106
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +1 -0
- data/src/core/ext/filters/http/server/http_server_filter.cc +16 -9
- data/src/core/ext/filters/http/server/http_server_filter.h +6 -1
- data/src/core/ext/filters/message_size/message_size_filter.cc +25 -15
- data/src/core/ext/filters/message_size/message_size_filter.h +13 -0
- data/src/core/ext/filters/rbac/rbac_filter.cc +14 -3
- data/src/core/ext/filters/rbac/rbac_filter.h +8 -0
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +13 -2
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +14 -2
- data/src/core/ext/filters/server_config_selector/server_config_selector.cc +1 -0
- data/src/core/ext/filters/server_config_selector/server_config_selector.h +9 -0
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +22 -2
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.h +1 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +4 -4
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +15 -15
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +196 -476
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -1
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +141 -261
- data/src/core/ext/transport/chttp2/transport/flow_control.h +176 -289
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +57 -215
- data/src/core/ext/transport/chttp2/transport/frame_data.h +10 -36
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +0 -41
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +7 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +0 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +9 -111
- data/src/core/ext/transport/chttp2/transport/parsing.cc +51 -38
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +0 -4
- data/src/core/ext/transport/chttp2/transport/writing.cc +18 -21
- data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -1
- data/src/core/ext/transport/inproc/inproc_transport.cc +85 -81
- data/src/core/ext/transport/inproc/inproc_transport.h +3 -1
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +52 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +164 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.c +46 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h +94 -0
- data/src/core/ext/xds/certificate_provider_factory.h +6 -1
- data/src/core/ext/xds/certificate_provider_registry.cc +8 -8
- data/src/core/ext/xds/certificate_provider_registry.h +3 -1
- data/src/core/ext/xds/certificate_provider_store.cc +2 -0
- data/src/core/ext/xds/certificate_provider_store.h +9 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +9 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +8 -0
- data/src/core/ext/xds/upb_utils.h +1 -2
- data/src/core/ext/xds/xds_api.cc +16 -18
- data/src/core/ext/xds/xds_api.h +12 -5
- data/src/core/ext/xds/xds_bootstrap.cc +37 -24
- data/src/core/ext/xds/xds_bootstrap.h +9 -11
- data/src/core/ext/xds/xds_certificate_provider.cc +12 -3
- data/src/core/ext/xds/xds_certificate_provider.h +16 -1
- data/src/core/ext/xds/xds_channel_stack_modifier.cc +9 -0
- data/src/core/ext/xds/xds_channel_stack_modifier.h +5 -1
- data/src/core/ext/xds/xds_client.cc +71 -22
- data/src/core/ext/xds/xds_client.h +17 -3
- data/src/core/ext/xds/xds_client_stats.cc +3 -4
- data/src/core/ext/xds/xds_client_stats.h +4 -3
- data/src/core/ext/xds/xds_cluster.cc +21 -10
- data/src/core/ext/xds/xds_cluster.h +9 -1
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +16 -7
- data/src/core/ext/xds/xds_cluster_specifier_plugin.h +1 -8
- data/src/core/ext/xds/xds_common_types.cc +36 -22
- data/src/core/ext/xds/xds_common_types.h +12 -4
- data/src/core/ext/xds/xds_endpoint.cc +25 -15
- data/src/core/ext/xds/xds_endpoint.h +13 -5
- data/src/core/ext/xds/xds_http_fault_filter.cc +7 -5
- data/src/core/ext/xds/xds_http_fault_filter.h +3 -1
- data/src/core/ext/xds/xds_http_filters.cc +7 -0
- data/src/core/ext/xds/xds_http_filters.h +3 -3
- data/src/core/ext/xds/xds_http_rbac_filter.cc +16 -0
- data/src/core/ext/xds/xds_http_rbac_filter.h +7 -0
- data/src/core/ext/xds/xds_lb_policy_registry.cc +291 -0
- data/src/core/ext/xds/xds_lb_policy_registry.h +72 -0
- data/src/core/ext/xds/xds_listener.cc +51 -33
- data/src/core/ext/xds/xds_listener.h +10 -1
- data/src/core/ext/xds/xds_resource_type.h +3 -3
- data/src/core/ext/xds/xds_resource_type_impl.h +7 -3
- data/src/core/ext/xds/xds_route_config.cc +56 -28
- data/src/core/ext/xds/xds_route_config.h +11 -2
- data/src/core/ext/xds/xds_routing.cc +16 -0
- data/src/core/ext/xds/xds_routing.h +7 -2
- data/src/core/ext/xds/xds_server_config_fetcher.cc +54 -6
- data/src/core/lib/address_utils/parse_address.cc +5 -8
- data/src/core/lib/address_utils/parse_address.h +3 -2
- data/src/core/lib/address_utils/sockaddr_utils.cc +8 -7
- data/src/core/lib/address_utils/sockaddr_utils.h +2 -0
- data/src/core/lib/avl/avl.h +3 -3
- data/src/core/lib/backoff/backoff.cc +1 -1
- data/src/core/lib/backoff/backoff.h +1 -1
- data/src/core/lib/channel/call_tracer.h +3 -3
- data/src/core/lib/channel/channel_args.h +1 -0
- data/src/core/lib/channel/channel_args_preconditioning.cc +1 -0
- data/src/core/lib/channel/channel_fwd.h +26 -0
- data/src/core/lib/channel/channel_stack.cc +4 -4
- data/src/core/lib/channel/channel_stack.h +1 -11
- data/src/core/lib/channel/channel_stack_builder.h +2 -5
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -1
- data/src/core/lib/channel/channel_stack_builder_impl.h +1 -0
- data/src/core/lib/channel/channelz.cc +2 -1
- data/src/core/lib/channel/channelz.h +2 -3
- data/src/core/lib/channel/channelz_registry.cc +4 -5
- data/src/core/lib/channel/connected_channel.cc +1 -0
- data/src/core/lib/channel/connected_channel.h +1 -0
- data/src/core/lib/channel/promise_based_filter.cc +11 -5
- data/src/core/lib/channel/promise_based_filter.h +2 -0
- data/src/core/lib/compression/compression.cc +6 -1
- data/src/core/lib/compression/compression_internal.cc +3 -6
- data/src/core/lib/compression/compression_internal.h +3 -2
- data/src/core/lib/compression/message_compress.cc +3 -1
- data/src/core/lib/compression/message_compress.h +2 -3
- data/src/core/lib/debug/stats.cc +9 -9
- data/src/core/lib/debug/stats.h +2 -1
- data/src/core/lib/debug/stats_data.cc +2 -1
- data/src/core/lib/debug/stats_data.h +0 -4
- data/src/core/lib/debug/trace.h +13 -12
- data/src/core/lib/event_engine/default_event_engine_factory.cc +1 -1
- data/src/core/lib/event_engine/event_engine.cc +24 -19
- data/src/core/lib/event_engine/event_engine_factory.h +2 -2
- data/src/core/lib/event_engine/{iomgr_engine.cc → iomgr_engine/iomgr_engine.cc} +44 -91
- data/src/core/lib/event_engine/{iomgr_engine.h → iomgr_engine/iomgr_engine.h} +20 -16
- data/src/core/lib/event_engine/iomgr_engine/thread_pool.cc +123 -0
- data/src/core/lib/event_engine/iomgr_engine/thread_pool.h +70 -0
- data/src/core/lib/event_engine/iomgr_engine/time_averaged_stats.cc +62 -0
- data/src/core/lib/event_engine/iomgr_engine/time_averaged_stats.h +81 -0
- data/src/core/lib/event_engine/iomgr_engine/timer.cc +312 -0
- data/src/core/lib/event_engine/iomgr_engine/timer.h +193 -0
- data/src/core/lib/event_engine/iomgr_engine/timer_heap.cc +107 -0
- data/src/core/lib/event_engine/iomgr_engine/timer_heap.h +56 -0
- data/src/core/lib/event_engine/iomgr_engine/timer_manager.cc +254 -0
- data/src/core/lib/event_engine/iomgr_engine/timer_manager.h +111 -0
- data/src/core/lib/event_engine/promise.h +69 -0
- data/src/core/lib/gpr/time_posix.cc +6 -9
- data/src/core/lib/gpr/time_windows.cc +10 -7
- data/src/core/lib/gprpp/manual_constructor.h +0 -67
- data/src/core/lib/gprpp/status_helper.cc +44 -30
- data/src/core/lib/gprpp/time.cc +8 -0
- data/src/core/lib/gprpp/time.h +4 -0
- data/src/core/lib/http/format_request.cc +5 -4
- data/src/core/lib/http/format_request.h +1 -1
- data/src/core/lib/http/httpcli.cc +18 -12
- data/src/core/lib/http/httpcli.h +19 -3
- data/src/core/lib/http/httpcli_security_connector.cc +16 -4
- data/src/core/lib/http/httpcli_ssl_credentials.h +3 -1
- data/src/core/lib/http/parser.cc +6 -7
- data/src/core/lib/http/parser.h +3 -0
- data/src/core/lib/iomgr/call_combiner.cc +2 -2
- data/src/core/lib/iomgr/endpoint.h +1 -1
- data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -2
- data/src/core/lib/iomgr/error.cc +11 -9
- data/src/core/lib/iomgr/error.h +9 -5
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +57 -18
- data/src/core/lib/iomgr/ev_epoll1_linux.h +1 -1
- data/src/core/lib/iomgr/ev_poll_posix.cc +77 -52
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
- data/src/core/lib/iomgr/ev_posix.cc +54 -92
- data/src/core/lib/iomgr/ev_posix.h +5 -3
- data/src/core/lib/iomgr/fork_posix.cc +1 -1
- data/src/core/lib/iomgr/iomgr.cc +7 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +1 -0
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +1 -0
- data/src/core/lib/iomgr/load_file.cc +1 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +1 -1
- data/src/core/lib/iomgr/resolve_address_windows.cc +1 -1
- data/src/core/lib/iomgr/tcp_client.cc +12 -7
- data/src/core/lib/iomgr/tcp_client.h +24 -13
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +15 -9
- data/src/core/lib/iomgr/tcp_client_posix.cc +143 -25
- data/src/core/lib/iomgr/tcp_client_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_client_windows.cc +14 -10
- data/src/core/lib/iomgr/tcp_posix.cc +91 -29
- data/src/core/lib/iomgr/tcp_server_posix.cc +7 -7
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +12 -12
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +2 -2
- data/src/core/lib/iomgr/tcp_server_windows.cc +7 -7
- data/src/core/lib/iomgr/tcp_windows.cc +5 -5
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -2
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -2
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +15 -12
- data/src/core/lib/iomgr/wakeup_fd_posix.h +0 -2
- data/src/core/lib/iomgr/work_serializer.h +2 -3
- data/src/core/lib/matchers/matchers.cc +6 -3
- data/src/core/lib/matchers/matchers.h +2 -0
- data/src/core/lib/promise/activity.cc +0 -1
- data/src/core/lib/promise/activity.h +7 -13
- data/src/core/lib/promise/loop.h +1 -0
- data/src/core/lib/promise/promise.h +1 -0
- data/src/core/lib/promise/sleep.cc +36 -31
- data/src/core/lib/promise/sleep.h +25 -25
- data/src/core/lib/resolver/resolver.cc +5 -0
- data/src/core/lib/resolver/resolver.h +3 -0
- data/src/core/lib/resolver/resolver_factory.h +5 -2
- data/src/core/lib/resolver/resolver_registry.cc +2 -9
- data/src/core/lib/resolver/resolver_registry.h +12 -1
- data/src/core/lib/resolver/server_address.cc +8 -0
- data/src/core/lib/resolver/server_address.h +9 -2
- data/src/core/lib/resource_quota/memory_quota.cc +18 -60
- data/src/core/lib/resource_quota/memory_quota.h +11 -25
- data/src/core/lib/security/authorization/authorization_policy_provider.h +7 -0
- data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +4 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +9 -3
- data/src/core/lib/security/authorization/evaluate_args.h +6 -3
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +6 -0
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +7 -0
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +12 -0
- data/src/core/lib/security/authorization/grpc_server_authz_filter.h +12 -1
- data/src/core/lib/security/authorization/matchers.cc +9 -1
- data/src/core/lib/security/authorization/matchers.h +7 -0
- data/src/core/lib/security/authorization/rbac_policy.cc +5 -0
- data/src/core/lib/security/authorization/rbac_policy.h +7 -0
- data/src/core/lib/security/context/security_context.cc +5 -2
- data/src/core/lib/security/context/security_context.h +14 -2
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +4 -2
- data/src/core/lib/security/credentials/alts/alts_credentials.h +6 -1
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +1 -3
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +1 -4
- data/src/core/lib/security/credentials/call_creds_util.cc +8 -0
- data/src/core/lib/security/credentials/call_creds_util.h +1 -0
- data/src/core/lib/security/credentials/channel_creds_registry.h +6 -1
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +10 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +4 -4
- data/src/core/lib/security/credentials/composite/composite_credentials.h +16 -2
- data/src/core/lib/security/credentials/credentials.cc +4 -8
- data/src/core/lib/security/credentials/credentials.h +10 -8
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +28 -10
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +10 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +9 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +24 -9
- data/src/core/lib/security/credentials/external/external_account_credentials.h +11 -0
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +12 -4
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +6 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +20 -4
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +10 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +8 -6
- data/src/core/lib/security/credentials/fake/fake_credentials.h +13 -1
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +1 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +27 -10
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +10 -1
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +9 -3
- data/src/core/lib/security/credentials/iam/iam_credentials.h +10 -0
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +4 -0
- data/src/core/lib/security/credentials/insecure/insecure_credentials.h +5 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +5 -2
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -2
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +11 -5
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +14 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +28 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +4 -2
- data/src/core/lib/security/credentials/local/local_credentials.cc +4 -3
- data/src/core/lib/security/credentials/local/local_credentials.h +7 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +26 -13
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +20 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +8 -7
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +24 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +5 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +13 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +6 -6
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +9 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +29 -10
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +9 -4
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +9 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +6 -7
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +4 -5
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +7 -2
- data/src/core/lib/security/credentials/tls/tls_credentials.h +5 -1
- data/src/core/lib/security/credentials/tls/tls_utils.cc +2 -0
- data/src/core/lib/security/credentials/tls/tls_utils.h +1 -1
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +8 -1
- data/src/core/lib/security/credentials/xds/xds_credentials.h +14 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +22 -2
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +6 -3
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +17 -1
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +2 -2
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +9 -0
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +17 -2
- data/src/core/lib/security/security_connector/load_system_roots_fallback.cc +5 -3
- data/src/core/lib/security/security_connector/{load_system_roots_linux.cc → load_system_roots_supported.cc} +27 -19
- data/src/core/lib/security/security_connector/{load_system_roots_linux.h → load_system_roots_supported.h} +5 -5
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +22 -3
- data/src/core/lib/security/security_connector/local/local_security_connector.h +6 -2
- data/src/core/lib/security/security_connector/security_connector.cc +20 -18
- data/src/core/lib/security/security_connector/security_connector.h +18 -6
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +18 -6
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +4 -2
- data/src/core/lib/security/security_connector/ssl_utils.cc +12 -2
- data/src/core/lib/security/security_connector/ssl_utils.h +10 -7
- data/src/core/lib/security/security_connector/ssl_utils_config.h +1 -1
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +21 -13
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +23 -3
- data/src/core/lib/security/transport/auth_filters.h +7 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +18 -9
- data/src/core/lib/security/transport/secure_endpoint.cc +63 -13
- data/src/core/lib/security/transport/secure_endpoint.h +4 -3
- data/src/core/lib/security/transport/security_handshaker.cc +44 -11
- data/src/core/lib/security/transport/security_handshaker.h +4 -0
- data/src/core/lib/security/transport/server_auth_filter.cc +26 -4
- data/src/core/lib/security/util/json_util.cc +3 -2
- data/src/core/lib/security/util/json_util.h +0 -2
- data/src/core/lib/service_config/service_config_call_data.h +2 -1
- data/src/core/lib/service_config/service_config_impl.cc +6 -6
- data/src/core/lib/service_config/service_config_impl.h +1 -3
- data/src/core/lib/service_config/service_config_parser.cc +2 -4
- data/src/core/lib/slice/slice_buffer.cc +30 -1
- data/src/core/lib/slice/slice_buffer.h +37 -6
- data/src/core/lib/slice/slice_string_helpers.cc +0 -20
- data/src/core/lib/slice/slice_string_helpers.h +0 -4
- data/src/core/lib/surface/call.cc +53 -115
- data/src/core/lib/surface/call.h +5 -1
- data/src/core/lib/surface/channel.h +2 -0
- data/src/core/lib/surface/channel_ping.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +15 -14
- data/src/core/lib/surface/completion_queue.h +2 -1
- data/src/core/lib/surface/init.cc +0 -1
- data/src/core/lib/surface/lame_client.cc +1 -1
- data/src/core/lib/surface/lame_client.h +1 -1
- data/src/core/lib/surface/server.cc +14 -8
- data/src/core/lib/surface/server.h +4 -1
- data/src/core/lib/surface/validate_metadata.cc +1 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/error_utils.cc +13 -7
- data/src/core/lib/transport/handshaker.cc +3 -3
- data/src/core/lib/transport/http_connect_handshaker.cc +4 -4
- data/src/core/lib/transport/tcp_connect_handshaker.cc +2 -2
- data/src/core/lib/transport/transport.cc +0 -3
- data/src/core/lib/transport/transport.h +20 -14
- data/src/core/lib/transport/transport_fwd.h +20 -0
- data/src/core/lib/transport/transport_impl.h +1 -0
- data/src/core/lib/transport/transport_op_string.cc +9 -9
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +1 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +9 -1
- data/src/core/tsi/fake_transport_security.cc +13 -1
- data/src/core/tsi/fake_transport_security.h +6 -0
- data/src/core/tsi/ssl_transport_security.cc +1 -1
- data/src/core/tsi/transport_security_grpc.cc +3 -2
- data/src/core/tsi/transport_security_grpc.h +5 -2
- data/src/ruby/ext/grpc/ext-export-truffleruby.clang +2 -0
- data/src/ruby/ext/grpc/ext-export-truffleruby.gcc +7 -0
- data/src/ruby/ext/grpc/ext-export.clang +1 -0
- data/src/ruby/ext/grpc/ext-export.gcc +1 -0
- data/src/ruby/ext/grpc/extconf.rb +49 -18
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
- data/src/ruby/lib/grpc/errors.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +23 -23
- data/third_party/abseil-cpp/absl/algorithm/container.h +1 -1
- data/third_party/abseil-cpp/absl/base/attributes.h +49 -22
- data/third_party/abseil-cpp/absl/base/casts.h +61 -68
- data/third_party/abseil-cpp/absl/base/config.h +182 -41
- data/third_party/abseil-cpp/absl/base/internal/cycleclock.cc +12 -42
- data/third_party/abseil-cpp/absl/base/internal/cycleclock.h +67 -2
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +3 -3
- data/third_party/abseil-cpp/absl/base/internal/endian.h +17 -62
- data/third_party/abseil-cpp/absl/base/internal/fast_type_id.h +2 -0
- data/third_party/abseil-cpp/absl/base/internal/invoke.h +54 -0
- data/third_party/abseil-cpp/absl/base/internal/prefetch.h +138 -0
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +29 -22
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +13 -12
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +3 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +8 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +2 -5
- data/third_party/abseil-cpp/absl/base/internal/strerror.cc +88 -0
- data/third_party/abseil-cpp/absl/base/internal/strerror.h +39 -0
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +0 -1
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +2 -1
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +6 -7
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +12 -3
- data/third_party/abseil-cpp/absl/base/log_severity.cc +28 -0
- data/third_party/abseil-cpp/absl/base/log_severity.h +51 -0
- data/third_party/abseil-cpp/absl/base/optimization.h +19 -11
- data/third_party/abseil-cpp/absl/base/options.h +1 -1
- data/third_party/abseil-cpp/absl/base/thread_annotations.h +2 -2
- data/third_party/abseil-cpp/absl/container/fixed_array.h +2 -0
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +11 -4
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +15 -9
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +20 -9
- data/third_party/abseil-cpp/absl/container/internal/common.h +6 -5
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +10 -28
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +68 -20
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +29 -11
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +59 -38
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +4 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +515 -184
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +45 -88
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +4 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +3 -2
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +8 -3
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +8 -3
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +2 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +8 -3
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +20 -18
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +8 -3
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +15 -2
- data/third_party/abseil-cpp/absl/debugging/symbolize.cc +6 -1
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +46 -7
- data/third_party/abseil-cpp/absl/functional/bind_front.h +10 -1
- data/third_party/abseil-cpp/absl/functional/function_ref.h +2 -1
- data/third_party/abseil-cpp/absl/hash/hash.h +82 -8
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +218 -23
- data/third_party/abseil-cpp/absl/numeric/bits.h +2 -1
- data/third_party/abseil-cpp/absl/numeric/int128.cc +4 -2
- data/third_party/abseil-cpp/absl/numeric/int128.h +2 -2
- data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +21 -6
- data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +4 -4
- data/third_party/abseil-cpp/absl/random/distributions.h +3 -3
- data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +3 -0
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +2 -1
- data/third_party/abseil-cpp/absl/random/internal/generate_real.h +2 -2
- data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +59 -48
- data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/randen.h +5 -11
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +6 -2
- data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +48 -23
- data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +24 -26
- data/third_party/abseil-cpp/absl/random/internal/traits.h +53 -5
- data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +5 -5
- data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +33 -48
- data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +9 -10
- data/third_party/abseil-cpp/absl/random/poisson_distribution.h +7 -4
- data/third_party/abseil-cpp/absl/random/seed_sequences.h +1 -0
- data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +2 -2
- data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +1 -1
- data/third_party/abseil-cpp/absl/random/zipf_distribution.h +4 -3
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +17 -0
- data/third_party/abseil-cpp/absl/status/status.cc +174 -2
- data/third_party/abseil-cpp/absl/status/status.h +22 -12
- data/third_party/abseil-cpp/absl/status/statusor.h +9 -3
- data/third_party/abseil-cpp/absl/strings/ascii.h +4 -4
- data/third_party/abseil-cpp/absl/strings/cord.cc +194 -913
- data/third_party/abseil-cpp/absl/strings/cord.h +202 -81
- data/third_party/abseil-cpp/absl/strings/cord_analysis.cc +188 -0
- data/third_party/abseil-cpp/absl/strings/cord_analysis.h +44 -0
- data/third_party/abseil-cpp/absl/strings/cord_buffer.cc +30 -0
- data/third_party/abseil-cpp/absl/strings/cord_buffer.h +572 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_data_edge.h +63 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +20 -32
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +123 -88
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +149 -49
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +44 -59
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +3 -1
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h +4 -2
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc +3 -2
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.h +5 -4
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc +7 -74
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc +54 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.h +102 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +58 -17
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc +13 -11
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +11 -38
- data/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +1 -0
- data/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h +4 -2
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +6 -5
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +38 -7
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +7 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +4 -5
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +5 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +2 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +4 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h +9 -6
- data/third_party/abseil-cpp/absl/strings/internal/string_constant.h +10 -2
- data/third_party/abseil-cpp/absl/strings/internal/utf8.cc +9 -9
- data/third_party/abseil-cpp/absl/strings/numbers.cc +8 -8
- data/third_party/abseil-cpp/absl/strings/numbers.h +26 -23
- data/third_party/abseil-cpp/absl/strings/str_cat.h +20 -13
- data/third_party/abseil-cpp/absl/strings/str_join.h +9 -15
- data/third_party/abseil-cpp/absl/strings/str_split.h +1 -2
- data/third_party/abseil-cpp/absl/strings/string_view.cc +2 -13
- data/third_party/abseil-cpp/absl/strings/string_view.h +3 -2
- data/third_party/abseil-cpp/absl/strings/strip.h +8 -6
- data/third_party/abseil-cpp/absl/strings/substitute.h +10 -2
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +9 -6
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h +0 -4
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +0 -4
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +1 -6
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +0 -25
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +10 -4
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +75 -40
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +17 -9
- data/third_party/abseil-cpp/absl/synchronization/notification.h +3 -2
- data/third_party/abseil-cpp/absl/time/duration.cc +5 -4
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +11 -7
- data/third_party/abseil-cpp/absl/time/time.h +16 -12
- data/third_party/abseil-cpp/absl/types/internal/optional.h +8 -0
- data/third_party/abseil-cpp/absl/types/internal/variant.h +3 -3
- data/third_party/abseil-cpp/absl/types/optional.h +17 -14
- data/third_party/abseil-cpp/absl/types/span.h +2 -1
- metadata +39 -15
- data/src/core/lib/slice/slice_split.cc +0 -103
- data/src/core/lib/slice/slice_split.h +0 -36
- data/src/core/lib/transport/byte_stream.cc +0 -165
- data/src/core/lib/transport/byte_stream.h +0 -170
- data/third_party/abseil-cpp/absl/cleanup/cleanup.h +0 -140
- data/third_party/abseil-cpp/absl/cleanup/internal/cleanup.h +0 -100
- data/third_party/abseil-cpp/absl/container/internal/have_sse.h +0 -50
@@ -37,6 +37,7 @@
|
|
37
37
|
#include "absl/strings/str_format.h"
|
38
38
|
#include "absl/strings/string_view.h"
|
39
39
|
#include "absl/types/optional.h"
|
40
|
+
#include "absl/types/variant.h"
|
40
41
|
|
41
42
|
#include <grpc/impl/codegen/connectivity_state.h>
|
42
43
|
#include <grpc/slice_buffer.h>
|
@@ -57,15 +58,13 @@
|
|
57
58
|
#include "src/core/ext/transport/chttp2/transport/stream_map.h"
|
58
59
|
#include "src/core/ext/transport/chttp2/transport/varint.h"
|
59
60
|
#include "src/core/lib/channel/channel_args.h"
|
60
|
-
#include "src/core/lib/channel/channel_stack_builder.h"
|
61
61
|
#include "src/core/lib/debug/stats.h"
|
62
62
|
#include "src/core/lib/gpr/useful.h"
|
63
63
|
#include "src/core/lib/gprpp/bitset.h"
|
64
64
|
#include "src/core/lib/gprpp/debug_location.h"
|
65
65
|
#include "src/core/lib/gprpp/global_config_env.h"
|
66
|
-
#include "src/core/lib/gprpp/manual_constructor.h"
|
67
|
-
#include "src/core/lib/gprpp/orphanable.h"
|
68
66
|
#include "src/core/lib/gprpp/ref_counted.h"
|
67
|
+
#include "src/core/lib/gprpp/status_helper.h"
|
69
68
|
#include "src/core/lib/gprpp/time.h"
|
70
69
|
#include "src/core/lib/http/parser.h"
|
71
70
|
#include "src/core/lib/iomgr/combiner.h"
|
@@ -75,16 +74,17 @@
|
|
75
74
|
#include "src/core/lib/iomgr/pollset.h"
|
76
75
|
#include "src/core/lib/iomgr/timer.h"
|
77
76
|
#include "src/core/lib/profiling/timers.h"
|
77
|
+
#include "src/core/lib/promise/poll.h"
|
78
78
|
#include "src/core/lib/resource_quota/api.h"
|
79
79
|
#include "src/core/lib/resource_quota/arena.h"
|
80
80
|
#include "src/core/lib/resource_quota/memory_quota.h"
|
81
81
|
#include "src/core/lib/resource_quota/resource_quota.h"
|
82
82
|
#include "src/core/lib/resource_quota/trace.h"
|
83
83
|
#include "src/core/lib/slice/slice.h"
|
84
|
+
#include "src/core/lib/slice/slice_buffer.h"
|
84
85
|
#include "src/core/lib/slice/slice_internal.h"
|
85
86
|
#include "src/core/lib/slice/slice_refcount.h"
|
86
87
|
#include "src/core/lib/transport/bdp_estimator.h"
|
87
|
-
#include "src/core/lib/transport/byte_stream.h"
|
88
88
|
#include "src/core/lib/transport/connectivity_state.h"
|
89
89
|
#include "src/core/lib/transport/error_utils.h"
|
90
90
|
#include "src/core/lib/transport/http2_errors.h"
|
@@ -94,10 +94,10 @@
|
|
94
94
|
#include "src/core/lib/transport/transport_impl.h"
|
95
95
|
|
96
96
|
GPR_GLOBAL_CONFIG_DEFINE_BOOL(
|
97
|
-
|
98
|
-
"If set,
|
99
|
-
"
|
100
|
-
"
|
97
|
+
grpc_experimental_enable_peer_state_based_framing, false,
|
98
|
+
"If set, the max sizes of frames sent to lower layers is controlled based "
|
99
|
+
"on the peer's memory pressure which is reflected in its max http2 frame "
|
100
|
+
"size.");
|
101
101
|
|
102
102
|
#define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024)
|
103
103
|
#define MAX_WINDOW 0x7fffffffu
|
@@ -151,8 +151,6 @@ static void read_action(void* t, grpc_error_handle error);
|
|
151
151
|
static void read_action_locked(void* t, grpc_error_handle error);
|
152
152
|
static void continue_read_action_locked(grpc_chttp2_transport* t);
|
153
153
|
|
154
|
-
static void complete_fetch(void* gs, grpc_error_handle error);
|
155
|
-
static void complete_fetch_locked(void* gs, grpc_error_handle error);
|
156
154
|
// Set a transport level setting, and push it to our peer
|
157
155
|
static void queue_setting_update(grpc_chttp2_transport* t,
|
158
156
|
grpc_chttp2_setting_id id, uint32_t value);
|
@@ -202,8 +200,6 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error);
|
|
202
200
|
static void keepalive_watchdog_fired(void* arg, grpc_error_handle error);
|
203
201
|
static void keepalive_watchdog_fired_locked(void* arg, grpc_error_handle error);
|
204
202
|
|
205
|
-
static void reset_byte_stream(void* arg, grpc_error_handle error);
|
206
|
-
|
207
203
|
namespace grpc_core {
|
208
204
|
|
209
205
|
namespace {
|
@@ -280,8 +276,6 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
|
|
280
276
|
write_cb_pool = next;
|
281
277
|
}
|
282
278
|
|
283
|
-
flow_control.Destroy();
|
284
|
-
|
285
279
|
GRPC_ERROR_UNREF(closed_with_error);
|
286
280
|
gpr_free(ping_acks);
|
287
281
|
if (grpc_core::test_only_destruct_callback != nullptr) {
|
@@ -291,11 +285,9 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
|
|
291
285
|
|
292
286
|
static const grpc_transport_vtable* get_vtable(void);
|
293
287
|
|
294
|
-
|
295
|
-
static bool read_channel_args(grpc_chttp2_transport* t,
|
288
|
+
static void read_channel_args(grpc_chttp2_transport* t,
|
296
289
|
const grpc_channel_args* channel_args,
|
297
290
|
bool is_client) {
|
298
|
-
bool enable_bdp = true;
|
299
291
|
bool channelz_enabled = GRPC_ENABLE_CHANNELZ_DEFAULT;
|
300
292
|
size_t i;
|
301
293
|
int j;
|
@@ -345,9 +337,6 @@ static bool read_channel_args(grpc_chttp2_transport* t,
|
|
345
337
|
GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE)) {
|
346
338
|
t->write_buffer_size = static_cast<uint32_t>(grpc_channel_arg_get_integer(
|
347
339
|
&channel_args->args[i], {0, 0, MAX_WRITE_BUFFER_SIZE}));
|
348
|
-
} else if (0 ==
|
349
|
-
strcmp(channel_args->args[i].key, GRPC_ARG_HTTP2_BDP_PROBE)) {
|
350
|
-
enable_bdp = grpc_channel_arg_get_bool(&channel_args->args[i], true);
|
351
340
|
} else if (0 ==
|
352
341
|
strcmp(channel_args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) {
|
353
342
|
const int value = grpc_channel_arg_get_integer(
|
@@ -439,7 +428,6 @@ static bool read_channel_args(grpc_chttp2_transport* t,
|
|
439
428
|
grpc_core::channelz::SocketNode::Security::GetFromChannelArgs(
|
440
429
|
channel_args));
|
441
430
|
}
|
442
|
-
return enable_bdp;
|
443
431
|
}
|
444
432
|
|
445
433
|
static void init_transport_keepalive_settings(grpc_chttp2_transport* t) {
|
@@ -510,6 +498,10 @@ grpc_chttp2_transport::grpc_chttp2_transport(
|
|
510
498
|
GRPC_CHANNEL_READY),
|
511
499
|
is_client(is_client),
|
512
500
|
next_stream_id(is_client ? 1 : 2),
|
501
|
+
flow_control(peer_string.c_str(),
|
502
|
+
grpc_channel_args_find_bool(channel_args,
|
503
|
+
GRPC_ARG_HTTP2_BDP_PROBE, true),
|
504
|
+
&memory_owner),
|
513
505
|
deframe_state(is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0) {
|
514
506
|
GPR_ASSERT(strlen(GRPC_CHTTP2_CLIENT_CONNECT_STRING) ==
|
515
507
|
GRPC_CHTTP2_CLIENT_CONNECT_STRLEN);
|
@@ -551,19 +543,8 @@ grpc_chttp2_transport::grpc_chttp2_transport(
|
|
551
543
|
configure_transport_ping_policy(this);
|
552
544
|
init_transport_keepalive_settings(this);
|
553
545
|
|
554
|
-
|
555
|
-
|
556
|
-
enable_bdp = read_channel_args(this, channel_args, is_client);
|
557
|
-
}
|
558
|
-
|
559
|
-
static const bool kEnableFlowControl =
|
560
|
-
!GPR_GLOBAL_CONFIG_GET(grpc_experimental_disable_flow_control);
|
561
|
-
if (kEnableFlowControl) {
|
562
|
-
flow_control.Init<grpc_core::chttp2::TransportFlowControl>(this,
|
563
|
-
enable_bdp);
|
564
|
-
} else {
|
565
|
-
flow_control.Init<grpc_core::chttp2::TransportFlowControlDisabled>(this);
|
566
|
-
enable_bdp = false;
|
546
|
+
if (channel_args != nullptr) {
|
547
|
+
read_channel_args(this, channel_args, is_client);
|
567
548
|
}
|
568
549
|
|
569
550
|
// No pings allowed before receiving a header or data frame.
|
@@ -576,9 +557,9 @@ grpc_chttp2_transport::grpc_chttp2_transport(
|
|
576
557
|
|
577
558
|
init_keepalive_pings_if_enabled(this);
|
578
559
|
|
579
|
-
if (
|
560
|
+
if (flow_control.bdp_probe()) {
|
580
561
|
bdp_ping_blocked = true;
|
581
|
-
grpc_chttp2_act_on_flowctl_action(flow_control
|
562
|
+
grpc_chttp2_act_on_flowctl_action(flow_control.PeriodicUpdate(), this,
|
582
563
|
nullptr);
|
583
564
|
}
|
584
565
|
|
@@ -611,13 +592,13 @@ static void close_transport_locked(grpc_chttp2_transport* t,
|
|
611
592
|
grpc_error_handle error) {
|
612
593
|
end_all_the_calls(t, GRPC_ERROR_REF(error));
|
613
594
|
cancel_pings(t, GRPC_ERROR_REF(error));
|
614
|
-
if (t->closed_with_error
|
595
|
+
if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
615
596
|
if (!grpc_error_has_clear_grpc_status(error)) {
|
616
597
|
error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS,
|
617
598
|
GRPC_STATUS_UNAVAILABLE);
|
618
599
|
}
|
619
600
|
if (t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
620
|
-
if (t->close_transport_on_writes_finished
|
601
|
+
if (GRPC_ERROR_IS_NONE(t->close_transport_on_writes_finished)) {
|
621
602
|
t->close_transport_on_writes_finished =
|
622
603
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
623
604
|
"Delayed close due to in-progress write");
|
@@ -626,7 +607,7 @@ static void close_transport_locked(grpc_chttp2_transport* t,
|
|
626
607
|
grpc_error_add_child(t->close_transport_on_writes_finished, error);
|
627
608
|
return;
|
628
609
|
}
|
629
|
-
GPR_ASSERT(error
|
610
|
+
GPR_ASSERT(!GRPC_ERROR_IS_NONE(error));
|
630
611
|
t->closed_with_error = GRPC_ERROR_REF(error);
|
631
612
|
connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN, absl::Status(),
|
632
613
|
"close_transport");
|
@@ -703,29 +684,23 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
|
|
703
684
|
refcount(refcount),
|
704
685
|
reffer(this),
|
705
686
|
initial_metadata_buffer(arena),
|
706
|
-
trailing_metadata_buffer(arena)
|
687
|
+
trailing_metadata_buffer(arena),
|
688
|
+
flow_control(&t->flow_control) {
|
707
689
|
if (server_data) {
|
708
690
|
id = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(server_data));
|
709
691
|
*t->accepting_stream = this;
|
710
692
|
grpc_chttp2_stream_map_add(&t->stream_map, id, this);
|
711
693
|
post_destructive_reclaimer(t);
|
712
694
|
}
|
713
|
-
if (t->flow_control->flow_control_enabled()) {
|
714
|
-
flow_control.Init<grpc_core::chttp2::StreamFlowControl>(
|
715
|
-
static_cast<grpc_core::chttp2::TransportFlowControl*>(
|
716
|
-
t->flow_control.get()),
|
717
|
-
this);
|
718
|
-
} else {
|
719
|
-
flow_control.Init<grpc_core::chttp2::StreamFlowControlDisabled>();
|
720
|
-
}
|
721
695
|
|
722
696
|
grpc_slice_buffer_init(&frame_storage);
|
723
|
-
grpc_slice_buffer_init(&unprocessed_incoming_frames_buffer);
|
724
697
|
grpc_slice_buffer_init(&flow_controlled_buffer);
|
725
|
-
GRPC_CLOSURE_INIT(&reset_byte_stream, ::reset_byte_stream, this, nullptr);
|
726
698
|
}
|
727
699
|
|
728
700
|
grpc_chttp2_stream::~grpc_chttp2_stream() {
|
701
|
+
grpc_chttp2_list_remove_stalled_by_stream(t, this);
|
702
|
+
grpc_chttp2_list_remove_stalled_by_transport(t, this);
|
703
|
+
|
729
704
|
if (t->channelz_socket != nullptr) {
|
730
705
|
if ((t->is_client && eos_received) || (!t->is_client && eos_sent)) {
|
731
706
|
t->channelz_socket->RecordStreamSucceeded();
|
@@ -739,7 +714,6 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
739
714
|
GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, id) == nullptr);
|
740
715
|
}
|
741
716
|
|
742
|
-
grpc_slice_buffer_destroy_internal(&unprocessed_incoming_frames_buffer);
|
743
717
|
grpc_slice_buffer_destroy_internal(&frame_storage);
|
744
718
|
|
745
719
|
for (int i = 0; i < STREAM_LIST_COUNT; i++) {
|
@@ -751,7 +725,6 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
751
725
|
}
|
752
726
|
|
753
727
|
GPR_ASSERT(send_initial_metadata_finished == nullptr);
|
754
|
-
GPR_ASSERT(fetching_send_message == nullptr);
|
755
728
|
GPR_ASSERT(send_trailing_metadata_finished == nullptr);
|
756
729
|
GPR_ASSERT(recv_initial_metadata_ready == nullptr);
|
757
730
|
GPR_ASSERT(recv_message_ready == nullptr);
|
@@ -759,8 +732,6 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
759
732
|
grpc_slice_buffer_destroy_internal(&flow_controlled_buffer);
|
760
733
|
GRPC_ERROR_UNREF(read_closed_error);
|
761
734
|
GRPC_ERROR_UNREF(write_closed_error);
|
762
|
-
GRPC_ERROR_UNREF(byte_stream_error);
|
763
|
-
flow_control.Destroy();
|
764
735
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "stream");
|
765
736
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, destroy_stream_arg, GRPC_ERROR_NONE);
|
766
737
|
}
|
@@ -837,7 +808,7 @@ static void set_write_state(grpc_chttp2_transport* t,
|
|
837
808
|
// from peer while we had some pending writes)
|
838
809
|
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
839
810
|
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &t->run_after_write);
|
840
|
-
if (t->close_transport_on_writes_finished
|
811
|
+
if (!GRPC_ERROR_IS_NONE(t->close_transport_on_writes_finished)) {
|
841
812
|
grpc_error_handle err = t->close_transport_on_writes_finished;
|
842
813
|
t->close_transport_on_writes_finished = GRPC_ERROR_NONE;
|
843
814
|
close_transport_locked(t, err);
|
@@ -959,7 +930,7 @@ void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
|
|
959
930
|
|
960
931
|
void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
|
961
932
|
grpc_chttp2_stream* s) {
|
962
|
-
if (t->closed_with_error
|
933
|
+
if (GRPC_ERROR_IS_NONE(t->closed_with_error) &&
|
963
934
|
grpc_chttp2_list_add_writable_stream(t, s)) {
|
964
935
|
GRPC_CHTTP2_STREAM_REF(s, "chttp2_writing:become");
|
965
936
|
}
|
@@ -979,7 +950,7 @@ static void write_action_begin_locked(void* gt,
|
|
979
950
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
|
980
951
|
GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE);
|
981
952
|
grpc_chttp2_begin_write_result r;
|
982
|
-
if (t->closed_with_error
|
953
|
+
if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
983
954
|
r.writing = false;
|
984
955
|
} else {
|
985
956
|
r = grpc_chttp2_begin_write(t);
|
@@ -1015,14 +986,26 @@ static void write_action_begin_locked(void* gt,
|
|
1015
986
|
|
1016
987
|
static void write_action(void* gt, grpc_error_handle /*error*/) {
|
1017
988
|
GPR_TIMER_SCOPE("write_action", 0);
|
989
|
+
static bool kEnablePeerStateBasedFraming =
|
990
|
+
GPR_GLOBAL_CONFIG_GET(grpc_experimental_enable_peer_state_based_framing);
|
1018
991
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
|
1019
992
|
void* cl = t->cl;
|
1020
993
|
t->cl = nullptr;
|
994
|
+
// If grpc_experimental_enable_peer_state_based_framing is set to true,
|
995
|
+
// choose max_frame_size as 2 * max http2 frame size of peer. If peer is under
|
996
|
+
// high memory pressure, then it would advertise a smaller max http2 frame
|
997
|
+
// size. With this logic, the sender would automatically reduce the sending
|
998
|
+
// frame size as well.
|
999
|
+
int max_frame_size =
|
1000
|
+
kEnablePeerStateBasedFraming
|
1001
|
+
? 2 * t->settings[GRPC_PEER_SETTINGS]
|
1002
|
+
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]
|
1003
|
+
: INT_MAX;
|
1021
1004
|
grpc_endpoint_write(
|
1022
1005
|
t->ep, &t->outbuf,
|
1023
1006
|
GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end, t,
|
1024
1007
|
grpc_schedule_on_exec_ctx),
|
1025
|
-
cl,
|
1008
|
+
cl, max_frame_size);
|
1026
1009
|
}
|
1027
1010
|
|
1028
1011
|
static void write_action_end(void* tp, grpc_error_handle error) {
|
@@ -1039,7 +1022,7 @@ static void write_action_end_locked(void* tp, grpc_error_handle error) {
|
|
1039
1022
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
1040
1023
|
|
1041
1024
|
bool closed = false;
|
1042
|
-
if (error
|
1025
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
1043
1026
|
close_transport_locked(t, GRPC_ERROR_REF(error));
|
1044
1027
|
closed = true;
|
1045
1028
|
}
|
@@ -1118,7 +1101,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
|
1118
1101
|
uint32_t last_stream_id,
|
1119
1102
|
absl::string_view goaway_text) {
|
1120
1103
|
// Discard the error from a previous goaway frame (if any)
|
1121
|
-
if (t->goaway_error
|
1104
|
+
if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
|
1122
1105
|
GRPC_ERROR_UNREF(t->goaway_error);
|
1123
1106
|
}
|
1124
1107
|
t->goaway_error = grpc_error_set_str(
|
@@ -1188,7 +1171,7 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
|
|
1188
1171
|
grpc_chttp2_stream* s;
|
1189
1172
|
// maybe cancel out streams that haven't yet started if we have received a
|
1190
1173
|
// GOAWAY
|
1191
|
-
if (t->goaway_error
|
1174
|
+
if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
|
1192
1175
|
cancel_unstarted_streams(t, GRPC_ERROR_REF(t->goaway_error));
|
1193
1176
|
return;
|
1194
1177
|
}
|
@@ -1252,6 +1235,12 @@ static grpc_closure* add_closure_barrier(grpc_closure* closure) {
|
|
1252
1235
|
static void null_then_sched_closure(grpc_closure** closure) {
|
1253
1236
|
grpc_closure* c = *closure;
|
1254
1237
|
*closure = nullptr;
|
1238
|
+
// null_then_schedule_closure might be run during a start_batch which might
|
1239
|
+
// subsequently examine the batch for more operations contained within.
|
1240
|
+
// However, the closure run might make it back to the call object, push a
|
1241
|
+
// completion, have the application see it, and make a new operation on the
|
1242
|
+
// call which recycles the batch BEFORE the call to start_batch completes,
|
1243
|
+
// forcing a race.
|
1255
1244
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, c, GRPC_ERROR_NONE);
|
1256
1245
|
}
|
1257
1246
|
|
@@ -1280,7 +1269,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1280
1269
|
desc, grpc_error_std_string(error).c_str(),
|
1281
1270
|
write_state_name(t->write_state));
|
1282
1271
|
}
|
1283
|
-
if (error
|
1272
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
1284
1273
|
#ifdef GRPC_ERROR_IS_ABSEIL_STATUS
|
1285
1274
|
grpc_error_handle cl_err =
|
1286
1275
|
grpc_core::internal::StatusMoveFromHeapPtr(closure->error_data.error);
|
@@ -1288,7 +1277,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1288
1277
|
grpc_error_handle cl_err =
|
1289
1278
|
reinterpret_cast<grpc_error_handle>(closure->error_data.error);
|
1290
1279
|
#endif
|
1291
|
-
if (cl_err
|
1280
|
+
if (GRPC_ERROR_IS_NONE(cl_err)) {
|
1292
1281
|
cl_err = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1293
1282
|
"Error in HTTP transport completing operation");
|
1294
1283
|
cl_err = grpc_error_set_str(cl_err, GRPC_ERROR_STR_TARGET_ADDRESS,
|
@@ -1326,94 +1315,6 @@ static bool contains_non_ok_status(grpc_metadata_batch* batch) {
|
|
1326
1315
|
GRPC_STATUS_OK;
|
1327
1316
|
}
|
1328
1317
|
|
1329
|
-
static void maybe_become_writable_due_to_send_msg(grpc_chttp2_transport* t,
|
1330
|
-
grpc_chttp2_stream* s) {
|
1331
|
-
if (s->id != 0 && (!s->write_buffering ||
|
1332
|
-
s->flow_controlled_buffer.length > t->write_buffer_size)) {
|
1333
|
-
grpc_chttp2_mark_stream_writable(t, s);
|
1334
|
-
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE);
|
1335
|
-
}
|
1336
|
-
}
|
1337
|
-
|
1338
|
-
static void add_fetched_slice_locked(grpc_chttp2_transport* t,
|
1339
|
-
grpc_chttp2_stream* s) {
|
1340
|
-
s->fetched_send_message_length +=
|
1341
|
-
static_cast<uint32_t> GRPC_SLICE_LENGTH(s->fetching_slice);
|
1342
|
-
grpc_slice_buffer_add(&s->flow_controlled_buffer, s->fetching_slice);
|
1343
|
-
maybe_become_writable_due_to_send_msg(t, s);
|
1344
|
-
}
|
1345
|
-
|
1346
|
-
static void continue_fetching_send_locked(grpc_chttp2_transport* t,
|
1347
|
-
grpc_chttp2_stream* s) {
|
1348
|
-
for (;;) {
|
1349
|
-
if (s->fetching_send_message == nullptr) {
|
1350
|
-
// Stream was cancelled before message fetch completed
|
1351
|
-
abort(); /* TODO(ctiller): what cleanup here? */
|
1352
|
-
}
|
1353
|
-
if (s->fetched_send_message_length == s->fetching_send_message->length()) {
|
1354
|
-
int64_t notify_offset = s->next_message_end_offset;
|
1355
|
-
if (notify_offset <= s->flow_controlled_bytes_written) {
|
1356
|
-
grpc_chttp2_complete_closure_step(
|
1357
|
-
t, s, &s->fetching_send_message_finished, GRPC_ERROR_NONE,
|
1358
|
-
"fetching_send_message_finished");
|
1359
|
-
} else {
|
1360
|
-
grpc_chttp2_write_cb* cb = t->write_cb_pool;
|
1361
|
-
if (cb == nullptr) {
|
1362
|
-
cb = static_cast<grpc_chttp2_write_cb*>(gpr_malloc(sizeof(*cb)));
|
1363
|
-
} else {
|
1364
|
-
t->write_cb_pool = cb->next;
|
1365
|
-
}
|
1366
|
-
cb->call_at_byte = notify_offset;
|
1367
|
-
cb->closure = s->fetching_send_message_finished;
|
1368
|
-
s->fetching_send_message_finished = nullptr;
|
1369
|
-
grpc_chttp2_write_cb** list =
|
1370
|
-
s->fetching_send_message->flags() & GRPC_WRITE_THROUGH
|
1371
|
-
? &s->on_write_finished_cbs
|
1372
|
-
: &s->on_flow_controlled_cbs;
|
1373
|
-
cb->next = *list;
|
1374
|
-
*list = cb;
|
1375
|
-
}
|
1376
|
-
s->fetching_send_message.reset();
|
1377
|
-
return; /* early out */
|
1378
|
-
} else if (s->fetching_send_message->Next(
|
1379
|
-
UINT32_MAX, GRPC_CLOSURE_INIT(&s->complete_fetch_locked,
|
1380
|
-
::complete_fetch, s,
|
1381
|
-
grpc_schedule_on_exec_ctx))) {
|
1382
|
-
grpc_error_handle error =
|
1383
|
-
s->fetching_send_message->Pull(&s->fetching_slice);
|
1384
|
-
if (error != GRPC_ERROR_NONE) {
|
1385
|
-
s->fetching_send_message.reset();
|
1386
|
-
grpc_chttp2_cancel_stream(t, s, error);
|
1387
|
-
} else {
|
1388
|
-
add_fetched_slice_locked(t, s);
|
1389
|
-
}
|
1390
|
-
}
|
1391
|
-
}
|
1392
|
-
}
|
1393
|
-
|
1394
|
-
static void complete_fetch(void* gs, grpc_error_handle error) {
|
1395
|
-
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(gs);
|
1396
|
-
s->t->combiner->Run(GRPC_CLOSURE_INIT(&s->complete_fetch_locked,
|
1397
|
-
::complete_fetch_locked, s, nullptr),
|
1398
|
-
GRPC_ERROR_REF(error));
|
1399
|
-
}
|
1400
|
-
|
1401
|
-
static void complete_fetch_locked(void* gs, grpc_error_handle error) {
|
1402
|
-
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(gs);
|
1403
|
-
grpc_chttp2_transport* t = s->t;
|
1404
|
-
if (error == GRPC_ERROR_NONE) {
|
1405
|
-
error = s->fetching_send_message->Pull(&s->fetching_slice);
|
1406
|
-
if (error == GRPC_ERROR_NONE) {
|
1407
|
-
add_fetched_slice_locked(t, s);
|
1408
|
-
continue_fetching_send_locked(t, s);
|
1409
|
-
}
|
1410
|
-
}
|
1411
|
-
if (error != GRPC_ERROR_NONE) {
|
1412
|
-
s->fetching_send_message.reset();
|
1413
|
-
grpc_chttp2_cancel_stream(t, s, error);
|
1414
|
-
}
|
1415
|
-
}
|
1416
|
-
|
1417
1318
|
static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
|
1418
1319
|
bool is_client, bool is_initial) {
|
1419
1320
|
const std::string prefix = absl::StrCat(
|
@@ -1489,7 +1390,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1489
1390
|
}
|
1490
1391
|
if (!s->write_closed) {
|
1491
1392
|
if (t->is_client) {
|
1492
|
-
if (t->closed_with_error
|
1393
|
+
if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
1493
1394
|
GPR_ASSERT(s->id == 0);
|
1494
1395
|
grpc_chttp2_list_add_waiting_for_concurrency(t, s);
|
1495
1396
|
maybe_start_some_streams(t);
|
@@ -1508,8 +1409,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1508
1409
|
GPR_ASSERT(s->id != 0);
|
1509
1410
|
grpc_chttp2_mark_stream_writable(t, s);
|
1510
1411
|
if (!(op->send_message &&
|
1511
|
-
(op->payload->send_message.
|
1512
|
-
GRPC_WRITE_BUFFER_HINT))) {
|
1412
|
+
(op->payload->send_message.flags & GRPC_WRITE_BUFFER_HINT))) {
|
1513
1413
|
grpc_chttp2_initiate_write(
|
1514
1414
|
t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
|
1515
1415
|
}
|
@@ -1533,32 +1433,28 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1533
1433
|
GRPC_STATS_INC_HTTP2_OP_SEND_MESSAGE();
|
1534
1434
|
t->num_messages_in_next_write++;
|
1535
1435
|
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_SIZE(
|
1536
|
-
op->payload->send_message.send_message->
|
1436
|
+
op->payload->send_message.send_message->Length());
|
1537
1437
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
|
1538
|
-
s->
|
1438
|
+
s->send_message_finished = add_closure_barrier(op->on_complete);
|
1439
|
+
const uint32_t flags = op_payload->send_message.flags;
|
1539
1440
|
if (s->write_closed) {
|
1540
1441
|
op->payload->send_message.stream_write_closed = true;
|
1541
1442
|
// We should NOT return an error here, so as to avoid a cancel OP being
|
1542
1443
|
// started. The surface layer will notice that the stream has been closed
|
1543
1444
|
// for writes and fail the send message op.
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
"fetching_send_message_finished");
|
1445
|
+
grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
|
1446
|
+
GRPC_ERROR_NONE,
|
1447
|
+
"fetching_send_message_finished");
|
1548
1448
|
} else {
|
1549
|
-
GPR_ASSERT(s->fetching_send_message == nullptr);
|
1550
1449
|
uint8_t* frame_hdr = grpc_slice_buffer_tiny_add(
|
1551
1450
|
&s->flow_controlled_buffer, GRPC_HEADER_SIZE_IN_BYTES);
|
1552
|
-
uint32_t flags = op_payload->send_message.send_message->flags();
|
1553
1451
|
frame_hdr[0] = (flags & GRPC_WRITE_INTERNAL_COMPRESS) != 0;
|
1554
|
-
size_t len = op_payload->send_message.send_message->
|
1452
|
+
size_t len = op_payload->send_message.send_message->Length();
|
1555
1453
|
frame_hdr[1] = static_cast<uint8_t>(len >> 24);
|
1556
1454
|
frame_hdr[2] = static_cast<uint8_t>(len >> 16);
|
1557
1455
|
frame_hdr[3] = static_cast<uint8_t>(len >> 8);
|
1558
1456
|
frame_hdr[4] = static_cast<uint8_t>(len);
|
1559
|
-
|
1560
|
-
std::move(op_payload->send_message.send_message);
|
1561
|
-
s->fetched_send_message_length = 0;
|
1457
|
+
|
1562
1458
|
s->next_message_end_offset =
|
1563
1459
|
s->flow_controlled_bytes_written +
|
1564
1460
|
static_cast<int64_t>(s->flow_controlled_buffer.length) +
|
@@ -1569,8 +1465,44 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1569
1465
|
} else {
|
1570
1466
|
s->write_buffering = false;
|
1571
1467
|
}
|
1572
|
-
|
1573
|
-
|
1468
|
+
|
1469
|
+
grpc_slice* const slices =
|
1470
|
+
op_payload->send_message.send_message->c_slice_buffer()->slices;
|
1471
|
+
grpc_slice* const end =
|
1472
|
+
slices + op_payload->send_message.send_message->Count();
|
1473
|
+
for (grpc_slice* slice = slices; slice != end; slice++) {
|
1474
|
+
grpc_slice_buffer_add(&s->flow_controlled_buffer,
|
1475
|
+
grpc_slice_ref_internal(*slice));
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
int64_t notify_offset = s->next_message_end_offset;
|
1479
|
+
if (notify_offset <= s->flow_controlled_bytes_written) {
|
1480
|
+
grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
|
1481
|
+
GRPC_ERROR_NONE,
|
1482
|
+
"fetching_send_message_finished");
|
1483
|
+
} else {
|
1484
|
+
grpc_chttp2_write_cb* cb = t->write_cb_pool;
|
1485
|
+
if (cb == nullptr) {
|
1486
|
+
cb = static_cast<grpc_chttp2_write_cb*>(gpr_malloc(sizeof(*cb)));
|
1487
|
+
} else {
|
1488
|
+
t->write_cb_pool = cb->next;
|
1489
|
+
}
|
1490
|
+
cb->call_at_byte = notify_offset;
|
1491
|
+
cb->closure = s->send_message_finished;
|
1492
|
+
s->send_message_finished = nullptr;
|
1493
|
+
grpc_chttp2_write_cb** list = flags & GRPC_WRITE_THROUGH
|
1494
|
+
? &s->on_write_finished_cbs
|
1495
|
+
: &s->on_flow_controlled_cbs;
|
1496
|
+
cb->next = *list;
|
1497
|
+
*list = cb;
|
1498
|
+
}
|
1499
|
+
|
1500
|
+
if (s->id != 0 &&
|
1501
|
+
(!s->write_buffering ||
|
1502
|
+
s->flow_controlled_buffer.length > t->write_buffer_size)) {
|
1503
|
+
grpc_chttp2_mark_stream_writable(t, s);
|
1504
|
+
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE);
|
1505
|
+
}
|
1574
1506
|
}
|
1575
1507
|
}
|
1576
1508
|
|
@@ -1624,28 +1556,14 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1624
1556
|
|
1625
1557
|
if (op->recv_message) {
|
1626
1558
|
GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE();
|
1627
|
-
size_t before = 0;
|
1628
1559
|
GPR_ASSERT(s->recv_message_ready == nullptr);
|
1629
|
-
GPR_ASSERT(!s->pending_byte_stream);
|
1630
1560
|
s->recv_message_ready = op_payload->recv_message.recv_message_ready;
|
1631
1561
|
s->recv_message = op_payload->recv_message.recv_message;
|
1562
|
+
s->recv_message->emplace();
|
1563
|
+
s->recv_message_flags = op_payload->recv_message.flags;
|
1632
1564
|
s->call_failed_before_recv_message =
|
1633
1565
|
op_payload->recv_message.call_failed_before_recv_message;
|
1634
|
-
|
1635
|
-
if (!s->read_closed) {
|
1636
|
-
before = s->frame_storage.length +
|
1637
|
-
s->unprocessed_incoming_frames_buffer.length;
|
1638
|
-
}
|
1639
|
-
}
|
1640
|
-
grpc_chttp2_maybe_complete_recv_message(t, s);
|
1641
|
-
if (s->id != 0) {
|
1642
|
-
if (!s->read_closed && s->frame_storage.length == 0) {
|
1643
|
-
size_t after = s->unprocessed_incoming_frames_buffer_cached_length;
|
1644
|
-
s->flow_control->IncomingByteStreamUpdate(GRPC_HEADER_SIZE_IN_BYTES,
|
1645
|
-
before - after);
|
1646
|
-
grpc_chttp2_act_on_flowctl_action(s->flow_control->MakeAction(), t, s);
|
1647
|
-
}
|
1648
|
-
}
|
1566
|
+
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
1649
1567
|
}
|
1650
1568
|
|
1651
1569
|
if (op->recv_trailing_metadata) {
|
@@ -1704,7 +1622,7 @@ static void cancel_pings(grpc_chttp2_transport* t, grpc_error_handle error) {
|
|
1704
1622
|
// callback remaining pings: they're not allowed to call into the transport,
|
1705
1623
|
// and maybe they hold resources that need to be freed
|
1706
1624
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
1707
|
-
GPR_ASSERT(error
|
1625
|
+
GPR_ASSERT(!GRPC_ERROR_IS_NONE(error));
|
1708
1626
|
for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) {
|
1709
1627
|
grpc_closure_list_fail_all(&pq->lists[j], GRPC_ERROR_REF(error));
|
1710
1628
|
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &pq->lists[j]);
|
@@ -1714,7 +1632,7 @@ static void cancel_pings(grpc_chttp2_transport* t, grpc_error_handle error) {
|
|
1714
1632
|
|
1715
1633
|
static void send_ping_locked(grpc_chttp2_transport* t,
|
1716
1634
|
grpc_closure* on_initiate, grpc_closure* on_ack) {
|
1717
|
-
if (t->closed_with_error
|
1635
|
+
if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
1718
1636
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_initiate,
|
1719
1637
|
GRPC_ERROR_REF(t->closed_with_error));
|
1720
1638
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_ack,
|
@@ -1732,7 +1650,7 @@ static void send_ping_locked(grpc_chttp2_transport* t,
|
|
1732
1650
|
// a ping in progress, the keepalive ping would piggyback onto that ping,
|
1733
1651
|
// instead of waiting for that ping to complete and then starting a new ping.
|
1734
1652
|
static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
|
1735
|
-
if (t->closed_with_error
|
1653
|
+
if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
1736
1654
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
|
1737
1655
|
start_keepalive_ping_locked, t, nullptr),
|
1738
1656
|
GRPC_ERROR_REF(t->closed_with_error));
|
@@ -1777,7 +1695,7 @@ void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error_handle error) {
|
|
1777
1695
|
static void retry_initiate_ping_locked(void* tp, grpc_error_handle error) {
|
1778
1696
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
1779
1697
|
t->ping_state.is_delayed_ping_timer_set = false;
|
1780
|
-
if (error
|
1698
|
+
if (GRPC_ERROR_IS_NONE(error)) {
|
1781
1699
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
|
1782
1700
|
}
|
1783
1701
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "retry_initiate_ping_locked");
|
@@ -1834,7 +1752,7 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
|
|
1834
1752
|
// We already sent the final GOAWAY.
|
1835
1753
|
return;
|
1836
1754
|
}
|
1837
|
-
if (t_->destroying || t_->closed_with_error
|
1755
|
+
if (t_->destroying || !GRPC_ERROR_IS_NONE(t_->closed_with_error)) {
|
1838
1756
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
1839
1757
|
GPR_INFO,
|
1840
1758
|
"transport:%p %s peer:%s Transport already shutting down. "
|
@@ -1871,7 +1789,7 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
|
|
1871
1789
|
|
1872
1790
|
static void OnTimer(void* arg, grpc_error_handle error) {
|
1873
1791
|
auto* self = static_cast<GracefulGoaway*>(arg);
|
1874
|
-
if (error
|
1792
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
1875
1793
|
self->Unref();
|
1876
1794
|
return;
|
1877
1795
|
}
|
@@ -1955,7 +1873,7 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1955
1873
|
grpc_chttp2_transport* t =
|
1956
1874
|
static_cast<grpc_chttp2_transport*>(op->handler_private.extra_arg);
|
1957
1875
|
|
1958
|
-
if (op->goaway_error
|
1876
|
+
if (!GRPC_ERROR_IS_NONE(op->goaway_error)) {
|
1959
1877
|
send_goaway(t, op->goaway_error, /*immediate_disconnect_hint=*/false);
|
1960
1878
|
}
|
1961
1879
|
|
@@ -1985,7 +1903,7 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1985
1903
|
t->state_tracker.RemoveWatcher(op->stop_connectivity_watch);
|
1986
1904
|
}
|
1987
1905
|
|
1988
|
-
if (op->disconnect_with_error
|
1906
|
+
if (!GRPC_ERROR_IS_NONE(op->disconnect_with_error)) {
|
1989
1907
|
send_goaway(t, GRPC_ERROR_REF(op->disconnect_with_error),
|
1990
1908
|
/*immediate_disconnect_hint=*/true);
|
1991
1909
|
close_transport_locked(t, op->disconnect_with_error);
|
@@ -2019,10 +1937,6 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
|
|
2019
1937
|
s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) {
|
2020
1938
|
if (s->seen_error) {
|
2021
1939
|
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
2022
|
-
if (!s->pending_byte_stream) {
|
2023
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
2024
|
-
&s->unprocessed_incoming_frames_buffer);
|
2025
|
-
}
|
2026
1940
|
}
|
2027
1941
|
*s->recv_initial_metadata = std::move(s->initial_metadata_buffer);
|
2028
1942
|
s->recv_initial_metadata->Set(grpc_core::PeerString(), t->peer_string);
|
@@ -2039,47 +1953,62 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
|
|
2039
1953
|
}
|
2040
1954
|
}
|
2041
1955
|
|
2042
|
-
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport*
|
1956
|
+
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
|
2043
1957
|
grpc_chttp2_stream* s) {
|
1958
|
+
if (s->recv_message_ready == nullptr) return;
|
1959
|
+
|
1960
|
+
grpc_core::chttp2::StreamFlowControl::IncomingUpdateContext upd(
|
1961
|
+
&s->flow_control);
|
2044
1962
|
grpc_error_handle error = GRPC_ERROR_NONE;
|
2045
|
-
|
2046
|
-
|
1963
|
+
|
1964
|
+
// Lambda is immediately invoked as a big scoped section that can be
|
1965
|
+
// exited out of at any point by returning.
|
1966
|
+
[&]() {
|
2047
1967
|
if (s->final_metadata_requested && s->seen_error) {
|
2048
1968
|
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
1969
|
+
s->recv_message->reset();
|
1970
|
+
} else {
|
1971
|
+
if (s->frame_storage.length != 0) {
|
1972
|
+
while (true) {
|
1973
|
+
GPR_ASSERT(s->frame_storage.length > 0);
|
1974
|
+
uint32_t min_progress_size;
|
1975
|
+
auto r = grpc_deframe_unprocessed_incoming_frames(
|
1976
|
+
s, &min_progress_size, &**s->recv_message, s->recv_message_flags);
|
1977
|
+
if (absl::holds_alternative<grpc_core::Pending>(r)) {
|
1978
|
+
if (s->read_closed) {
|
1979
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1980
|
+
s->recv_message->reset();
|
1981
|
+
break;
|
1982
|
+
} else {
|
1983
|
+
upd.SetMinProgressSize(min_progress_size);
|
1984
|
+
return; // Out of lambda to enclosing function
|
1985
|
+
}
|
1986
|
+
} else {
|
1987
|
+
error = absl::get<grpc_error_handle>(r);
|
1988
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
1989
|
+
s->seen_error = true;
|
1990
|
+
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1991
|
+
break;
|
1992
|
+
} else {
|
1993
|
+
if (t->channelz_socket != nullptr) {
|
1994
|
+
t->channelz_socket->RecordMessageReceived();
|
1995
|
+
}
|
1996
|
+
break;
|
1997
|
+
}
|
1998
|
+
}
|
2072
1999
|
}
|
2000
|
+
} else if (s->read_closed) {
|
2001
|
+
s->recv_message->reset();
|
2002
|
+
} else {
|
2003
|
+
upd.SetMinProgressSize(GRPC_HEADER_SIZE_IN_BYTES);
|
2004
|
+
return; // Out of lambda to enclosing function
|
2073
2005
|
}
|
2074
2006
|
}
|
2075
2007
|
// save the length of the buffer before handing control back to application
|
2076
2008
|
// threads. Needed to support correct flow control bookkeeping
|
2077
|
-
s->
|
2078
|
-
s->unprocessed_incoming_frames_buffer.length;
|
2079
|
-
if (error == GRPC_ERROR_NONE && *s->recv_message != nullptr) {
|
2009
|
+
if (GRPC_ERROR_IS_NONE(error) && s->recv_message->has_value()) {
|
2080
2010
|
null_then_sched_closure(&s->recv_message_ready);
|
2081
2011
|
} else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
|
2082
|
-
*s->recv_message = nullptr;
|
2083
2012
|
if (s->call_failed_before_recv_message != nullptr) {
|
2084
2013
|
*s->call_failed_before_recv_message =
|
2085
2014
|
(s->published_metadata[1] != GRPC_METADATA_PUBLISHED_AT_CLOSE);
|
@@ -2087,7 +2016,10 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* /*t*/,
|
|
2087
2016
|
null_then_sched_closure(&s->recv_message_ready);
|
2088
2017
|
}
|
2089
2018
|
GRPC_ERROR_UNREF(error);
|
2090
|
-
}
|
2019
|
+
}();
|
2020
|
+
|
2021
|
+
upd.SetPendingSize(s->frame_storage.length);
|
2022
|
+
grpc_chttp2_act_on_flowctl_action(upd.MakeAction(), t, s);
|
2091
2023
|
}
|
2092
2024
|
|
2093
2025
|
void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
@@ -2097,26 +2029,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
|
2097
2029
|
s->write_closed) {
|
2098
2030
|
if (s->seen_error || !t->is_client) {
|
2099
2031
|
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
2100
|
-
if (!s->pending_byte_stream) {
|
2101
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
2102
|
-
&s->unprocessed_incoming_frames_buffer);
|
2103
|
-
}
|
2104
2032
|
}
|
2105
|
-
|
2106
|
-
s->unprocessed_incoming_frames_buffer.length > 0;
|
2107
|
-
if (s->read_closed && s->frame_storage.length > 0 && !pending_data &&
|
2108
|
-
!s->seen_error && s->recv_trailing_metadata_finished != nullptr) {
|
2109
|
-
// Maybe some SYNC_FLUSH data is left in frame_storage. Consume them and
|
2110
|
-
// maybe decompress the next 5 bytes in the stream.
|
2111
|
-
grpc_slice_buffer_move_first(
|
2112
|
-
&s->frame_storage,
|
2113
|
-
std::min(s->frame_storage.length, size_t(GRPC_HEADER_SIZE_IN_BYTES)),
|
2114
|
-
&s->unprocessed_incoming_frames_buffer);
|
2115
|
-
if (s->unprocessed_incoming_frames_buffer.length > 0) {
|
2116
|
-
pending_data = true;
|
2117
|
-
}
|
2118
|
-
}
|
2119
|
-
if (s->read_closed && s->frame_storage.length == 0 && !pending_data &&
|
2033
|
+
if (s->read_closed && s->frame_storage.length == 0 &&
|
2120
2034
|
s->recv_trailing_metadata_finished != nullptr) {
|
2121
2035
|
grpc_transport_move_stats(&s->stats, s->collecting_stats);
|
2122
2036
|
s->collecting_stats = nullptr;
|
@@ -2136,20 +2050,6 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
|
|
2136
2050
|
t->incoming_stream = nullptr;
|
2137
2051
|
grpc_chttp2_parsing_become_skip_parser(t);
|
2138
2052
|
}
|
2139
|
-
if (s->pending_byte_stream) {
|
2140
|
-
if (s->on_next != nullptr) {
|
2141
|
-
grpc_core::Chttp2IncomingByteStream* bs = s->data_parser.parsing_frame;
|
2142
|
-
if (error == GRPC_ERROR_NONE) {
|
2143
|
-
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
2144
|
-
}
|
2145
|
-
bs->PublishError(error);
|
2146
|
-
bs->Unref();
|
2147
|
-
s->data_parser.parsing_frame = nullptr;
|
2148
|
-
} else {
|
2149
|
-
GRPC_ERROR_UNREF(s->byte_stream_error);
|
2150
|
-
s->byte_stream_error = GRPC_ERROR_REF(error);
|
2151
|
-
}
|
2152
|
-
}
|
2153
2053
|
|
2154
2054
|
if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
2155
2055
|
post_benign_reclaimer(t);
|
@@ -2188,7 +2088,7 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|
2188
2088
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
|
2189
2089
|
}
|
2190
2090
|
}
|
2191
|
-
if (due_to_error
|
2091
|
+
if (!GRPC_ERROR_IS_NONE(due_to_error) && !s->seen_error) {
|
2192
2092
|
s->seen_error = true;
|
2193
2093
|
}
|
2194
2094
|
grpc_chttp2_mark_stream_closed(t, s, 1, 1, due_to_error);
|
@@ -2226,7 +2126,7 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|
2226
2126
|
|
2227
2127
|
static void add_error(grpc_error_handle error, grpc_error_handle* refs,
|
2228
2128
|
size_t* nrefs) {
|
2229
|
-
if (error
|
2129
|
+
if (GRPC_ERROR_IS_NONE(error)) return;
|
2230
2130
|
for (size_t i = 0; i < *nrefs; i++) {
|
2231
2131
|
if (error == refs[i]) {
|
2232
2132
|
return;
|
@@ -2283,8 +2183,7 @@ void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
|
2283
2183
|
GRPC_ERROR_REF(error),
|
2284
2184
|
"send_trailing_metadata_finished");
|
2285
2185
|
|
2286
|
-
s->
|
2287
|
-
grpc_chttp2_complete_closure_step(t, s, &s->fetching_send_message_finished,
|
2186
|
+
grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
|
2288
2187
|
GRPC_ERROR_REF(error),
|
2289
2188
|
"fetching_send_message_finished");
|
2290
2189
|
flush_write_list(t, s, &s->on_write_finished_cbs, GRPC_ERROR_REF(error));
|
@@ -2297,7 +2196,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|
2297
2196
|
if (s->read_closed && s->write_closed) {
|
2298
2197
|
// already closed, but we should still fake the status if needed.
|
2299
2198
|
grpc_error_handle overall_error = removal_error(error, s, "Stream removed");
|
2300
|
-
if (overall_error
|
2199
|
+
if (!GRPC_ERROR_IS_NONE(overall_error)) {
|
2301
2200
|
grpc_chttp2_fake_status(t, s, overall_error);
|
2302
2201
|
}
|
2303
2202
|
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
@@ -2325,7 +2224,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|
2325
2224
|
// Purge streams waiting on concurrency still waiting for id assignment
|
2326
2225
|
grpc_chttp2_list_remove_waiting_for_concurrency(t, s);
|
2327
2226
|
}
|
2328
|
-
if (overall_error
|
2227
|
+
if (!GRPC_ERROR_IS_NONE(overall_error)) {
|
2329
2228
|
grpc_chttp2_fake_status(t, s, overall_error);
|
2330
2229
|
}
|
2331
2230
|
}
|
@@ -2554,8 +2453,11 @@ void grpc_chttp2_act_on_flowctl_action(
|
|
2554
2453
|
const grpc_core::chttp2::FlowControlAction& action,
|
2555
2454
|
grpc_chttp2_transport* t, grpc_chttp2_stream* s) {
|
2556
2455
|
WithUrgency(t, action.send_stream_update(),
|
2557
|
-
GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL,
|
2558
|
-
|
2456
|
+
GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL, [t, s]() {
|
2457
|
+
if (s->id != 0) {
|
2458
|
+
grpc_chttp2_mark_stream_writable(t, s);
|
2459
|
+
}
|
2460
|
+
});
|
2559
2461
|
WithUrgency(t, action.send_transport_update(),
|
2560
2462
|
GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL, []() {});
|
2561
2463
|
WithUrgency(t, action.send_initial_window_update(),
|
@@ -2580,11 +2482,11 @@ static grpc_error_handle try_http_parsing(grpc_chttp2_transport* t) {
|
|
2580
2482
|
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
|
2581
2483
|
|
2582
2484
|
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
2583
|
-
for (; i < t->read_buffer.count && parse_error
|
2485
|
+
for (; i < t->read_buffer.count && GRPC_ERROR_IS_NONE(parse_error); i++) {
|
2584
2486
|
parse_error =
|
2585
2487
|
grpc_http_parser_parse(&parser, t->read_buffer.slices[i], nullptr);
|
2586
2488
|
}
|
2587
|
-
if (parse_error
|
2489
|
+
if (GRPC_ERROR_IS_NONE(parse_error) &&
|
2588
2490
|
(parse_error = grpc_http_parser_eof(&parser)) == GRPC_ERROR_NONE) {
|
2589
2491
|
error = grpc_error_set_int(
|
2590
2492
|
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
@@ -2615,7 +2517,7 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2615
2517
|
(void)GRPC_ERROR_REF(error);
|
2616
2518
|
|
2617
2519
|
grpc_error_handle err = error;
|
2618
|
-
if (err
|
2520
|
+
if (!GRPC_ERROR_IS_NONE(err)) {
|
2619
2521
|
err = grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
2620
2522
|
"Endpoint read failed", &err, 1),
|
2621
2523
|
GRPC_ERROR_INT_OCCURRED_DURING_WRITE,
|
@@ -2623,7 +2525,7 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2623
2525
|
}
|
2624
2526
|
std::swap(err, error);
|
2625
2527
|
GRPC_ERROR_UNREF(err);
|
2626
|
-
if (t->closed_with_error
|
2528
|
+
if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2627
2529
|
GPR_TIMER_SCOPE("reading_action.parse", 0);
|
2628
2530
|
size_t i = 0;
|
2629
2531
|
grpc_error_handle errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE,
|
@@ -2657,20 +2559,20 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2657
2559
|
|
2658
2560
|
GPR_TIMER_SCOPE("post_reading_action_locked", 0);
|
2659
2561
|
bool keep_reading = false;
|
2660
|
-
if (error
|
2562
|
+
if (GRPC_ERROR_IS_NONE(error) && !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2661
2563
|
error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
2662
2564
|
"Transport closed", &t->closed_with_error, 1);
|
2663
2565
|
}
|
2664
|
-
if (error
|
2566
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
2665
2567
|
// If a goaway frame was received, this might be the reason why the read
|
2666
2568
|
// failed. Add this info to the error
|
2667
|
-
if (t->goaway_error
|
2569
|
+
if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
|
2668
2570
|
error = grpc_error_add_child(error, GRPC_ERROR_REF(t->goaway_error));
|
2669
2571
|
}
|
2670
2572
|
|
2671
2573
|
close_transport_locked(t, GRPC_ERROR_REF(error));
|
2672
2574
|
t->endpoint_reading = 0;
|
2673
|
-
} else if (t->closed_with_error
|
2575
|
+
} else if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2674
2576
|
keep_reading = true;
|
2675
2577
|
// Since we have read a byte, reset the keepalive timer
|
2676
2578
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
|
@@ -2698,18 +2600,17 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2698
2600
|
}
|
2699
2601
|
|
2700
2602
|
static void continue_read_action_locked(grpc_chttp2_transport* t) {
|
2701
|
-
const bool urgent = t->goaway_error
|
2603
|
+
const bool urgent = !GRPC_ERROR_IS_NONE(t->goaway_error);
|
2702
2604
|
GRPC_CLOSURE_INIT(&t->read_action_locked, read_action, t,
|
2703
2605
|
grpc_schedule_on_exec_ctx);
|
2704
2606
|
grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent,
|
2705
2607
|
/*min_progress_size=*/1);
|
2706
|
-
grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t, nullptr);
|
2707
2608
|
}
|
2708
2609
|
|
2709
2610
|
// t is reffed prior to calling the first time, and once the callback chain
|
2710
2611
|
// that kicks off finishes, it's unreffed
|
2711
2612
|
void schedule_bdp_ping_locked(grpc_chttp2_transport* t) {
|
2712
|
-
t->flow_control
|
2613
|
+
t->flow_control.bdp_estimator()->SchedulePing();
|
2713
2614
|
send_ping_locked(
|
2714
2615
|
t,
|
2715
2616
|
GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked, start_bdp_ping, t,
|
@@ -2732,14 +2633,14 @@ static void start_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
|
2732
2633
|
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string.c_str(),
|
2733
2634
|
grpc_error_std_string(error).c_str());
|
2734
2635
|
}
|
2735
|
-
if (error
|
2636
|
+
if (!GRPC_ERROR_IS_NONE(error) || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2736
2637
|
return;
|
2737
2638
|
}
|
2738
2639
|
// Reset the keepalive ping timer
|
2739
2640
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
|
2740
2641
|
grpc_timer_cancel(&t->keepalive_ping_timer);
|
2741
2642
|
}
|
2742
|
-
t->flow_control
|
2643
|
+
t->flow_control.bdp_estimator()->StartPing();
|
2743
2644
|
t->bdp_ping_started = true;
|
2744
2645
|
}
|
2745
2646
|
|
@@ -2756,7 +2657,7 @@ static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
|
2756
2657
|
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string.c_str(),
|
2757
2658
|
grpc_error_std_string(error).c_str());
|
2758
2659
|
}
|
2759
|
-
if (error
|
2660
|
+
if (!GRPC_ERROR_IS_NONE(error) || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2760
2661
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2761
2662
|
return;
|
2762
2663
|
}
|
@@ -2770,8 +2671,8 @@ static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
|
2770
2671
|
}
|
2771
2672
|
t->bdp_ping_started = false;
|
2772
2673
|
grpc_core::Timestamp next_ping =
|
2773
|
-
t->flow_control
|
2774
|
-
grpc_chttp2_act_on_flowctl_action(t->flow_control
|
2674
|
+
t->flow_control.bdp_estimator()->CompletePing();
|
2675
|
+
grpc_chttp2_act_on_flowctl_action(t->flow_control.PeriodicUpdate(), t,
|
2775
2676
|
nullptr);
|
2776
2677
|
GPR_ASSERT(!t->have_next_bdp_ping_timer);
|
2777
2678
|
t->have_next_bdp_ping_timer = true;
|
@@ -2794,11 +2695,11 @@ static void next_bdp_ping_timer_expired_locked(void* tp,
|
|
2794
2695
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2795
2696
|
GPR_ASSERT(t->have_next_bdp_ping_timer);
|
2796
2697
|
t->have_next_bdp_ping_timer = false;
|
2797
|
-
if (error
|
2698
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
2798
2699
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2799
2700
|
return;
|
2800
2701
|
}
|
2801
|
-
if (t->flow_control
|
2702
|
+
if (t->flow_control.bdp_estimator()->accumulator() == 0) {
|
2802
2703
|
// Block the bdp ping till we receive more data.
|
2803
2704
|
t->bdp_ping_blocked = true;
|
2804
2705
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
@@ -2876,9 +2777,9 @@ static void init_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2876
2777
|
static void init_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2877
2778
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2878
2779
|
GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING);
|
2879
|
-
if (t->destroying || t->closed_with_error
|
2780
|
+
if (t->destroying || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2880
2781
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
|
2881
|
-
} else if (error
|
2782
|
+
} else if (GRPC_ERROR_IS_NONE(error)) {
|
2882
2783
|
if (t->keepalive_permit_without_calls ||
|
2883
2784
|
grpc_chttp2_stream_map_size(&t->stream_map) > 0) {
|
2884
2785
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING;
|
@@ -2915,7 +2816,7 @@ static void start_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2915
2816
|
|
2916
2817
|
static void start_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2917
2818
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2918
|
-
if (error
|
2819
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
2919
2820
|
return;
|
2920
2821
|
}
|
2921
2822
|
if (t->channelz_socket != nullptr) {
|
@@ -2944,7 +2845,7 @@ static void finish_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2944
2845
|
static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2945
2846
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2946
2847
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2947
|
-
if (error
|
2848
|
+
if (GRPC_ERROR_IS_NONE(error)) {
|
2948
2849
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
|
2949
2850
|
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
|
2950
2851
|
gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string.c_str());
|
@@ -2984,7 +2885,7 @@ static void keepalive_watchdog_fired_locked(void* arg,
|
|
2984
2885
|
grpc_error_handle error) {
|
2985
2886
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2986
2887
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2987
|
-
if (error
|
2888
|
+
if (GRPC_ERROR_IS_NONE(error)) {
|
2988
2889
|
gpr_log(GPR_INFO, "%s: Keepalive watchdog fired. Closing transport.",
|
2989
2890
|
t->peer_string.c_str());
|
2990
2891
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
|
@@ -3034,187 +2935,6 @@ static void set_pollset_set(grpc_transport* gt, grpc_stream* /*gs*/,
|
|
3034
2935
|
grpc_endpoint_add_to_pollset_set(t->ep, pollset_set);
|
3035
2936
|
}
|
3036
2937
|
|
3037
|
-
//
|
3038
|
-
// BYTE STREAM
|
3039
|
-
//
|
3040
|
-
|
3041
|
-
static void reset_byte_stream(void* arg, grpc_error_handle error) {
|
3042
|
-
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(arg);
|
3043
|
-
s->pending_byte_stream = false;
|
3044
|
-
if (error == GRPC_ERROR_NONE) {
|
3045
|
-
grpc_chttp2_maybe_complete_recv_message(s->t, s);
|
3046
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(s->t, s);
|
3047
|
-
} else {
|
3048
|
-
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
3049
|
-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, s->on_next, GRPC_ERROR_REF(error));
|
3050
|
-
s->on_next = nullptr;
|
3051
|
-
GRPC_ERROR_UNREF(s->byte_stream_error);
|
3052
|
-
s->byte_stream_error = GRPC_ERROR_NONE;
|
3053
|
-
grpc_chttp2_cancel_stream(s->t, s, GRPC_ERROR_REF(error));
|
3054
|
-
s->byte_stream_error = GRPC_ERROR_REF(error);
|
3055
|
-
}
|
3056
|
-
}
|
3057
|
-
|
3058
|
-
namespace grpc_core {
|
3059
|
-
|
3060
|
-
Chttp2IncomingByteStream::Chttp2IncomingByteStream(
|
3061
|
-
grpc_chttp2_transport* transport, grpc_chttp2_stream* stream,
|
3062
|
-
uint32_t frame_size, uint32_t flags)
|
3063
|
-
: ByteStream(frame_size, flags),
|
3064
|
-
transport_(transport),
|
3065
|
-
stream_(stream),
|
3066
|
-
refs_(2),
|
3067
|
-
remaining_bytes_(frame_size) {
|
3068
|
-
GRPC_ERROR_UNREF(stream->byte_stream_error);
|
3069
|
-
stream->byte_stream_error = GRPC_ERROR_NONE;
|
3070
|
-
}
|
3071
|
-
|
3072
|
-
void Chttp2IncomingByteStream::OrphanLocked(
|
3073
|
-
void* arg, grpc_error_handle /*error_ignored*/) {
|
3074
|
-
Chttp2IncomingByteStream* bs = static_cast<Chttp2IncomingByteStream*>(arg);
|
3075
|
-
grpc_chttp2_stream* s = bs->stream_;
|
3076
|
-
grpc_chttp2_transport* t = s->t;
|
3077
|
-
bs->Unref();
|
3078
|
-
s->pending_byte_stream = false;
|
3079
|
-
grpc_chttp2_maybe_complete_recv_message(t, s);
|
3080
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
3081
|
-
}
|
3082
|
-
|
3083
|
-
void Chttp2IncomingByteStream::Orphan() {
|
3084
|
-
GPR_TIMER_SCOPE("incoming_byte_stream_destroy", 0);
|
3085
|
-
transport_->combiner->Run(
|
3086
|
-
GRPC_CLOSURE_INIT(&destroy_action_,
|
3087
|
-
&Chttp2IncomingByteStream::OrphanLocked, this, nullptr),
|
3088
|
-
GRPC_ERROR_NONE);
|
3089
|
-
}
|
3090
|
-
|
3091
|
-
void Chttp2IncomingByteStream::NextLocked(void* arg,
|
3092
|
-
grpc_error_handle /*error_ignored*/) {
|
3093
|
-
Chttp2IncomingByteStream* bs = static_cast<Chttp2IncomingByteStream*>(arg);
|
3094
|
-
grpc_chttp2_transport* t = bs->transport_;
|
3095
|
-
grpc_chttp2_stream* s = bs->stream_;
|
3096
|
-
size_t cur_length = s->frame_storage.length;
|
3097
|
-
if (!s->read_closed) {
|
3098
|
-
s->flow_control->IncomingByteStreamUpdate(bs->next_action_.max_size_hint,
|
3099
|
-
cur_length);
|
3100
|
-
grpc_chttp2_act_on_flowctl_action(s->flow_control->MakeAction(), t, s);
|
3101
|
-
}
|
3102
|
-
GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0);
|
3103
|
-
if (s->frame_storage.length > 0) {
|
3104
|
-
grpc_slice_buffer_swap(&s->frame_storage,
|
3105
|
-
&s->unprocessed_incoming_frames_buffer);
|
3106
|
-
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete, GRPC_ERROR_NONE);
|
3107
|
-
} else if (s->byte_stream_error != GRPC_ERROR_NONE) {
|
3108
|
-
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
|
3109
|
-
GRPC_ERROR_REF(s->byte_stream_error));
|
3110
|
-
if (s->data_parser.parsing_frame != nullptr) {
|
3111
|
-
s->data_parser.parsing_frame->Unref();
|
3112
|
-
s->data_parser.parsing_frame = nullptr;
|
3113
|
-
}
|
3114
|
-
} else if (s->read_closed) {
|
3115
|
-
if (bs->remaining_bytes_ != 0) {
|
3116
|
-
s->byte_stream_error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
3117
|
-
"Truncated message", &s->read_closed_error, 1);
|
3118
|
-
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
|
3119
|
-
GRPC_ERROR_REF(s->byte_stream_error));
|
3120
|
-
if (s->data_parser.parsing_frame != nullptr) {
|
3121
|
-
s->data_parser.parsing_frame->Unref();
|
3122
|
-
s->data_parser.parsing_frame = nullptr;
|
3123
|
-
}
|
3124
|
-
} else {
|
3125
|
-
// Should never reach here.
|
3126
|
-
GPR_ASSERT(false);
|
3127
|
-
}
|
3128
|
-
} else {
|
3129
|
-
s->on_next = bs->next_action_.on_complete;
|
3130
|
-
}
|
3131
|
-
bs->Unref();
|
3132
|
-
}
|
3133
|
-
|
3134
|
-
bool Chttp2IncomingByteStream::Next(size_t max_size_hint,
|
3135
|
-
grpc_closure* on_complete) {
|
3136
|
-
GPR_TIMER_SCOPE("incoming_byte_stream_next", 0);
|
3137
|
-
if (stream_->unprocessed_incoming_frames_buffer.length > 0) {
|
3138
|
-
return true;
|
3139
|
-
} else {
|
3140
|
-
Ref();
|
3141
|
-
next_action_.max_size_hint = max_size_hint;
|
3142
|
-
next_action_.on_complete = on_complete;
|
3143
|
-
transport_->combiner->Run(
|
3144
|
-
GRPC_CLOSURE_INIT(&next_action_.closure,
|
3145
|
-
&Chttp2IncomingByteStream::NextLocked, this, nullptr),
|
3146
|
-
GRPC_ERROR_NONE);
|
3147
|
-
return false;
|
3148
|
-
}
|
3149
|
-
}
|
3150
|
-
|
3151
|
-
grpc_error_handle Chttp2IncomingByteStream::Pull(grpc_slice* slice) {
|
3152
|
-
GPR_TIMER_SCOPE("incoming_byte_stream_pull", 0);
|
3153
|
-
grpc_error_handle error;
|
3154
|
-
if (stream_->unprocessed_incoming_frames_buffer.length > 0) {
|
3155
|
-
error = grpc_deframe_unprocessed_incoming_frames(
|
3156
|
-
&stream_->data_parser, stream_,
|
3157
|
-
&stream_->unprocessed_incoming_frames_buffer, slice, nullptr);
|
3158
|
-
if (error != GRPC_ERROR_NONE) {
|
3159
|
-
return error;
|
3160
|
-
}
|
3161
|
-
} else {
|
3162
|
-
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
3163
|
-
stream_->t->combiner->Run(&stream_->reset_byte_stream,
|
3164
|
-
GRPC_ERROR_REF(error));
|
3165
|
-
return error;
|
3166
|
-
}
|
3167
|
-
return GRPC_ERROR_NONE;
|
3168
|
-
}
|
3169
|
-
|
3170
|
-
void Chttp2IncomingByteStream::PublishError(grpc_error_handle error) {
|
3171
|
-
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
3172
|
-
ExecCtx::Run(DEBUG_LOCATION, stream_->on_next, GRPC_ERROR_REF(error));
|
3173
|
-
stream_->on_next = nullptr;
|
3174
|
-
GRPC_ERROR_UNREF(stream_->byte_stream_error);
|
3175
|
-
stream_->byte_stream_error = GRPC_ERROR_REF(error);
|
3176
|
-
grpc_chttp2_cancel_stream(transport_, stream_, GRPC_ERROR_REF(error));
|
3177
|
-
}
|
3178
|
-
|
3179
|
-
grpc_error_handle Chttp2IncomingByteStream::Push(const grpc_slice& slice,
|
3180
|
-
grpc_slice* slice_out) {
|
3181
|
-
if (remaining_bytes_ < GRPC_SLICE_LENGTH(slice)) {
|
3182
|
-
grpc_error_handle error =
|
3183
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream");
|
3184
|
-
transport_->combiner->Run(&stream_->reset_byte_stream,
|
3185
|
-
GRPC_ERROR_REF(error));
|
3186
|
-
grpc_slice_unref_internal(slice);
|
3187
|
-
return error;
|
3188
|
-
} else {
|
3189
|
-
remaining_bytes_ -= static_cast<uint32_t> GRPC_SLICE_LENGTH(slice);
|
3190
|
-
if (slice_out != nullptr) {
|
3191
|
-
*slice_out = slice;
|
3192
|
-
}
|
3193
|
-
return GRPC_ERROR_NONE;
|
3194
|
-
}
|
3195
|
-
}
|
3196
|
-
|
3197
|
-
grpc_error_handle Chttp2IncomingByteStream::Finished(grpc_error_handle error,
|
3198
|
-
bool reset_on_error) {
|
3199
|
-
if (error == GRPC_ERROR_NONE) {
|
3200
|
-
if (remaining_bytes_ != 0) {
|
3201
|
-
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
3202
|
-
}
|
3203
|
-
}
|
3204
|
-
if (error != GRPC_ERROR_NONE && reset_on_error) {
|
3205
|
-
transport_->combiner->Run(&stream_->reset_byte_stream,
|
3206
|
-
GRPC_ERROR_REF(error));
|
3207
|
-
}
|
3208
|
-
Unref();
|
3209
|
-
return error;
|
3210
|
-
}
|
3211
|
-
|
3212
|
-
void Chttp2IncomingByteStream::Shutdown(grpc_error_handle error) {
|
3213
|
-
GRPC_ERROR_UNREF(Finished(error, true /* reset_on_error */));
|
3214
|
-
}
|
3215
|
-
|
3216
|
-
} // namespace grpc_core
|
3217
|
-
|
3218
2938
|
//
|
3219
2939
|
// RESOURCE QUOTAS
|
3220
2940
|
//
|
@@ -3261,7 +2981,7 @@ static void post_destructive_reclaimer(grpc_chttp2_transport* t) {
|
|
3261
2981
|
|
3262
2982
|
static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
|
3263
2983
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
3264
|
-
if (error
|
2984
|
+
if (GRPC_ERROR_IS_NONE(error) &&
|
3265
2985
|
grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
3266
2986
|
// Channel with no active streams: send a goaway to try and make it
|
3267
2987
|
// disconnect cleanly
|
@@ -3274,7 +2994,7 @@ static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
3274
2994
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Buffers full"),
|
3275
2995
|
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM),
|
3276
2996
|
/*immediate_disconnect_hint=*/true);
|
3277
|
-
} else if (error
|
2997
|
+
} else if (GRPC_ERROR_IS_NONE(error) &&
|
3278
2998
|
GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
3279
2999
|
gpr_log(GPR_INFO,
|
3280
3000
|
"HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
|
@@ -3293,7 +3013,7 @@ static void destructive_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
3293
3013
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
3294
3014
|
size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
|
3295
3015
|
t->destructive_reclaimer_registered = false;
|
3296
|
-
if (error
|
3016
|
+
if (GRPC_ERROR_IS_NONE(error) && n > 0) {
|
3297
3017
|
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
|
3298
3018
|
grpc_chttp2_stream_map_rand(&t->stream_map));
|
3299
3019
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|