grpc 1.46.2-x86_64-linux → 1.48.0.pre1-x86_64-linux
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 +138 -128
- data/include/grpc/compression.h +1 -1
- data/include/grpc/event_engine/event_engine.h +62 -18
- data/include/grpc/event_engine/memory_allocator.h +0 -15
- data/include/grpc/event_engine/port.h +1 -1
- data/include/grpc/event_engine/slice.h +286 -0
- data/include/grpc/event_engine/slice_buffer.h +118 -0
- data/include/grpc/grpc.h +3 -3
- data/include/grpc/grpc_security.h +11 -0
- 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 +106 -39
- data/include/grpc/impl/codegen/slice.h +1 -1
- data/src/core/ext/filters/census/grpc_context.cc +3 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +35 -35
- data/src/core/ext/filters/channel_idle/channel_idle_filter.h +20 -1
- data/src/core/ext/filters/channel_idle/idle_filter_state.h +2 -0
- data/src/core/ext/filters/client_channel/backend_metric.cc +17 -12
- data/src/core/ext/filters/client_channel/backend_metric.h +19 -9
- data/src/core/ext/filters/client_channel/backup_poller.cc +8 -6
- data/src/core/ext/filters/client_channel/backup_poller.h +2 -4
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +43 -21
- data/src/core/ext/filters/client_channel/client_channel.cc +111 -82
- data/src/core/ext/filters/client_channel/client_channel.h +43 -8
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +3 -5
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +12 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +5 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.h +8 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +4 -13
- data/src/core/ext/filters/client_channel/config_selector.cc +1 -0
- data/src/core/ext/filters/client_channel/config_selector.h +8 -6
- data/src/core/ext/filters/client_channel/connector.h +9 -3
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +19 -6
- data/src/core/ext/filters/client_channel/dynamic_filters.h +12 -2
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +2 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +3 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +14 -1
- data/src/core/ext/filters/client_channel/health/health_check_client.h +2 -0
- data/src/core/ext/filters/client_channel/http_proxy.cc +10 -2
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +49 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +12 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +11 -5
- 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 +132 -62
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +4 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +6 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +10 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +6 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +407 -0
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h +57 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +1036 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +149 -147
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +176 -85
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +303 -203
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +6 -1
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +92 -54
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +240 -214
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +119 -111
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +86 -71
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +101 -25
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +6 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +35 -11
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +36 -20
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +78 -14
- data/src/core/ext/filters/client_channel/lb_policy.cc +4 -2
- data/src/core/ext/filters/client_channel/lb_policy.h +18 -31
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +11 -6
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +6 -1
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +4 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +1 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.h +1 -1
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +1 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +5 -0
- data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +26 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +139 -48
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +10 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +6 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +36 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +13 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc +2 -0
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +39 -7
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +18 -19
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +5 -2
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +61 -16
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +14 -2
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +8 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +17 -12
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +111 -46
- 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 +12 -18
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +11 -5
- data/src/core/ext/filters/client_channel/retry_filter.cc +75 -36
- data/src/core/ext/filters/client_channel/retry_filter.h +1 -0
- data/src/core/ext/filters/client_channel/retry_service_config.cc +12 -13
- data/src/core/ext/filters/client_channel/retry_service_config.h +10 -1
- data/src/core/ext/filters/client_channel/retry_throttle.cc +1 -8
- data/src/core/ext/filters/client_channel/retry_throttle.h +7 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +24 -6
- data/src/core/ext/filters/client_channel/subchannel.cc +186 -187
- data/src/core/ext/filters/client_channel/subchannel.h +80 -36
- data/src/core/ext/filters/client_channel/subchannel_interface.h +51 -41
- data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +38 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +12 -2
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +6 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +24 -95
- data/src/core/ext/filters/client_channel/subchannel_stream_client.h +17 -9
- data/src/core/ext/filters/deadline/deadline_filter.cc +18 -9
- data/src/core/ext/filters/deadline/deadline_filter.h +8 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +22 -6
- 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 +30 -10
- data/src/core/ext/filters/http/client/http_client_filter.h +15 -2
- data/src/core/ext/filters/http/client_authority_filter.cc +16 -20
- data/src/core/ext/filters/http/client_authority_filter.h +5 -2
- data/src/core/ext/filters/http/http_filters_plugin.cc +16 -9
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +65 -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 +45 -107
- 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 +95 -255
- data/src/core/ext/filters/http/server/http_server_filter.h +37 -3
- data/src/core/ext/filters/message_size/message_size_filter.cc +45 -41
- data/src/core/ext/filters/message_size/message_size_filter.h +15 -2
- data/src/core/ext/filters/rbac/rbac_filter.cc +15 -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 +104 -138
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +9 -7
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +58 -29
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +2 -0
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -1
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +260 -491
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +6 -1
- data/src/core/ext/transport/chttp2/transport/context_list.cc +4 -0
- data/src/core/ext/transport/chttp2/transport/context_list.h +4 -1
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +145 -261
- data/src/core/ext/transport/chttp2/transport/flow_control.h +179 -288
- data/src/core/ext/transport/chttp2/transport/frame.h +0 -4
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +59 -211
- data/src/core/ext/transport/chttp2/transport/frame_data.h +13 -36
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +6 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +10 -42
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +4 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +10 -12
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +3 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +14 -12
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +15 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +3 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +32 -13
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +8 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +53 -37
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +38 -21
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +0 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +31 -112
- data/src/core/ext/transport/chttp2/transport/parsing.cc +77 -43
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +11 -11
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/stream_map.h +1 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +2 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +54 -21
- data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -1
- data/src/core/ext/transport/inproc/inproc_transport.cc +93 -86
- 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/upb-generated/xds/service/orca/v3/orca.upb.c +47 -0
- data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.h +109 -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 +6 -2
- data/src/core/ext/xds/certificate_provider_store.h +10 -1
- 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 +39 -26
- data/src/core/ext/xds/xds_bootstrap.h +11 -11
- data/src/core/ext/xds/xds_certificate_provider.cc +16 -4
- data/src/core/ext/xds/xds_certificate_provider.h +17 -2
- data/src/core/ext/xds/xds_channel_stack_modifier.cc +14 -5
- data/src/core/ext/xds/xds_channel_stack_modifier.h +5 -1
- data/src/core/ext/xds/xds_client.cc +121 -46
- data/src/core/ext/xds/xds_client.h +19 -4
- 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 +126 -25
- data/src/core/ext/xds/xds_cluster.h +12 -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 +10 -8
- 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 +70 -42
- 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 +56 -7
- 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 +60 -26
- data/src/core/lib/address_utils/sockaddr_utils.h +9 -4
- data/src/core/lib/avl/avl.h +6 -4
- data/src/core/lib/backoff/backoff.cc +1 -1
- data/src/core/lib/backoff/backoff.h +1 -1
- data/src/core/lib/channel/call_finalization.h +4 -0
- data/src/core/lib/channel/call_tracer.h +11 -5
- data/src/core/lib/channel/channel_args.cc +41 -22
- data/src/core/lib/channel/channel_args.h +34 -3
- data/src/core/lib/channel/channel_args_preconditioning.cc +4 -3
- data/src/core/lib/channel/channel_args_preconditioning.h +3 -2
- data/src/core/lib/channel/channel_fwd.h +26 -0
- data/src/core/lib/channel/channel_stack.cc +45 -7
- data/src/core/lib/channel/channel_stack.h +45 -9
- data/src/core/lib/channel/channel_stack_builder.cc +9 -19
- data/src/core/lib/channel/channel_stack_builder.h +17 -32
- data/src/core/lib/channel/channel_stack_builder_impl.cc +38 -43
- data/src/core/lib/channel/channel_stack_builder_impl.h +4 -6
- data/src/core/lib/channel/channel_trace.cc +8 -13
- data/src/core/lib/channel/channel_trace.h +6 -3
- data/src/core/lib/channel/channelz.cc +10 -14
- data/src/core/lib/channel/channelz.h +15 -7
- data/src/core/lib/channel/channelz_registry.cc +11 -19
- data/src/core/lib/channel/channelz_registry.h +10 -9
- data/src/core/lib/channel/connected_channel.cc +22 -31
- data/src/core/lib/channel/connected_channel.h +2 -0
- data/src/core/lib/channel/promise_based_filter.cc +451 -190
- data/src/core/lib/channel/promise_based_filter.h +162 -27
- data/src/core/lib/channel/status_util.cc +2 -0
- data/src/core/lib/channel/status_util.h +0 -3
- data/src/core/lib/compression/compression.cc +6 -1
- data/src/core/lib/compression/compression_internal.cc +48 -16
- data/src/core/lib/compression/compression_internal.h +4 -3
- data/src/core/lib/compression/message_compress.cc +3 -1
- data/src/core/lib/compression/message_compress.h +2 -3
- data/src/core/lib/config/core_configuration.cc +3 -0
- data/src/core/lib/config/core_configuration.h +2 -1
- 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/channel_args_endpoint_config.cc +4 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +3 -2
- data/src/core/lib/event_engine/default_event_engine_factory.cc +8 -2
- data/src/core/lib/event_engine/event_engine.cc +29 -14
- data/src/core/lib/event_engine/event_engine_factory.h +5 -0
- data/src/core/lib/event_engine/handle_containers.h +67 -0
- data/src/core/lib/event_engine/iomgr_engine/iomgr_engine.cc +159 -0
- data/src/core/lib/event_engine/iomgr_engine/iomgr_engine.h +122 -0
- 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/memory_allocator.cc +12 -4
- data/src/core/lib/{iomgr/event_engine → event_engine}/promise.h +27 -9
- data/src/core/lib/event_engine/resolved_address.cc +4 -2
- data/src/core/lib/event_engine/slice.cc +102 -0
- data/src/core/lib/event_engine/slice_buffer.cc +50 -0
- data/src/core/lib/{iomgr/event_engine/pollset.h → event_engine/trace.cc} +3 -10
- data/src/core/lib/{iomgr/endpoint_pair_event_engine.cc → event_engine/trace.h} +12 -14
- data/src/core/lib/gpr/log.cc +5 -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/gpr/tls.h +3 -5
- data/src/core/lib/gprpp/bitset.h +5 -1
- data/src/core/lib/gprpp/chunked_vector.h +4 -0
- data/src/core/lib/gprpp/construct_destruct.h +1 -0
- data/src/core/lib/gprpp/dual_ref_counted.h +1 -4
- data/src/core/lib/gprpp/examine_stack.h +0 -1
- data/src/core/lib/gprpp/fork.cc +3 -6
- data/src/core/lib/gprpp/global_config.h +2 -4
- data/src/core/lib/gprpp/global_config_env.cc +3 -2
- data/src/core/lib/gprpp/global_config_env.h +3 -1
- data/src/core/lib/gprpp/global_config_generic.h +0 -4
- data/src/core/lib/gprpp/host_port.cc +2 -0
- data/src/core/lib/gprpp/manual_constructor.h +0 -68
- data/src/core/lib/gprpp/match.h +2 -0
- data/src/core/lib/gprpp/memory.h +1 -5
- data/src/core/lib/gprpp/orphanable.h +1 -4
- data/src/core/lib/gprpp/ref_counted.h +1 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +1 -1
- data/src/core/lib/gprpp/stat.h +0 -2
- data/src/core/lib/gprpp/stat_posix.cc +7 -2
- data/src/core/lib/gprpp/status_helper.cc +50 -32
- data/src/core/lib/gprpp/status_helper.h +4 -0
- data/src/core/lib/gprpp/sync.h +3 -1
- data/src/core/lib/gprpp/table.h +10 -0
- data/src/core/lib/gprpp/thd.h +2 -5
- data/src/core/lib/gprpp/thd_posix.cc +4 -2
- data/src/core/lib/gprpp/thd_windows.cc +2 -0
- data/src/core/lib/gprpp/time.cc +16 -0
- data/src/core/lib/gprpp/time.h +10 -1
- data/src/core/lib/gprpp/time_util.cc +4 -0
- data/src/core/lib/gprpp/time_util.h +1 -1
- data/src/core/lib/gprpp/unique_type_name.h +104 -0
- data/src/core/lib/http/format_request.cc +34 -4
- data/src/core/lib/http/format_request.h +3 -1
- data/src/core/lib/http/httpcli.cc +106 -93
- data/src/core/lib/http/httpcli.h +58 -10
- data/src/core/lib/http/httpcli_security_connector.cc +19 -8
- 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.cc +4 -4
- data/src/core/lib/iomgr/endpoint.h +7 -5
- data/src/core/lib/iomgr/endpoint_cfstream.cc +9 -6
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -1
- 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 +55 -96
- data/src/core/lib/iomgr/ev_posix.h +5 -3
- data/src/core/lib/iomgr/exec_ctx.h +1 -2
- data/src/core/lib/iomgr/fork_posix.cc +1 -1
- data/src/core/lib/iomgr/internal_errqueue.cc +38 -47
- data/src/core/lib/iomgr/internal_errqueue.h +1 -6
- data/src/core/lib/iomgr/iomgr.cc +7 -1
- data/src/core/{ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_event_engine.cc → lib/iomgr/iomgr_fwd.h} +9 -12
- 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/pollset_set.h +1 -2
- data/src/core/lib/iomgr/port.h +25 -6
- data/src/core/lib/iomgr/resolve_address.cc +8 -0
- data/src/core/lib/iomgr/resolve_address.h +21 -14
- data/src/core/lib/iomgr/resolve_address_impl.h +2 -3
- data/src/core/lib/iomgr/resolve_address_posix.cc +9 -15
- data/src/core/lib/iomgr/resolve_address_posix.h +5 -2
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -15
- data/src/core/lib/iomgr/resolve_address_windows.h +5 -2
- data/src/core/lib/iomgr/sockaddr.h +2 -3
- data/src/core/lib/iomgr/sockaddr_posix.h +2 -0
- data/src/core/lib/iomgr/sockaddr_windows.h +2 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +3 -2
- 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 +24 -10
- data/src/core/lib/iomgr/tcp_client_posix.cc +154 -29
- data/src/core/lib/iomgr/tcp_client_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_client_windows.cc +27 -16
- data/src/core/lib/iomgr/tcp_posix.cc +96 -52
- data/src/core/lib/iomgr/tcp_server_posix.cc +33 -19
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +41 -38
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +9 -6
- data/src/core/lib/iomgr/tcp_server_windows.cc +20 -12
- data/src/core/lib/iomgr/tcp_windows.cc +12 -9
- 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/json/json.h +1 -2
- data/src/core/lib/json/json_reader.cc +9 -1
- data/src/core/lib/json/json_util.cc +7 -0
- data/src/core/lib/json/json_util.h +10 -1
- data/src/core/lib/json/json_writer.cc +6 -1
- 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 +1 -2
- data/src/core/lib/promise/activity.h +13 -19
- data/src/core/lib/promise/arena_promise.h +11 -1
- data/src/core/lib/promise/call_push_pull.h +4 -0
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/detail/basic_seq.h +2 -2
- data/src/core/lib/promise/detail/promise_factory.h +0 -1
- data/src/core/lib/promise/latch.h +0 -1
- data/src/core/lib/promise/loop.h +2 -0
- data/src/core/lib/promise/promise.h +1 -0
- data/src/core/lib/promise/race.h +0 -1
- data/src/core/lib/promise/seq.h +0 -2
- data/src/core/lib/promise/sleep.cc +38 -31
- data/src/core/lib/promise/sleep.h +32 -22
- data/src/core/lib/promise/try_seq.h +2 -2
- 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 +6 -4
- 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 +17 -3
- data/src/core/lib/resolver/server_address.h +13 -6
- data/src/core/lib/resource_quota/api.cc +14 -1
- data/src/core/lib/resource_quota/api.h +4 -1
- data/src/core/lib/resource_quota/arena.cc +0 -6
- data/src/core/lib/resource_quota/arena.h +1 -2
- data/src/core/lib/resource_quota/memory_quota.cc +62 -62
- data/src/core/lib/resource_quota/memory_quota.h +35 -30
- data/src/core/lib/resource_quota/resource_quota.h +8 -0
- data/src/core/lib/resource_quota/thread_quota.cc +2 -0
- data/src/core/lib/resource_quota/thread_quota.h +4 -0
- 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 +15 -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 +12 -4
- data/src/core/lib/security/credentials/alts/alts_credentials.h +8 -3
- 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 +10 -0
- data/src/core/lib/security/credentials/call_creds_util.h +1 -0
- data/src/core/lib/security/credentials/channel_creds_registry.h +7 -1
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +10 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +11 -7
- data/src/core/lib/security/credentials/composite/composite_credentials.h +21 -6
- data/src/core/lib/security/credentials/credentials.cc +4 -8
- data/src/core/lib/security/credentials/credentials.h +27 -18
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +108 -9
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +18 -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 +27 -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 +22 -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 +21 -9
- data/src/core/lib/security/credentials/fake/fake_credentials.h +15 -3
- 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 +51 -24
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +12 -3
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +13 -4
- data/src/core/lib/security/credentials/iam/iam_credentials.h +12 -2
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +12 -2
- data/src/core/lib/security/credentials/insecure/insecure_credentials.h +9 -4
- 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 +14 -7
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +16 -2
- 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 +12 -5
- data/src/core/lib/security/credentials/local/local_credentials.h +9 -2
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +36 -19
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +24 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +12 -8
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +25 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +13 -2
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +17 -4
- 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 +39 -10
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +14 -11
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +35 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +34 -11
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +4 -5
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +17 -2
- data/src/core/lib/security/credentials/tls/tls_credentials.h +7 -3
- 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 +20 -4
- data/src/core/lib/security/credentials/xds/xds_credentials.h +19 -5
- 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 +18 -2
- 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 +19 -7
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +19 -7
- 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 +24 -17
- data/src/core/lib/security/transport/secure_endpoint.cc +81 -20
- data/src/core/lib/security/transport/secure_endpoint.h +4 -3
- data/src/core/lib/security/transport/security_handshaker.cc +49 -16
- data/src/core/lib/security/transport/security_handshaker.h +5 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +29 -6
- 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.h +4 -8
- data/src/core/lib/service_config/service_config_call_data.h +6 -2
- data/src/core/lib/service_config/service_config_impl.cc +13 -6
- data/src/core/lib/service_config/service_config_impl.h +9 -4
- data/src/core/lib/service_config/service_config_parser.cc +8 -2
- data/src/core/lib/service_config/service_config_parser.h +7 -0
- data/src/core/lib/slice/b64.cc +1 -1
- data/src/core/lib/slice/b64.h +2 -0
- data/src/core/lib/slice/percent_encoding.cc +4 -1
- data/src/core/lib/slice/percent_encoding.h +0 -6
- data/src/core/lib/slice/slice.cc +2 -1
- data/src/core/lib/slice/slice.h +10 -5
- data/src/core/lib/slice/slice_api.cc +1 -1
- data/src/core/lib/slice/slice_buffer.cc +79 -23
- data/src/core/lib/slice/slice_buffer.h +137 -0
- data/src/core/lib/slice/slice_buffer_api.cc +35 -0
- data/src/core/lib/slice/slice_internal.h +4 -3
- data/src/core/lib/slice/slice_refcount.h +2 -3
- data/src/core/lib/slice/slice_refcount_base.h +2 -3
- data/src/core/lib/slice/slice_string_helpers.cc +0 -16
- data/src/core/lib/slice/slice_string_helpers.h +1 -8
- data/src/core/lib/surface/builtins.cc +7 -2
- data/src/core/lib/surface/byte_buffer.cc +7 -1
- data/src/core/lib/surface/byte_buffer_reader.cc +4 -4
- data/src/core/lib/surface/call.cc +90 -137
- data/src/core/lib/surface/call.h +21 -3
- data/src/core/lib/surface/call_details.cc +4 -4
- data/src/core/lib/surface/call_log_batch.cc +7 -1
- data/src/core/lib/surface/call_test_only.h +4 -1
- data/src/core/lib/surface/channel.cc +179 -242
- data/src/core/lib/surface/channel.h +97 -58
- data/src/core/lib/surface/channel_init.h +2 -0
- data/src/core/lib/surface/channel_ping.cc +8 -2
- data/src/core/lib/surface/channel_stack_type.cc +0 -2
- data/src/core/lib/surface/channel_stack_type.h +0 -2
- data/src/core/lib/surface/completion_queue.cc +29 -20
- data/src/core/lib/surface/completion_queue.h +7 -2
- data/src/core/lib/surface/completion_queue_factory.cc +1 -0
- data/src/core/lib/surface/completion_queue_factory.h +1 -3
- data/src/core/lib/surface/event_string.cc +1 -7
- data/src/core/lib/surface/event_string.h +1 -1
- data/src/core/lib/surface/init.cc +17 -46
- data/src/core/lib/surface/init.h +0 -8
- data/src/core/lib/surface/lame_client.cc +63 -109
- data/src/core/lib/surface/lame_client.h +41 -3
- data/src/core/lib/surface/metadata_array.cc +2 -0
- data/src/core/lib/surface/server.cc +83 -64
- data/src/core/lib/surface/server.h +42 -9
- data/src/core/lib/surface/validate_metadata.cc +3 -6
- data/src/core/lib/surface/validate_metadata.h +3 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +3 -1
- data/src/core/lib/transport/bdp_estimator.h +2 -3
- data/src/core/lib/transport/connectivity_state.cc +6 -4
- data/src/core/lib/transport/connectivity_state.h +2 -3
- data/src/core/lib/transport/error_utils.cc +16 -8
- data/src/core/lib/transport/error_utils.h +5 -1
- data/src/core/lib/{channel → transport}/handshaker.cc +12 -7
- data/src/core/lib/{channel → transport}/handshaker.h +13 -6
- data/src/core/lib/{channel → transport}/handshaker_factory.h +9 -10
- data/src/core/lib/{channel → transport}/handshaker_registry.cc +5 -1
- data/src/core/lib/{channel → transport}/handshaker_registry.h +5 -4
- data/src/core/{ext/filters/client_channel → lib/transport}/http_connect_handshaker.cc +28 -14
- data/src/core/{ext/filters/client_channel → lib/transport}/http_connect_handshaker.h +3 -3
- data/src/core/lib/transport/metadata_batch.cc +287 -0
- data/src/core/lib/transport/metadata_batch.h +133 -264
- data/src/core/lib/transport/parsed_metadata.cc +2 -0
- data/src/core/lib/transport/parsed_metadata.h +10 -3
- data/src/core/lib/transport/status_conversion.cc +2 -0
- data/src/core/lib/transport/status_conversion.h +2 -2
- data/src/core/lib/transport/tcp_connect_handshaker.cc +253 -0
- data/src/core/lib/transport/tcp_connect_handshaker.h +39 -0
- data/src/core/lib/transport/timeout_encoding.cc +2 -6
- data/src/core/lib/transport/timeout_encoding.h +5 -1
- data/src/core/lib/transport/transport.cc +18 -20
- data/src/core/lib/transport/transport.h +48 -16
- data/src/core/lib/transport/transport_fwd.h +20 -0
- data/src/core/lib/transport/transport_impl.h +11 -0
- data/src/core/lib/transport/transport_op_string.cc +17 -18
- data/src/core/lib/uri/uri_parser.cc +11 -3
- data/src/core/lib/uri/uri_parser.h +0 -2
- data/src/core/plugin_registry/grpc_plugin_registry.cc +11 -0
- 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/session_cache/ssl_session.h +2 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +2 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +2 -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 +50 -19
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
- data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/errors.rb +1 -1
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- 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 +510 -0
- 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 +69 -38
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_event_engine.cc +0 -31
- data/src/core/lib/event_engine/sockaddr.cc +0 -40
- data/src/core/lib/event_engine/sockaddr.h +0 -44
- data/src/core/lib/gprpp/capture.h +0 -76
- data/src/core/lib/iomgr/event_engine/closure.cc +0 -77
- data/src/core/lib/iomgr/event_engine/closure.h +0 -42
- data/src/core/lib/iomgr/event_engine/endpoint.cc +0 -172
- data/src/core/lib/iomgr/event_engine/endpoint.h +0 -52
- data/src/core/lib/iomgr/event_engine/iomgr.cc +0 -85
- data/src/core/lib/iomgr/event_engine/pollset.cc +0 -87
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +0 -47
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +0 -37
- data/src/core/lib/iomgr/event_engine/resolver.cc +0 -133
- data/src/core/lib/iomgr/event_engine/resolver.h +0 -56
- data/src/core/lib/iomgr/event_engine/tcp.cc +0 -296
- data/src/core/lib/iomgr/event_engine/timer.cc +0 -62
- data/src/core/lib/slice/slice_split.cc +0 -100
- data/src/core/lib/slice/slice_split.h +0 -40
- data/src/core/lib/transport/byte_stream.cc +0 -164
- data/src/core/lib/transport/byte_stream.h +0 -166
- data/third_party/abseil-cpp/absl/container/internal/have_sse.h +0 -50
@@ -20,49 +20,84 @@
|
|
20
20
|
|
21
21
|
#include <inttypes.h>
|
22
22
|
#include <limits.h>
|
23
|
-
#include <math.h>
|
24
23
|
#include <stdio.h>
|
24
|
+
#include <stdlib.h>
|
25
25
|
#include <string.h>
|
26
26
|
|
27
|
+
#include <algorithm>
|
28
|
+
#include <memory>
|
29
|
+
#include <new>
|
30
|
+
#include <string>
|
31
|
+
#include <utility>
|
32
|
+
|
33
|
+
#include "absl/base/attributes.h"
|
34
|
+
#include "absl/status/status.h"
|
35
|
+
#include "absl/strings/cord.h"
|
36
|
+
#include "absl/strings/str_cat.h"
|
27
37
|
#include "absl/strings/str_format.h"
|
38
|
+
#include "absl/strings/string_view.h"
|
39
|
+
#include "absl/types/optional.h"
|
40
|
+
#include "absl/types/variant.h"
|
28
41
|
|
42
|
+
#include <grpc/impl/codegen/connectivity_state.h>
|
29
43
|
#include <grpc/slice_buffer.h>
|
30
44
|
#include <grpc/status.h>
|
31
45
|
#include <grpc/support/alloc.h>
|
46
|
+
#include <grpc/support/atm.h>
|
32
47
|
#include <grpc/support/log.h>
|
33
|
-
#include <grpc/support/string_util.h>
|
34
48
|
|
35
49
|
#include "src/core/ext/transport/chttp2/transport/context_list.h"
|
50
|
+
#include "src/core/ext/transport/chttp2/transport/flow_control.h"
|
51
|
+
#include "src/core/ext/transport/chttp2/transport/frame.h"
|
36
52
|
#include "src/core/ext/transport/chttp2/transport/frame_data.h"
|
53
|
+
#include "src/core/ext/transport/chttp2/transport/frame_goaway.h"
|
54
|
+
#include "src/core/ext/transport/chttp2/transport/frame_rst_stream.h"
|
55
|
+
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
|
56
|
+
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
|
37
57
|
#include "src/core/ext/transport/chttp2/transport/internal.h"
|
58
|
+
#include "src/core/ext/transport/chttp2/transport/stream_map.h"
|
38
59
|
#include "src/core/ext/transport/chttp2/transport/varint.h"
|
39
60
|
#include "src/core/lib/channel/channel_args.h"
|
40
61
|
#include "src/core/lib/debug/stats.h"
|
41
|
-
#include "src/core/lib/gpr/
|
42
|
-
#include "src/core/lib/
|
43
|
-
#include "src/core/lib/gprpp/
|
62
|
+
#include "src/core/lib/gpr/useful.h"
|
63
|
+
#include "src/core/lib/gprpp/bitset.h"
|
64
|
+
#include "src/core/lib/gprpp/debug_location.h"
|
65
|
+
#include "src/core/lib/gprpp/global_config_env.h"
|
66
|
+
#include "src/core/lib/gprpp/ref_counted.h"
|
67
|
+
#include "src/core/lib/gprpp/status_helper.h"
|
68
|
+
#include "src/core/lib/gprpp/time.h"
|
44
69
|
#include "src/core/lib/http/parser.h"
|
45
|
-
#include "src/core/lib/iomgr/
|
46
|
-
#include "src/core/lib/iomgr/
|
70
|
+
#include "src/core/lib/iomgr/combiner.h"
|
71
|
+
#include "src/core/lib/iomgr/error.h"
|
72
|
+
#include "src/core/lib/iomgr/exec_ctx.h"
|
73
|
+
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
74
|
+
#include "src/core/lib/iomgr/pollset.h"
|
47
75
|
#include "src/core/lib/iomgr/timer.h"
|
48
76
|
#include "src/core/lib/profiling/timers.h"
|
77
|
+
#include "src/core/lib/promise/poll.h"
|
49
78
|
#include "src/core/lib/resource_quota/api.h"
|
79
|
+
#include "src/core/lib/resource_quota/arena.h"
|
80
|
+
#include "src/core/lib/resource_quota/memory_quota.h"
|
81
|
+
#include "src/core/lib/resource_quota/resource_quota.h"
|
50
82
|
#include "src/core/lib/resource_quota/trace.h"
|
83
|
+
#include "src/core/lib/slice/slice.h"
|
84
|
+
#include "src/core/lib/slice/slice_buffer.h"
|
51
85
|
#include "src/core/lib/slice/slice_internal.h"
|
52
|
-
#include "src/core/lib/slice/
|
86
|
+
#include "src/core/lib/slice/slice_refcount.h"
|
87
|
+
#include "src/core/lib/transport/bdp_estimator.h"
|
88
|
+
#include "src/core/lib/transport/connectivity_state.h"
|
53
89
|
#include "src/core/lib/transport/error_utils.h"
|
54
90
|
#include "src/core/lib/transport/http2_errors.h"
|
91
|
+
#include "src/core/lib/transport/metadata_batch.h"
|
55
92
|
#include "src/core/lib/transport/status_conversion.h"
|
56
|
-
#include "src/core/lib/transport/timeout_encoding.h"
|
57
93
|
#include "src/core/lib/transport/transport.h"
|
58
94
|
#include "src/core/lib/transport/transport_impl.h"
|
59
|
-
#include "src/core/lib/uri/uri_parser.h"
|
60
95
|
|
61
96
|
GPR_GLOBAL_CONFIG_DEFINE_BOOL(
|
62
|
-
|
63
|
-
"If set,
|
64
|
-
"
|
65
|
-
"
|
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.");
|
66
101
|
|
67
102
|
#define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024)
|
68
103
|
#define MAX_WINDOW 0x7fffffffu
|
@@ -116,8 +151,6 @@ static void read_action(void* t, grpc_error_handle error);
|
|
116
151
|
static void read_action_locked(void* t, grpc_error_handle error);
|
117
152
|
static void continue_read_action_locked(grpc_chttp2_transport* t);
|
118
153
|
|
119
|
-
static void complete_fetch(void* gs, grpc_error_handle error);
|
120
|
-
static void complete_fetch_locked(void* gs, grpc_error_handle error);
|
121
154
|
// Set a transport level setting, and push it to our peer
|
122
155
|
static void queue_setting_update(grpc_chttp2_transport* t,
|
123
156
|
grpc_chttp2_setting_id id, uint32_t value);
|
@@ -167,8 +200,6 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error);
|
|
167
200
|
static void keepalive_watchdog_fired(void* arg, grpc_error_handle error);
|
168
201
|
static void keepalive_watchdog_fired_locked(void* arg, grpc_error_handle error);
|
169
202
|
|
170
|
-
static void reset_byte_stream(void* arg, grpc_error_handle error);
|
171
|
-
|
172
203
|
namespace grpc_core {
|
173
204
|
|
174
205
|
namespace {
|
@@ -245,8 +276,6 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
|
|
245
276
|
write_cb_pool = next;
|
246
277
|
}
|
247
278
|
|
248
|
-
flow_control.Destroy();
|
249
|
-
|
250
279
|
GRPC_ERROR_UNREF(closed_with_error);
|
251
280
|
gpr_free(ping_acks);
|
252
281
|
if (grpc_core::test_only_destruct_callback != nullptr) {
|
@@ -256,11 +285,9 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
|
|
256
285
|
|
257
286
|
static const grpc_transport_vtable* get_vtable(void);
|
258
287
|
|
259
|
-
|
260
|
-
static bool read_channel_args(grpc_chttp2_transport* t,
|
288
|
+
static void read_channel_args(grpc_chttp2_transport* t,
|
261
289
|
const grpc_channel_args* channel_args,
|
262
290
|
bool is_client) {
|
263
|
-
bool enable_bdp = true;
|
264
291
|
bool channelz_enabled = GRPC_ENABLE_CHANNELZ_DEFAULT;
|
265
292
|
size_t i;
|
266
293
|
int j;
|
@@ -310,9 +337,6 @@ static bool read_channel_args(grpc_chttp2_transport* t,
|
|
310
337
|
GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE)) {
|
311
338
|
t->write_buffer_size = static_cast<uint32_t>(grpc_channel_arg_get_integer(
|
312
339
|
&channel_args->args[i], {0, 0, MAX_WRITE_BUFFER_SIZE}));
|
313
|
-
} else if (0 ==
|
314
|
-
strcmp(channel_args->args[i].key, GRPC_ARG_HTTP2_BDP_PROBE)) {
|
315
|
-
enable_bdp = grpc_channel_arg_get_bool(&channel_args->args[i], true);
|
316
340
|
} else if (0 ==
|
317
341
|
strcmp(channel_args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) {
|
318
342
|
const int value = grpc_channel_arg_get_integer(
|
@@ -404,7 +428,6 @@ static bool read_channel_args(grpc_chttp2_transport* t,
|
|
404
428
|
grpc_core::channelz::SocketNode::Security::GetFromChannelArgs(
|
405
429
|
channel_args));
|
406
430
|
}
|
407
|
-
return enable_bdp;
|
408
431
|
}
|
409
432
|
|
410
433
|
static void init_transport_keepalive_settings(grpc_chttp2_transport* t) {
|
@@ -475,6 +498,10 @@ grpc_chttp2_transport::grpc_chttp2_transport(
|
|
475
498
|
GRPC_CHANNEL_READY),
|
476
499
|
is_client(is_client),
|
477
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),
|
478
505
|
deframe_state(is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0) {
|
479
506
|
GPR_ASSERT(strlen(GRPC_CHTTP2_CLIENT_CONNECT_STRING) ==
|
480
507
|
GRPC_CHTTP2_CLIENT_CONNECT_STRLEN);
|
@@ -516,19 +543,8 @@ grpc_chttp2_transport::grpc_chttp2_transport(
|
|
516
543
|
configure_transport_ping_policy(this);
|
517
544
|
init_transport_keepalive_settings(this);
|
518
545
|
|
519
|
-
|
520
|
-
|
521
|
-
enable_bdp = read_channel_args(this, channel_args, is_client);
|
522
|
-
}
|
523
|
-
|
524
|
-
static const bool kEnableFlowControl =
|
525
|
-
!GPR_GLOBAL_CONFIG_GET(grpc_experimental_disable_flow_control);
|
526
|
-
if (kEnableFlowControl) {
|
527
|
-
flow_control.Init<grpc_core::chttp2::TransportFlowControl>(this,
|
528
|
-
enable_bdp);
|
529
|
-
} else {
|
530
|
-
flow_control.Init<grpc_core::chttp2::TransportFlowControlDisabled>(this);
|
531
|
-
enable_bdp = false;
|
546
|
+
if (channel_args != nullptr) {
|
547
|
+
read_channel_args(this, channel_args, is_client);
|
532
548
|
}
|
533
549
|
|
534
550
|
// No pings allowed before receiving a header or data frame.
|
@@ -541,9 +557,9 @@ grpc_chttp2_transport::grpc_chttp2_transport(
|
|
541
557
|
|
542
558
|
init_keepalive_pings_if_enabled(this);
|
543
559
|
|
544
|
-
if (
|
560
|
+
if (flow_control.bdp_probe()) {
|
545
561
|
bdp_ping_blocked = true;
|
546
|
-
grpc_chttp2_act_on_flowctl_action(flow_control
|
562
|
+
grpc_chttp2_act_on_flowctl_action(flow_control.PeriodicUpdate(), this,
|
547
563
|
nullptr);
|
548
564
|
}
|
549
565
|
|
@@ -576,13 +592,13 @@ static void close_transport_locked(grpc_chttp2_transport* t,
|
|
576
592
|
grpc_error_handle error) {
|
577
593
|
end_all_the_calls(t, GRPC_ERROR_REF(error));
|
578
594
|
cancel_pings(t, GRPC_ERROR_REF(error));
|
579
|
-
if (t->closed_with_error
|
595
|
+
if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
580
596
|
if (!grpc_error_has_clear_grpc_status(error)) {
|
581
597
|
error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS,
|
582
598
|
GRPC_STATUS_UNAVAILABLE);
|
583
599
|
}
|
584
600
|
if (t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
585
|
-
if (t->close_transport_on_writes_finished
|
601
|
+
if (GRPC_ERROR_IS_NONE(t->close_transport_on_writes_finished)) {
|
586
602
|
t->close_transport_on_writes_finished =
|
587
603
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
588
604
|
"Delayed close due to in-progress write");
|
@@ -591,7 +607,7 @@ static void close_transport_locked(grpc_chttp2_transport* t,
|
|
591
607
|
grpc_error_add_child(t->close_transport_on_writes_finished, error);
|
592
608
|
return;
|
593
609
|
}
|
594
|
-
GPR_ASSERT(error
|
610
|
+
GPR_ASSERT(!GRPC_ERROR_IS_NONE(error));
|
595
611
|
t->closed_with_error = GRPC_ERROR_REF(error);
|
596
612
|
connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN, absl::Status(),
|
597
613
|
"close_transport");
|
@@ -668,29 +684,23 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
|
|
668
684
|
refcount(refcount),
|
669
685
|
reffer(this),
|
670
686
|
initial_metadata_buffer(arena),
|
671
|
-
trailing_metadata_buffer(arena)
|
687
|
+
trailing_metadata_buffer(arena),
|
688
|
+
flow_control(&t->flow_control) {
|
672
689
|
if (server_data) {
|
673
690
|
id = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(server_data));
|
674
691
|
*t->accepting_stream = this;
|
675
692
|
grpc_chttp2_stream_map_add(&t->stream_map, id, this);
|
676
693
|
post_destructive_reclaimer(t);
|
677
694
|
}
|
678
|
-
if (t->flow_control->flow_control_enabled()) {
|
679
|
-
flow_control.Init<grpc_core::chttp2::StreamFlowControl>(
|
680
|
-
static_cast<grpc_core::chttp2::TransportFlowControl*>(
|
681
|
-
t->flow_control.get()),
|
682
|
-
this);
|
683
|
-
} else {
|
684
|
-
flow_control.Init<grpc_core::chttp2::StreamFlowControlDisabled>();
|
685
|
-
}
|
686
695
|
|
687
696
|
grpc_slice_buffer_init(&frame_storage);
|
688
|
-
grpc_slice_buffer_init(&unprocessed_incoming_frames_buffer);
|
689
697
|
grpc_slice_buffer_init(&flow_controlled_buffer);
|
690
|
-
GRPC_CLOSURE_INIT(&reset_byte_stream, ::reset_byte_stream, this, nullptr);
|
691
698
|
}
|
692
699
|
|
693
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
|
+
|
694
704
|
if (t->channelz_socket != nullptr) {
|
695
705
|
if ((t->is_client && eos_received) || (!t->is_client && eos_sent)) {
|
696
706
|
t->channelz_socket->RecordStreamSucceeded();
|
@@ -704,11 +714,10 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
704
714
|
GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, id) == nullptr);
|
705
715
|
}
|
706
716
|
|
707
|
-
grpc_slice_buffer_destroy_internal(&unprocessed_incoming_frames_buffer);
|
708
717
|
grpc_slice_buffer_destroy_internal(&frame_storage);
|
709
718
|
|
710
719
|
for (int i = 0; i < STREAM_LIST_COUNT; i++) {
|
711
|
-
if (GPR_UNLIKELY(included
|
720
|
+
if (GPR_UNLIKELY(included.is_set(i))) {
|
712
721
|
gpr_log(GPR_ERROR, "%s stream %d still included in list %d",
|
713
722
|
t->is_client ? "client" : "server", id, i);
|
714
723
|
abort();
|
@@ -716,7 +725,6 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
716
725
|
}
|
717
726
|
|
718
727
|
GPR_ASSERT(send_initial_metadata_finished == nullptr);
|
719
|
-
GPR_ASSERT(fetching_send_message == nullptr);
|
720
728
|
GPR_ASSERT(send_trailing_metadata_finished == nullptr);
|
721
729
|
GPR_ASSERT(recv_initial_metadata_ready == nullptr);
|
722
730
|
GPR_ASSERT(recv_message_ready == nullptr);
|
@@ -724,8 +732,6 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
724
732
|
grpc_slice_buffer_destroy_internal(&flow_controlled_buffer);
|
725
733
|
GRPC_ERROR_UNREF(read_closed_error);
|
726
734
|
GRPC_ERROR_UNREF(write_closed_error);
|
727
|
-
GRPC_ERROR_UNREF(byte_stream_error);
|
728
|
-
flow_control.Destroy();
|
729
735
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "stream");
|
730
736
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, destroy_stream_arg, GRPC_ERROR_NONE);
|
731
737
|
}
|
@@ -802,7 +808,7 @@ static void set_write_state(grpc_chttp2_transport* t,
|
|
802
808
|
// from peer while we had some pending writes)
|
803
809
|
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
804
810
|
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &t->run_after_write);
|
805
|
-
if (t->close_transport_on_writes_finished
|
811
|
+
if (!GRPC_ERROR_IS_NONE(t->close_transport_on_writes_finished)) {
|
806
812
|
grpc_error_handle err = t->close_transport_on_writes_finished;
|
807
813
|
t->close_transport_on_writes_finished = GRPC_ERROR_NONE;
|
808
814
|
close_transport_locked(t, err);
|
@@ -924,7 +930,7 @@ void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
|
|
924
930
|
|
925
931
|
void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
|
926
932
|
grpc_chttp2_stream* s) {
|
927
|
-
if (t->closed_with_error
|
933
|
+
if (GRPC_ERROR_IS_NONE(t->closed_with_error) &&
|
928
934
|
grpc_chttp2_list_add_writable_stream(t, s)) {
|
929
935
|
GRPC_CHTTP2_STREAM_REF(s, "chttp2_writing:become");
|
930
936
|
}
|
@@ -944,7 +950,7 @@ static void write_action_begin_locked(void* gt,
|
|
944
950
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
|
945
951
|
GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE);
|
946
952
|
grpc_chttp2_begin_write_result r;
|
947
|
-
if (t->closed_with_error
|
953
|
+
if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
948
954
|
r.writing = false;
|
949
955
|
} else {
|
950
956
|
r = grpc_chttp2_begin_write(t);
|
@@ -980,14 +986,26 @@ static void write_action_begin_locked(void* gt,
|
|
980
986
|
|
981
987
|
static void write_action(void* gt, grpc_error_handle /*error*/) {
|
982
988
|
GPR_TIMER_SCOPE("write_action", 0);
|
989
|
+
static bool kEnablePeerStateBasedFraming =
|
990
|
+
GPR_GLOBAL_CONFIG_GET(grpc_experimental_enable_peer_state_based_framing);
|
983
991
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
|
984
992
|
void* cl = t->cl;
|
985
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;
|
986
1004
|
grpc_endpoint_write(
|
987
1005
|
t->ep, &t->outbuf,
|
988
1006
|
GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end, t,
|
989
1007
|
grpc_schedule_on_exec_ctx),
|
990
|
-
cl);
|
1008
|
+
cl, max_frame_size);
|
991
1009
|
}
|
992
1010
|
|
993
1011
|
static void write_action_end(void* tp, grpc_error_handle error) {
|
@@ -1004,7 +1022,7 @@ static void write_action_end_locked(void* tp, grpc_error_handle error) {
|
|
1004
1022
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
1005
1023
|
|
1006
1024
|
bool closed = false;
|
1007
|
-
if (error
|
1025
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
1008
1026
|
close_transport_locked(t, GRPC_ERROR_REF(error));
|
1009
1027
|
closed = true;
|
1010
1028
|
}
|
@@ -1083,7 +1101,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
|
1083
1101
|
uint32_t last_stream_id,
|
1084
1102
|
absl::string_view goaway_text) {
|
1085
1103
|
// Discard the error from a previous goaway frame (if any)
|
1086
|
-
if (t->goaway_error
|
1104
|
+
if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
|
1087
1105
|
GRPC_ERROR_UNREF(t->goaway_error);
|
1088
1106
|
}
|
1089
1107
|
t->goaway_error = grpc_error_set_str(
|
@@ -1153,7 +1171,7 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
|
|
1153
1171
|
grpc_chttp2_stream* s;
|
1154
1172
|
// maybe cancel out streams that haven't yet started if we have received a
|
1155
1173
|
// GOAWAY
|
1156
|
-
if (t->goaway_error
|
1174
|
+
if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
|
1157
1175
|
cancel_unstarted_streams(t, GRPC_ERROR_REF(t->goaway_error));
|
1158
1176
|
return;
|
1159
1177
|
}
|
@@ -1217,6 +1235,12 @@ static grpc_closure* add_closure_barrier(grpc_closure* closure) {
|
|
1217
1235
|
static void null_then_sched_closure(grpc_closure** closure) {
|
1218
1236
|
grpc_closure* c = *closure;
|
1219
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.
|
1220
1244
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, c, GRPC_ERROR_NONE);
|
1221
1245
|
}
|
1222
1246
|
|
@@ -1245,7 +1269,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1245
1269
|
desc, grpc_error_std_string(error).c_str(),
|
1246
1270
|
write_state_name(t->write_state));
|
1247
1271
|
}
|
1248
|
-
if (error
|
1272
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
1249
1273
|
#ifdef GRPC_ERROR_IS_ABSEIL_STATUS
|
1250
1274
|
grpc_error_handle cl_err =
|
1251
1275
|
grpc_core::internal::StatusMoveFromHeapPtr(closure->error_data.error);
|
@@ -1253,7 +1277,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1253
1277
|
grpc_error_handle cl_err =
|
1254
1278
|
reinterpret_cast<grpc_error_handle>(closure->error_data.error);
|
1255
1279
|
#endif
|
1256
|
-
if (cl_err
|
1280
|
+
if (GRPC_ERROR_IS_NONE(cl_err)) {
|
1257
1281
|
cl_err = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1258
1282
|
"Error in HTTP transport completing operation");
|
1259
1283
|
cl_err = grpc_error_set_str(cl_err, GRPC_ERROR_STR_TARGET_ADDRESS,
|
@@ -1291,94 +1315,6 @@ static bool contains_non_ok_status(grpc_metadata_batch* batch) {
|
|
1291
1315
|
GRPC_STATUS_OK;
|
1292
1316
|
}
|
1293
1317
|
|
1294
|
-
static void maybe_become_writable_due_to_send_msg(grpc_chttp2_transport* t,
|
1295
|
-
grpc_chttp2_stream* s) {
|
1296
|
-
if (s->id != 0 && (!s->write_buffering ||
|
1297
|
-
s->flow_controlled_buffer.length > t->write_buffer_size)) {
|
1298
|
-
grpc_chttp2_mark_stream_writable(t, s);
|
1299
|
-
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE);
|
1300
|
-
}
|
1301
|
-
}
|
1302
|
-
|
1303
|
-
static void add_fetched_slice_locked(grpc_chttp2_transport* t,
|
1304
|
-
grpc_chttp2_stream* s) {
|
1305
|
-
s->fetched_send_message_length +=
|
1306
|
-
static_cast<uint32_t> GRPC_SLICE_LENGTH(s->fetching_slice);
|
1307
|
-
grpc_slice_buffer_add(&s->flow_controlled_buffer, s->fetching_slice);
|
1308
|
-
maybe_become_writable_due_to_send_msg(t, s);
|
1309
|
-
}
|
1310
|
-
|
1311
|
-
static void continue_fetching_send_locked(grpc_chttp2_transport* t,
|
1312
|
-
grpc_chttp2_stream* s) {
|
1313
|
-
for (;;) {
|
1314
|
-
if (s->fetching_send_message == nullptr) {
|
1315
|
-
// Stream was cancelled before message fetch completed
|
1316
|
-
abort(); /* TODO(ctiller): what cleanup here? */
|
1317
|
-
}
|
1318
|
-
if (s->fetched_send_message_length == s->fetching_send_message->length()) {
|
1319
|
-
int64_t notify_offset = s->next_message_end_offset;
|
1320
|
-
if (notify_offset <= s->flow_controlled_bytes_written) {
|
1321
|
-
grpc_chttp2_complete_closure_step(
|
1322
|
-
t, s, &s->fetching_send_message_finished, GRPC_ERROR_NONE,
|
1323
|
-
"fetching_send_message_finished");
|
1324
|
-
} else {
|
1325
|
-
grpc_chttp2_write_cb* cb = t->write_cb_pool;
|
1326
|
-
if (cb == nullptr) {
|
1327
|
-
cb = static_cast<grpc_chttp2_write_cb*>(gpr_malloc(sizeof(*cb)));
|
1328
|
-
} else {
|
1329
|
-
t->write_cb_pool = cb->next;
|
1330
|
-
}
|
1331
|
-
cb->call_at_byte = notify_offset;
|
1332
|
-
cb->closure = s->fetching_send_message_finished;
|
1333
|
-
s->fetching_send_message_finished = nullptr;
|
1334
|
-
grpc_chttp2_write_cb** list =
|
1335
|
-
s->fetching_send_message->flags() & GRPC_WRITE_THROUGH
|
1336
|
-
? &s->on_write_finished_cbs
|
1337
|
-
: &s->on_flow_controlled_cbs;
|
1338
|
-
cb->next = *list;
|
1339
|
-
*list = cb;
|
1340
|
-
}
|
1341
|
-
s->fetching_send_message.reset();
|
1342
|
-
return; /* early out */
|
1343
|
-
} else if (s->fetching_send_message->Next(
|
1344
|
-
UINT32_MAX, GRPC_CLOSURE_INIT(&s->complete_fetch_locked,
|
1345
|
-
::complete_fetch, s,
|
1346
|
-
grpc_schedule_on_exec_ctx))) {
|
1347
|
-
grpc_error_handle error =
|
1348
|
-
s->fetching_send_message->Pull(&s->fetching_slice);
|
1349
|
-
if (error != GRPC_ERROR_NONE) {
|
1350
|
-
s->fetching_send_message.reset();
|
1351
|
-
grpc_chttp2_cancel_stream(t, s, error);
|
1352
|
-
} else {
|
1353
|
-
add_fetched_slice_locked(t, s);
|
1354
|
-
}
|
1355
|
-
}
|
1356
|
-
}
|
1357
|
-
}
|
1358
|
-
|
1359
|
-
static void complete_fetch(void* gs, grpc_error_handle error) {
|
1360
|
-
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(gs);
|
1361
|
-
s->t->combiner->Run(GRPC_CLOSURE_INIT(&s->complete_fetch_locked,
|
1362
|
-
::complete_fetch_locked, s, nullptr),
|
1363
|
-
GRPC_ERROR_REF(error));
|
1364
|
-
}
|
1365
|
-
|
1366
|
-
static void complete_fetch_locked(void* gs, grpc_error_handle error) {
|
1367
|
-
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(gs);
|
1368
|
-
grpc_chttp2_transport* t = s->t;
|
1369
|
-
if (error == GRPC_ERROR_NONE) {
|
1370
|
-
error = s->fetching_send_message->Pull(&s->fetching_slice);
|
1371
|
-
if (error == GRPC_ERROR_NONE) {
|
1372
|
-
add_fetched_slice_locked(t, s);
|
1373
|
-
continue_fetching_send_locked(t, s);
|
1374
|
-
}
|
1375
|
-
}
|
1376
|
-
if (error != GRPC_ERROR_NONE) {
|
1377
|
-
s->fetching_send_message.reset();
|
1378
|
-
grpc_chttp2_cancel_stream(t, s, error);
|
1379
|
-
}
|
1380
|
-
}
|
1381
|
-
|
1382
1318
|
static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
|
1383
1319
|
bool is_client, bool is_initial) {
|
1384
1320
|
const std::string prefix = absl::StrCat(
|
@@ -1454,7 +1390,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1454
1390
|
}
|
1455
1391
|
if (!s->write_closed) {
|
1456
1392
|
if (t->is_client) {
|
1457
|
-
if (t->closed_with_error
|
1393
|
+
if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
1458
1394
|
GPR_ASSERT(s->id == 0);
|
1459
1395
|
grpc_chttp2_list_add_waiting_for_concurrency(t, s);
|
1460
1396
|
maybe_start_some_streams(t);
|
@@ -1473,8 +1409,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1473
1409
|
GPR_ASSERT(s->id != 0);
|
1474
1410
|
grpc_chttp2_mark_stream_writable(t, s);
|
1475
1411
|
if (!(op->send_message &&
|
1476
|
-
(op->payload->send_message.
|
1477
|
-
GRPC_WRITE_BUFFER_HINT))) {
|
1412
|
+
(op->payload->send_message.flags & GRPC_WRITE_BUFFER_HINT))) {
|
1478
1413
|
grpc_chttp2_initiate_write(
|
1479
1414
|
t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
|
1480
1415
|
}
|
@@ -1498,32 +1433,28 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1498
1433
|
GRPC_STATS_INC_HTTP2_OP_SEND_MESSAGE();
|
1499
1434
|
t->num_messages_in_next_write++;
|
1500
1435
|
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_SIZE(
|
1501
|
-
op->payload->send_message.send_message->
|
1436
|
+
op->payload->send_message.send_message->Length());
|
1502
1437
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
|
1503
|
-
s->
|
1438
|
+
s->send_message_finished = add_closure_barrier(op->on_complete);
|
1439
|
+
const uint32_t flags = op_payload->send_message.flags;
|
1504
1440
|
if (s->write_closed) {
|
1505
1441
|
op->payload->send_message.stream_write_closed = true;
|
1506
1442
|
// We should NOT return an error here, so as to avoid a cancel OP being
|
1507
1443
|
// started. The surface layer will notice that the stream has been closed
|
1508
1444
|
// for writes and fail the send message op.
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
"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");
|
1513
1448
|
} else {
|
1514
|
-
GPR_ASSERT(s->fetching_send_message == nullptr);
|
1515
1449
|
uint8_t* frame_hdr = grpc_slice_buffer_tiny_add(
|
1516
1450
|
&s->flow_controlled_buffer, GRPC_HEADER_SIZE_IN_BYTES);
|
1517
|
-
uint32_t flags = op_payload->send_message.send_message->flags();
|
1518
1451
|
frame_hdr[0] = (flags & GRPC_WRITE_INTERNAL_COMPRESS) != 0;
|
1519
|
-
size_t len = op_payload->send_message.send_message->
|
1452
|
+
size_t len = op_payload->send_message.send_message->Length();
|
1520
1453
|
frame_hdr[1] = static_cast<uint8_t>(len >> 24);
|
1521
1454
|
frame_hdr[2] = static_cast<uint8_t>(len >> 16);
|
1522
1455
|
frame_hdr[3] = static_cast<uint8_t>(len >> 8);
|
1523
1456
|
frame_hdr[4] = static_cast<uint8_t>(len);
|
1524
|
-
|
1525
|
-
std::move(op_payload->send_message.send_message);
|
1526
|
-
s->fetched_send_message_length = 0;
|
1457
|
+
|
1527
1458
|
s->next_message_end_offset =
|
1528
1459
|
s->flow_controlled_bytes_written +
|
1529
1460
|
static_cast<int64_t>(s->flow_controlled_buffer.length) +
|
@@ -1534,8 +1465,44 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1534
1465
|
} else {
|
1535
1466
|
s->write_buffering = false;
|
1536
1467
|
}
|
1537
|
-
|
1538
|
-
|
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
|
+
}
|
1539
1506
|
}
|
1540
1507
|
}
|
1541
1508
|
|
@@ -1589,28 +1556,14 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1589
1556
|
|
1590
1557
|
if (op->recv_message) {
|
1591
1558
|
GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE();
|
1592
|
-
size_t before = 0;
|
1593
1559
|
GPR_ASSERT(s->recv_message_ready == nullptr);
|
1594
|
-
GPR_ASSERT(!s->pending_byte_stream);
|
1595
1560
|
s->recv_message_ready = op_payload->recv_message.recv_message_ready;
|
1596
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;
|
1597
1564
|
s->call_failed_before_recv_message =
|
1598
1565
|
op_payload->recv_message.call_failed_before_recv_message;
|
1599
|
-
|
1600
|
-
if (!s->read_closed) {
|
1601
|
-
before = s->frame_storage.length +
|
1602
|
-
s->unprocessed_incoming_frames_buffer.length;
|
1603
|
-
}
|
1604
|
-
}
|
1605
|
-
grpc_chttp2_maybe_complete_recv_message(t, s);
|
1606
|
-
if (s->id != 0) {
|
1607
|
-
if (!s->read_closed && s->frame_storage.length == 0) {
|
1608
|
-
size_t after = s->unprocessed_incoming_frames_buffer_cached_length;
|
1609
|
-
s->flow_control->IncomingByteStreamUpdate(GRPC_HEADER_SIZE_IN_BYTES,
|
1610
|
-
before - after);
|
1611
|
-
grpc_chttp2_act_on_flowctl_action(s->flow_control->MakeAction(), t, s);
|
1612
|
-
}
|
1613
|
-
}
|
1566
|
+
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
1614
1567
|
}
|
1615
1568
|
|
1616
1569
|
if (op->recv_trailing_metadata) {
|
@@ -1669,7 +1622,7 @@ static void cancel_pings(grpc_chttp2_transport* t, grpc_error_handle error) {
|
|
1669
1622
|
// callback remaining pings: they're not allowed to call into the transport,
|
1670
1623
|
// and maybe they hold resources that need to be freed
|
1671
1624
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
1672
|
-
GPR_ASSERT(error
|
1625
|
+
GPR_ASSERT(!GRPC_ERROR_IS_NONE(error));
|
1673
1626
|
for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) {
|
1674
1627
|
grpc_closure_list_fail_all(&pq->lists[j], GRPC_ERROR_REF(error));
|
1675
1628
|
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &pq->lists[j]);
|
@@ -1679,7 +1632,7 @@ static void cancel_pings(grpc_chttp2_transport* t, grpc_error_handle error) {
|
|
1679
1632
|
|
1680
1633
|
static void send_ping_locked(grpc_chttp2_transport* t,
|
1681
1634
|
grpc_closure* on_initiate, grpc_closure* on_ack) {
|
1682
|
-
if (t->closed_with_error
|
1635
|
+
if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
1683
1636
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_initiate,
|
1684
1637
|
GRPC_ERROR_REF(t->closed_with_error));
|
1685
1638
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_ack,
|
@@ -1697,7 +1650,7 @@ static void send_ping_locked(grpc_chttp2_transport* t,
|
|
1697
1650
|
// a ping in progress, the keepalive ping would piggyback onto that ping,
|
1698
1651
|
// instead of waiting for that ping to complete and then starting a new ping.
|
1699
1652
|
static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
|
1700
|
-
if (t->closed_with_error
|
1653
|
+
if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
1701
1654
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
|
1702
1655
|
start_keepalive_ping_locked, t, nullptr),
|
1703
1656
|
GRPC_ERROR_REF(t->closed_with_error));
|
@@ -1742,7 +1695,7 @@ void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error_handle error) {
|
|
1742
1695
|
static void retry_initiate_ping_locked(void* tp, grpc_error_handle error) {
|
1743
1696
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
1744
1697
|
t->ping_state.is_delayed_ping_timer_set = false;
|
1745
|
-
if (error
|
1698
|
+
if (GRPC_ERROR_IS_NONE(error)) {
|
1746
1699
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
|
1747
1700
|
}
|
1748
1701
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "retry_initiate_ping_locked");
|
@@ -1799,7 +1752,7 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
|
|
1799
1752
|
// We already sent the final GOAWAY.
|
1800
1753
|
return;
|
1801
1754
|
}
|
1802
|
-
if (t_->destroying || t_->closed_with_error
|
1755
|
+
if (t_->destroying || !GRPC_ERROR_IS_NONE(t_->closed_with_error)) {
|
1803
1756
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
1804
1757
|
GPR_INFO,
|
1805
1758
|
"transport:%p %s peer:%s Transport already shutting down. "
|
@@ -1836,7 +1789,7 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
|
|
1836
1789
|
|
1837
1790
|
static void OnTimer(void* arg, grpc_error_handle error) {
|
1838
1791
|
auto* self = static_cast<GracefulGoaway*>(arg);
|
1839
|
-
if (error
|
1792
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
1840
1793
|
self->Unref();
|
1841
1794
|
return;
|
1842
1795
|
}
|
@@ -1859,15 +1812,22 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
|
|
1859
1812
|
|
1860
1813
|
} // namespace
|
1861
1814
|
|
1862
|
-
static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error
|
1815
|
+
static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error,
|
1816
|
+
bool immediate_disconnect_hint) {
|
1863
1817
|
grpc_http2_error_code http_error;
|
1864
1818
|
std::string message;
|
1865
1819
|
grpc_error_get_status(error, grpc_core::Timestamp::InfFuture(), nullptr,
|
1866
1820
|
&message, &http_error, nullptr);
|
1867
|
-
if (!t->is_client && http_error == GRPC_HTTP2_NO_ERROR
|
1821
|
+
if (!t->is_client && http_error == GRPC_HTTP2_NO_ERROR &&
|
1822
|
+
!immediate_disconnect_hint) {
|
1868
1823
|
// Do a graceful shutdown.
|
1869
|
-
|
1870
|
-
|
1824
|
+
if (t->sent_goaway_state == GRPC_CHTTP2_NO_GOAWAY_SEND) {
|
1825
|
+
GracefulGoaway::Start(t);
|
1826
|
+
} else {
|
1827
|
+
// Graceful GOAWAY is already in progress.
|
1828
|
+
}
|
1829
|
+
} else if (t->sent_goaway_state == GRPC_CHTTP2_NO_GOAWAY_SEND ||
|
1830
|
+
t->sent_goaway_state == GRPC_CHTTP2_GRACEFUL_GOAWAY) {
|
1871
1831
|
// We want to log this irrespective of whether http tracing is enabled
|
1872
1832
|
gpr_log(GPR_DEBUG, "%s: Sending goaway err=%s", t->peer_string.c_str(),
|
1873
1833
|
grpc_error_std_string(error).c_str());
|
@@ -1875,6 +1835,8 @@ static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error) {
|
|
1875
1835
|
grpc_chttp2_goaway_append(
|
1876
1836
|
t->last_new_stream_id, static_cast<uint32_t>(http_error),
|
1877
1837
|
grpc_slice_from_cpp_string(std::move(message)), &t->qbuf);
|
1838
|
+
} else {
|
1839
|
+
// Final GOAWAY has already been sent.
|
1878
1840
|
}
|
1879
1841
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT);
|
1880
1842
|
GRPC_ERROR_UNREF(error);
|
@@ -1886,7 +1848,8 @@ void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t) {
|
|
1886
1848
|
send_goaway(t,
|
1887
1849
|
grpc_error_set_int(
|
1888
1850
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("too_many_pings"),
|
1889
|
-
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM)
|
1851
|
+
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM),
|
1852
|
+
/*immediate_disconnect_hint=*/true);
|
1890
1853
|
// The transport will be closed after the write is done
|
1891
1854
|
close_transport_locked(
|
1892
1855
|
t, grpc_error_set_int(
|
@@ -1910,8 +1873,8 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1910
1873
|
grpc_chttp2_transport* t =
|
1911
1874
|
static_cast<grpc_chttp2_transport*>(op->handler_private.extra_arg);
|
1912
1875
|
|
1913
|
-
if (op->goaway_error
|
1914
|
-
send_goaway(t, op->goaway_error);
|
1876
|
+
if (!GRPC_ERROR_IS_NONE(op->goaway_error)) {
|
1877
|
+
send_goaway(t, op->goaway_error, /*immediate_disconnect_hint=*/false);
|
1915
1878
|
}
|
1916
1879
|
|
1917
1880
|
if (op->set_accept_stream) {
|
@@ -1940,7 +1903,9 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1940
1903
|
t->state_tracker.RemoveWatcher(op->stop_connectivity_watch);
|
1941
1904
|
}
|
1942
1905
|
|
1943
|
-
if (op->disconnect_with_error
|
1906
|
+
if (!GRPC_ERROR_IS_NONE(op->disconnect_with_error)) {
|
1907
|
+
send_goaway(t, GRPC_ERROR_REF(op->disconnect_with_error),
|
1908
|
+
/*immediate_disconnect_hint=*/true);
|
1944
1909
|
close_transport_locked(t, op->disconnect_with_error);
|
1945
1910
|
}
|
1946
1911
|
|
@@ -1972,10 +1937,6 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
|
|
1972
1937
|
s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) {
|
1973
1938
|
if (s->seen_error) {
|
1974
1939
|
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
1975
|
-
if (!s->pending_byte_stream) {
|
1976
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
1977
|
-
&s->unprocessed_incoming_frames_buffer);
|
1978
|
-
}
|
1979
1940
|
}
|
1980
1941
|
*s->recv_initial_metadata = std::move(s->initial_metadata_buffer);
|
1981
1942
|
s->recv_initial_metadata->Set(grpc_core::PeerString(), t->peer_string);
|
@@ -1992,47 +1953,62 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
|
|
1992
1953
|
}
|
1993
1954
|
}
|
1994
1955
|
|
1995
|
-
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport*
|
1956
|
+
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
|
1996
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);
|
1997
1962
|
grpc_error_handle error = GRPC_ERROR_NONE;
|
1998
|
-
|
1999
|
-
|
1963
|
+
|
1964
|
+
// Lambda is immediately invoked as a big scoped section that can be
|
1965
|
+
// exited out of at any point by returning.
|
1966
|
+
[&]() {
|
2000
1967
|
if (s->final_metadata_requested && s->seen_error) {
|
2001
1968
|
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
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
|
+
}
|
2025
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
|
2026
2005
|
}
|
2027
2006
|
}
|
2028
2007
|
// save the length of the buffer before handing control back to application
|
2029
2008
|
// threads. Needed to support correct flow control bookkeeping
|
2030
|
-
s->
|
2031
|
-
s->unprocessed_incoming_frames_buffer.length;
|
2032
|
-
if (error == GRPC_ERROR_NONE && *s->recv_message != nullptr) {
|
2009
|
+
if (GRPC_ERROR_IS_NONE(error) && s->recv_message->has_value()) {
|
2033
2010
|
null_then_sched_closure(&s->recv_message_ready);
|
2034
2011
|
} else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
|
2035
|
-
*s->recv_message = nullptr;
|
2036
2012
|
if (s->call_failed_before_recv_message != nullptr) {
|
2037
2013
|
*s->call_failed_before_recv_message =
|
2038
2014
|
(s->published_metadata[1] != GRPC_METADATA_PUBLISHED_AT_CLOSE);
|
@@ -2040,7 +2016,10 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* /*t*/,
|
|
2040
2016
|
null_then_sched_closure(&s->recv_message_ready);
|
2041
2017
|
}
|
2042
2018
|
GRPC_ERROR_UNREF(error);
|
2043
|
-
}
|
2019
|
+
}();
|
2020
|
+
|
2021
|
+
upd.SetPendingSize(s->frame_storage.length);
|
2022
|
+
grpc_chttp2_act_on_flowctl_action(upd.MakeAction(), t, s);
|
2044
2023
|
}
|
2045
2024
|
|
2046
2025
|
void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
@@ -2050,26 +2029,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
|
2050
2029
|
s->write_closed) {
|
2051
2030
|
if (s->seen_error || !t->is_client) {
|
2052
2031
|
grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
|
2053
|
-
if (!s->pending_byte_stream) {
|
2054
|
-
grpc_slice_buffer_reset_and_unref_internal(
|
2055
|
-
&s->unprocessed_incoming_frames_buffer);
|
2056
|
-
}
|
2057
|
-
}
|
2058
|
-
bool pending_data = s->pending_byte_stream ||
|
2059
|
-
s->unprocessed_incoming_frames_buffer.length > 0;
|
2060
|
-
if (s->read_closed && s->frame_storage.length > 0 && !pending_data &&
|
2061
|
-
!s->seen_error && s->recv_trailing_metadata_finished != nullptr) {
|
2062
|
-
// Maybe some SYNC_FLUSH data is left in frame_storage. Consume them and
|
2063
|
-
// maybe decompress the next 5 bytes in the stream.
|
2064
|
-
grpc_slice_buffer_move_first(
|
2065
|
-
&s->frame_storage,
|
2066
|
-
std::min(s->frame_storage.length, size_t(GRPC_HEADER_SIZE_IN_BYTES)),
|
2067
|
-
&s->unprocessed_incoming_frames_buffer);
|
2068
|
-
if (s->unprocessed_incoming_frames_buffer.length > 0) {
|
2069
|
-
pending_data = true;
|
2070
|
-
}
|
2071
2032
|
}
|
2072
|
-
if (s->read_closed && s->frame_storage.length == 0 &&
|
2033
|
+
if (s->read_closed && s->frame_storage.length == 0 &&
|
2073
2034
|
s->recv_trailing_metadata_finished != nullptr) {
|
2074
2035
|
grpc_transport_move_stats(&s->stats, s->collecting_stats);
|
2075
2036
|
s->collecting_stats = nullptr;
|
@@ -2089,20 +2050,6 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
|
|
2089
2050
|
t->incoming_stream = nullptr;
|
2090
2051
|
grpc_chttp2_parsing_become_skip_parser(t);
|
2091
2052
|
}
|
2092
|
-
if (s->pending_byte_stream) {
|
2093
|
-
if (s->on_next != nullptr) {
|
2094
|
-
grpc_core::Chttp2IncomingByteStream* bs = s->data_parser.parsing_frame;
|
2095
|
-
if (error == GRPC_ERROR_NONE) {
|
2096
|
-
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
2097
|
-
}
|
2098
|
-
bs->PublishError(error);
|
2099
|
-
bs->Unref();
|
2100
|
-
s->data_parser.parsing_frame = nullptr;
|
2101
|
-
} else {
|
2102
|
-
GRPC_ERROR_UNREF(s->byte_stream_error);
|
2103
|
-
s->byte_stream_error = GRPC_ERROR_REF(error);
|
2104
|
-
}
|
2105
|
-
}
|
2106
2053
|
|
2107
2054
|
if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
2108
2055
|
post_benign_reclaimer(t);
|
@@ -2141,7 +2088,7 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|
2141
2088
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
|
2142
2089
|
}
|
2143
2090
|
}
|
2144
|
-
if (due_to_error
|
2091
|
+
if (!GRPC_ERROR_IS_NONE(due_to_error) && !s->seen_error) {
|
2145
2092
|
s->seen_error = true;
|
2146
2093
|
}
|
2147
2094
|
grpc_chttp2_mark_stream_closed(t, s, 1, 1, due_to_error);
|
@@ -2179,7 +2126,7 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|
2179
2126
|
|
2180
2127
|
static void add_error(grpc_error_handle error, grpc_error_handle* refs,
|
2181
2128
|
size_t* nrefs) {
|
2182
|
-
if (error
|
2129
|
+
if (GRPC_ERROR_IS_NONE(error)) return;
|
2183
2130
|
for (size_t i = 0; i < *nrefs; i++) {
|
2184
2131
|
if (error == refs[i]) {
|
2185
2132
|
return;
|
@@ -2236,8 +2183,7 @@ void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
|
2236
2183
|
GRPC_ERROR_REF(error),
|
2237
2184
|
"send_trailing_metadata_finished");
|
2238
2185
|
|
2239
|
-
s->
|
2240
|
-
grpc_chttp2_complete_closure_step(t, s, &s->fetching_send_message_finished,
|
2186
|
+
grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
|
2241
2187
|
GRPC_ERROR_REF(error),
|
2242
2188
|
"fetching_send_message_finished");
|
2243
2189
|
flush_write_list(t, s, &s->on_write_finished_cbs, GRPC_ERROR_REF(error));
|
@@ -2250,7 +2196,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|
2250
2196
|
if (s->read_closed && s->write_closed) {
|
2251
2197
|
// already closed, but we should still fake the status if needed.
|
2252
2198
|
grpc_error_handle overall_error = removal_error(error, s, "Stream removed");
|
2253
|
-
if (overall_error
|
2199
|
+
if (!GRPC_ERROR_IS_NONE(overall_error)) {
|
2254
2200
|
grpc_chttp2_fake_status(t, s, overall_error);
|
2255
2201
|
}
|
2256
2202
|
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
@@ -2278,7 +2224,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|
2278
2224
|
// Purge streams waiting on concurrency still waiting for id assignment
|
2279
2225
|
grpc_chttp2_list_remove_waiting_for_concurrency(t, s);
|
2280
2226
|
}
|
2281
|
-
if (overall_error
|
2227
|
+
if (!GRPC_ERROR_IS_NONE(overall_error)) {
|
2282
2228
|
grpc_chttp2_fake_status(t, s, overall_error);
|
2283
2229
|
}
|
2284
2230
|
}
|
@@ -2507,8 +2453,11 @@ void grpc_chttp2_act_on_flowctl_action(
|
|
2507
2453
|
const grpc_core::chttp2::FlowControlAction& action,
|
2508
2454
|
grpc_chttp2_transport* t, grpc_chttp2_stream* s) {
|
2509
2455
|
WithUrgency(t, action.send_stream_update(),
|
2510
|
-
GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL,
|
2511
|
-
|
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
|
+
});
|
2512
2461
|
WithUrgency(t, action.send_transport_update(),
|
2513
2462
|
GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL, []() {});
|
2514
2463
|
WithUrgency(t, action.send_initial_window_update(),
|
@@ -2533,11 +2482,11 @@ static grpc_error_handle try_http_parsing(grpc_chttp2_transport* t) {
|
|
2533
2482
|
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
|
2534
2483
|
|
2535
2484
|
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
2536
|
-
for (; i < t->read_buffer.count && parse_error
|
2485
|
+
for (; i < t->read_buffer.count && GRPC_ERROR_IS_NONE(parse_error); i++) {
|
2537
2486
|
parse_error =
|
2538
2487
|
grpc_http_parser_parse(&parser, t->read_buffer.slices[i], nullptr);
|
2539
2488
|
}
|
2540
|
-
if (parse_error
|
2489
|
+
if (GRPC_ERROR_IS_NONE(parse_error) &&
|
2541
2490
|
(parse_error = grpc_http_parser_eof(&parser)) == GRPC_ERROR_NONE) {
|
2542
2491
|
error = grpc_error_set_int(
|
2543
2492
|
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
@@ -2568,7 +2517,7 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2568
2517
|
(void)GRPC_ERROR_REF(error);
|
2569
2518
|
|
2570
2519
|
grpc_error_handle err = error;
|
2571
|
-
if (err
|
2520
|
+
if (!GRPC_ERROR_IS_NONE(err)) {
|
2572
2521
|
err = grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
2573
2522
|
"Endpoint read failed", &err, 1),
|
2574
2523
|
GRPC_ERROR_INT_OCCURRED_DURING_WRITE,
|
@@ -2576,7 +2525,7 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2576
2525
|
}
|
2577
2526
|
std::swap(err, error);
|
2578
2527
|
GRPC_ERROR_UNREF(err);
|
2579
|
-
if (t->closed_with_error
|
2528
|
+
if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2580
2529
|
GPR_TIMER_SCOPE("reading_action.parse", 0);
|
2581
2530
|
size_t i = 0;
|
2582
2531
|
grpc_error_handle errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE,
|
@@ -2610,20 +2559,20 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2610
2559
|
|
2611
2560
|
GPR_TIMER_SCOPE("post_reading_action_locked", 0);
|
2612
2561
|
bool keep_reading = false;
|
2613
|
-
if (error
|
2562
|
+
if (GRPC_ERROR_IS_NONE(error) && !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2614
2563
|
error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
2615
2564
|
"Transport closed", &t->closed_with_error, 1);
|
2616
2565
|
}
|
2617
|
-
if (error
|
2566
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
2618
2567
|
// If a goaway frame was received, this might be the reason why the read
|
2619
2568
|
// failed. Add this info to the error
|
2620
|
-
if (t->goaway_error
|
2569
|
+
if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
|
2621
2570
|
error = grpc_error_add_child(error, GRPC_ERROR_REF(t->goaway_error));
|
2622
2571
|
}
|
2623
2572
|
|
2624
2573
|
close_transport_locked(t, GRPC_ERROR_REF(error));
|
2625
2574
|
t->endpoint_reading = 0;
|
2626
|
-
} else if (t->closed_with_error
|
2575
|
+
} else if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2627
2576
|
keep_reading = true;
|
2628
2577
|
// Since we have read a byte, reset the keepalive timer
|
2629
2578
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
|
@@ -2651,17 +2600,17 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2651
2600
|
}
|
2652
2601
|
|
2653
2602
|
static void continue_read_action_locked(grpc_chttp2_transport* t) {
|
2654
|
-
const bool urgent = t->goaway_error
|
2603
|
+
const bool urgent = !GRPC_ERROR_IS_NONE(t->goaway_error);
|
2655
2604
|
GRPC_CLOSURE_INIT(&t->read_action_locked, read_action, t,
|
2656
2605
|
grpc_schedule_on_exec_ctx);
|
2657
|
-
grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent
|
2658
|
-
|
2606
|
+
grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent,
|
2607
|
+
/*min_progress_size=*/1);
|
2659
2608
|
}
|
2660
2609
|
|
2661
2610
|
// t is reffed prior to calling the first time, and once the callback chain
|
2662
2611
|
// that kicks off finishes, it's unreffed
|
2663
2612
|
void schedule_bdp_ping_locked(grpc_chttp2_transport* t) {
|
2664
|
-
t->flow_control
|
2613
|
+
t->flow_control.bdp_estimator()->SchedulePing();
|
2665
2614
|
send_ping_locked(
|
2666
2615
|
t,
|
2667
2616
|
GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked, start_bdp_ping, t,
|
@@ -2684,14 +2633,14 @@ static void start_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
|
2684
2633
|
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string.c_str(),
|
2685
2634
|
grpc_error_std_string(error).c_str());
|
2686
2635
|
}
|
2687
|
-
if (error
|
2636
|
+
if (!GRPC_ERROR_IS_NONE(error) || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2688
2637
|
return;
|
2689
2638
|
}
|
2690
2639
|
// Reset the keepalive ping timer
|
2691
2640
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
|
2692
2641
|
grpc_timer_cancel(&t->keepalive_ping_timer);
|
2693
2642
|
}
|
2694
|
-
t->flow_control
|
2643
|
+
t->flow_control.bdp_estimator()->StartPing();
|
2695
2644
|
t->bdp_ping_started = true;
|
2696
2645
|
}
|
2697
2646
|
|
@@ -2708,7 +2657,7 @@ static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
|
2708
2657
|
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string.c_str(),
|
2709
2658
|
grpc_error_std_string(error).c_str());
|
2710
2659
|
}
|
2711
|
-
if (error
|
2660
|
+
if (!GRPC_ERROR_IS_NONE(error) || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2712
2661
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2713
2662
|
return;
|
2714
2663
|
}
|
@@ -2722,8 +2671,8 @@ static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
|
2722
2671
|
}
|
2723
2672
|
t->bdp_ping_started = false;
|
2724
2673
|
grpc_core::Timestamp next_ping =
|
2725
|
-
t->flow_control
|
2726
|
-
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,
|
2727
2676
|
nullptr);
|
2728
2677
|
GPR_ASSERT(!t->have_next_bdp_ping_timer);
|
2729
2678
|
t->have_next_bdp_ping_timer = true;
|
@@ -2746,11 +2695,11 @@ static void next_bdp_ping_timer_expired_locked(void* tp,
|
|
2746
2695
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2747
2696
|
GPR_ASSERT(t->have_next_bdp_ping_timer);
|
2748
2697
|
t->have_next_bdp_ping_timer = false;
|
2749
|
-
if (error
|
2698
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
2750
2699
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2751
2700
|
return;
|
2752
2701
|
}
|
2753
|
-
if (t->flow_control
|
2702
|
+
if (t->flow_control.bdp_estimator()->accumulator() == 0) {
|
2754
2703
|
// Block the bdp ping till we receive more data.
|
2755
2704
|
t->bdp_ping_blocked = true;
|
2756
2705
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
@@ -2828,9 +2777,9 @@ static void init_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2828
2777
|
static void init_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2829
2778
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2830
2779
|
GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING);
|
2831
|
-
if (t->destroying || t->closed_with_error
|
2780
|
+
if (t->destroying || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2832
2781
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
|
2833
|
-
} else if (error
|
2782
|
+
} else if (GRPC_ERROR_IS_NONE(error)) {
|
2834
2783
|
if (t->keepalive_permit_without_calls ||
|
2835
2784
|
grpc_chttp2_stream_map_size(&t->stream_map) > 0) {
|
2836
2785
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING;
|
@@ -2867,7 +2816,7 @@ static void start_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2867
2816
|
|
2868
2817
|
static void start_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2869
2818
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2870
|
-
if (error
|
2819
|
+
if (!GRPC_ERROR_IS_NONE(error)) {
|
2871
2820
|
return;
|
2872
2821
|
}
|
2873
2822
|
if (t->channelz_socket != nullptr) {
|
@@ -2896,7 +2845,7 @@ static void finish_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2896
2845
|
static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2897
2846
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2898
2847
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2899
|
-
if (error
|
2848
|
+
if (GRPC_ERROR_IS_NONE(error)) {
|
2900
2849
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
|
2901
2850
|
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
|
2902
2851
|
gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string.c_str());
|
@@ -2936,7 +2885,7 @@ static void keepalive_watchdog_fired_locked(void* arg,
|
|
2936
2885
|
grpc_error_handle error) {
|
2937
2886
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2938
2887
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2939
|
-
if (error
|
2888
|
+
if (GRPC_ERROR_IS_NONE(error)) {
|
2940
2889
|
gpr_log(GPR_INFO, "%s: Keepalive watchdog fired. Closing transport.",
|
2941
2890
|
t->peer_string.c_str());
|
2942
2891
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
|
@@ -2986,187 +2935,6 @@ static void set_pollset_set(grpc_transport* gt, grpc_stream* /*gs*/,
|
|
2986
2935
|
grpc_endpoint_add_to_pollset_set(t->ep, pollset_set);
|
2987
2936
|
}
|
2988
2937
|
|
2989
|
-
//
|
2990
|
-
// BYTE STREAM
|
2991
|
-
//
|
2992
|
-
|
2993
|
-
static void reset_byte_stream(void* arg, grpc_error_handle error) {
|
2994
|
-
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(arg);
|
2995
|
-
s->pending_byte_stream = false;
|
2996
|
-
if (error == GRPC_ERROR_NONE) {
|
2997
|
-
grpc_chttp2_maybe_complete_recv_message(s->t, s);
|
2998
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(s->t, s);
|
2999
|
-
} else {
|
3000
|
-
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
3001
|
-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, s->on_next, GRPC_ERROR_REF(error));
|
3002
|
-
s->on_next = nullptr;
|
3003
|
-
GRPC_ERROR_UNREF(s->byte_stream_error);
|
3004
|
-
s->byte_stream_error = GRPC_ERROR_NONE;
|
3005
|
-
grpc_chttp2_cancel_stream(s->t, s, GRPC_ERROR_REF(error));
|
3006
|
-
s->byte_stream_error = GRPC_ERROR_REF(error);
|
3007
|
-
}
|
3008
|
-
}
|
3009
|
-
|
3010
|
-
namespace grpc_core {
|
3011
|
-
|
3012
|
-
Chttp2IncomingByteStream::Chttp2IncomingByteStream(
|
3013
|
-
grpc_chttp2_transport* transport, grpc_chttp2_stream* stream,
|
3014
|
-
uint32_t frame_size, uint32_t flags)
|
3015
|
-
: ByteStream(frame_size, flags),
|
3016
|
-
transport_(transport),
|
3017
|
-
stream_(stream),
|
3018
|
-
refs_(2),
|
3019
|
-
remaining_bytes_(frame_size) {
|
3020
|
-
GRPC_ERROR_UNREF(stream->byte_stream_error);
|
3021
|
-
stream->byte_stream_error = GRPC_ERROR_NONE;
|
3022
|
-
}
|
3023
|
-
|
3024
|
-
void Chttp2IncomingByteStream::OrphanLocked(
|
3025
|
-
void* arg, grpc_error_handle /*error_ignored*/) {
|
3026
|
-
Chttp2IncomingByteStream* bs = static_cast<Chttp2IncomingByteStream*>(arg);
|
3027
|
-
grpc_chttp2_stream* s = bs->stream_;
|
3028
|
-
grpc_chttp2_transport* t = s->t;
|
3029
|
-
bs->Unref();
|
3030
|
-
s->pending_byte_stream = false;
|
3031
|
-
grpc_chttp2_maybe_complete_recv_message(t, s);
|
3032
|
-
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
3033
|
-
}
|
3034
|
-
|
3035
|
-
void Chttp2IncomingByteStream::Orphan() {
|
3036
|
-
GPR_TIMER_SCOPE("incoming_byte_stream_destroy", 0);
|
3037
|
-
transport_->combiner->Run(
|
3038
|
-
GRPC_CLOSURE_INIT(&destroy_action_,
|
3039
|
-
&Chttp2IncomingByteStream::OrphanLocked, this, nullptr),
|
3040
|
-
GRPC_ERROR_NONE);
|
3041
|
-
}
|
3042
|
-
|
3043
|
-
void Chttp2IncomingByteStream::NextLocked(void* arg,
|
3044
|
-
grpc_error_handle /*error_ignored*/) {
|
3045
|
-
Chttp2IncomingByteStream* bs = static_cast<Chttp2IncomingByteStream*>(arg);
|
3046
|
-
grpc_chttp2_transport* t = bs->transport_;
|
3047
|
-
grpc_chttp2_stream* s = bs->stream_;
|
3048
|
-
size_t cur_length = s->frame_storage.length;
|
3049
|
-
if (!s->read_closed) {
|
3050
|
-
s->flow_control->IncomingByteStreamUpdate(bs->next_action_.max_size_hint,
|
3051
|
-
cur_length);
|
3052
|
-
grpc_chttp2_act_on_flowctl_action(s->flow_control->MakeAction(), t, s);
|
3053
|
-
}
|
3054
|
-
GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0);
|
3055
|
-
if (s->frame_storage.length > 0) {
|
3056
|
-
grpc_slice_buffer_swap(&s->frame_storage,
|
3057
|
-
&s->unprocessed_incoming_frames_buffer);
|
3058
|
-
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete, GRPC_ERROR_NONE);
|
3059
|
-
} else if (s->byte_stream_error != GRPC_ERROR_NONE) {
|
3060
|
-
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
|
3061
|
-
GRPC_ERROR_REF(s->byte_stream_error));
|
3062
|
-
if (s->data_parser.parsing_frame != nullptr) {
|
3063
|
-
s->data_parser.parsing_frame->Unref();
|
3064
|
-
s->data_parser.parsing_frame = nullptr;
|
3065
|
-
}
|
3066
|
-
} else if (s->read_closed) {
|
3067
|
-
if (bs->remaining_bytes_ != 0) {
|
3068
|
-
s->byte_stream_error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
3069
|
-
"Truncated message", &s->read_closed_error, 1);
|
3070
|
-
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
|
3071
|
-
GRPC_ERROR_REF(s->byte_stream_error));
|
3072
|
-
if (s->data_parser.parsing_frame != nullptr) {
|
3073
|
-
s->data_parser.parsing_frame->Unref();
|
3074
|
-
s->data_parser.parsing_frame = nullptr;
|
3075
|
-
}
|
3076
|
-
} else {
|
3077
|
-
// Should never reach here.
|
3078
|
-
GPR_ASSERT(false);
|
3079
|
-
}
|
3080
|
-
} else {
|
3081
|
-
s->on_next = bs->next_action_.on_complete;
|
3082
|
-
}
|
3083
|
-
bs->Unref();
|
3084
|
-
}
|
3085
|
-
|
3086
|
-
bool Chttp2IncomingByteStream::Next(size_t max_size_hint,
|
3087
|
-
grpc_closure* on_complete) {
|
3088
|
-
GPR_TIMER_SCOPE("incoming_byte_stream_next", 0);
|
3089
|
-
if (stream_->unprocessed_incoming_frames_buffer.length > 0) {
|
3090
|
-
return true;
|
3091
|
-
} else {
|
3092
|
-
Ref();
|
3093
|
-
next_action_.max_size_hint = max_size_hint;
|
3094
|
-
next_action_.on_complete = on_complete;
|
3095
|
-
transport_->combiner->Run(
|
3096
|
-
GRPC_CLOSURE_INIT(&next_action_.closure,
|
3097
|
-
&Chttp2IncomingByteStream::NextLocked, this, nullptr),
|
3098
|
-
GRPC_ERROR_NONE);
|
3099
|
-
return false;
|
3100
|
-
}
|
3101
|
-
}
|
3102
|
-
|
3103
|
-
grpc_error_handle Chttp2IncomingByteStream::Pull(grpc_slice* slice) {
|
3104
|
-
GPR_TIMER_SCOPE("incoming_byte_stream_pull", 0);
|
3105
|
-
grpc_error_handle error;
|
3106
|
-
if (stream_->unprocessed_incoming_frames_buffer.length > 0) {
|
3107
|
-
error = grpc_deframe_unprocessed_incoming_frames(
|
3108
|
-
&stream_->data_parser, stream_,
|
3109
|
-
&stream_->unprocessed_incoming_frames_buffer, slice, nullptr);
|
3110
|
-
if (error != GRPC_ERROR_NONE) {
|
3111
|
-
return error;
|
3112
|
-
}
|
3113
|
-
} else {
|
3114
|
-
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
3115
|
-
stream_->t->combiner->Run(&stream_->reset_byte_stream,
|
3116
|
-
GRPC_ERROR_REF(error));
|
3117
|
-
return error;
|
3118
|
-
}
|
3119
|
-
return GRPC_ERROR_NONE;
|
3120
|
-
}
|
3121
|
-
|
3122
|
-
void Chttp2IncomingByteStream::PublishError(grpc_error_handle error) {
|
3123
|
-
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
3124
|
-
ExecCtx::Run(DEBUG_LOCATION, stream_->on_next, GRPC_ERROR_REF(error));
|
3125
|
-
stream_->on_next = nullptr;
|
3126
|
-
GRPC_ERROR_UNREF(stream_->byte_stream_error);
|
3127
|
-
stream_->byte_stream_error = GRPC_ERROR_REF(error);
|
3128
|
-
grpc_chttp2_cancel_stream(transport_, stream_, GRPC_ERROR_REF(error));
|
3129
|
-
}
|
3130
|
-
|
3131
|
-
grpc_error_handle Chttp2IncomingByteStream::Push(const grpc_slice& slice,
|
3132
|
-
grpc_slice* slice_out) {
|
3133
|
-
if (remaining_bytes_ < GRPC_SLICE_LENGTH(slice)) {
|
3134
|
-
grpc_error_handle error =
|
3135
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream");
|
3136
|
-
transport_->combiner->Run(&stream_->reset_byte_stream,
|
3137
|
-
GRPC_ERROR_REF(error));
|
3138
|
-
grpc_slice_unref_internal(slice);
|
3139
|
-
return error;
|
3140
|
-
} else {
|
3141
|
-
remaining_bytes_ -= static_cast<uint32_t> GRPC_SLICE_LENGTH(slice);
|
3142
|
-
if (slice_out != nullptr) {
|
3143
|
-
*slice_out = slice;
|
3144
|
-
}
|
3145
|
-
return GRPC_ERROR_NONE;
|
3146
|
-
}
|
3147
|
-
}
|
3148
|
-
|
3149
|
-
grpc_error_handle Chttp2IncomingByteStream::Finished(grpc_error_handle error,
|
3150
|
-
bool reset_on_error) {
|
3151
|
-
if (error == GRPC_ERROR_NONE) {
|
3152
|
-
if (remaining_bytes_ != 0) {
|
3153
|
-
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
3154
|
-
}
|
3155
|
-
}
|
3156
|
-
if (error != GRPC_ERROR_NONE && reset_on_error) {
|
3157
|
-
transport_->combiner->Run(&stream_->reset_byte_stream,
|
3158
|
-
GRPC_ERROR_REF(error));
|
3159
|
-
}
|
3160
|
-
Unref();
|
3161
|
-
return error;
|
3162
|
-
}
|
3163
|
-
|
3164
|
-
void Chttp2IncomingByteStream::Shutdown(grpc_error_handle error) {
|
3165
|
-
GRPC_ERROR_UNREF(Finished(error, true /* reset_on_error */));
|
3166
|
-
}
|
3167
|
-
|
3168
|
-
} // namespace grpc_core
|
3169
|
-
|
3170
2938
|
//
|
3171
2939
|
// RESOURCE QUOTAS
|
3172
2940
|
//
|
@@ -3213,7 +2981,7 @@ static void post_destructive_reclaimer(grpc_chttp2_transport* t) {
|
|
3213
2981
|
|
3214
2982
|
static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
|
3215
2983
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
3216
|
-
if (error
|
2984
|
+
if (GRPC_ERROR_IS_NONE(error) &&
|
3217
2985
|
grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
3218
2986
|
// Channel with no active streams: send a goaway to try and make it
|
3219
2987
|
// disconnect cleanly
|
@@ -3224,8 +2992,9 @@ static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
3224
2992
|
send_goaway(t,
|
3225
2993
|
grpc_error_set_int(
|
3226
2994
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Buffers full"),
|
3227
|
-
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM)
|
3228
|
-
|
2995
|
+
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM),
|
2996
|
+
/*immediate_disconnect_hint=*/true);
|
2997
|
+
} else if (GRPC_ERROR_IS_NONE(error) &&
|
3229
2998
|
GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
3230
2999
|
gpr_log(GPR_INFO,
|
3231
3000
|
"HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
|
@@ -3244,7 +3013,7 @@ static void destructive_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
3244
3013
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
3245
3014
|
size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
|
3246
3015
|
t->destructive_reclaimer_registered = false;
|
3247
|
-
if (error
|
3016
|
+
if (GRPC_ERROR_IS_NONE(error) && n > 0) {
|
3248
3017
|
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
|
3249
3018
|
grpc_chttp2_stream_map_rand(&t->stream_map));
|
3250
3019
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|