grpc 1.50.0-x86_64-linux → 1.51.0-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 +131 -42
- data/include/grpc/event_engine/event_engine.h +10 -3
- data/include/grpc/event_engine/slice_buffer.h +17 -0
- data/include/grpc/grpc.h +0 -10
- data/include/grpc/impl/codegen/grpc_types.h +1 -5
- data/include/grpc/impl/codegen/port_platform.h +0 -3
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +19 -13
- data/src/core/ext/filters/channel_idle/channel_idle_filter.h +1 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -3
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +7 -5
- data/src/core/ext/filters/client_channel/client_channel.cc +120 -140
- data/src/core/ext/filters/client_channel/client_channel.h +3 -4
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +0 -2
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel_service_config.cc +153 -0
- data/src/core/ext/filters/client_channel/{resolver_result_parsing.h → client_channel_service_config.h} +26 -23
- data/src/core/ext/filters/client_channel/connector.h +1 -1
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +20 -47
- data/src/core/ext/filters/client_channel/dynamic_filters.h +7 -8
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +3 -4
- data/src/core/ext/filters/client_channel/http_proxy.cc +0 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +3 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +5 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +35 -44
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +1 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +3 -4
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +41 -29
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +9 -11
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +15 -12
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +8 -10
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +26 -27
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +7 -9
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +44 -26
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +17 -27
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +42 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/{xds.h → xds_attributes.h} +15 -17
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +13 -7
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +48 -47
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +40 -126
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +364 -0
- data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +9 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +23 -32
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +1 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +22 -23
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +50 -52
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +2 -4
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +1 -3
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +34 -26
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +3 -4
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +4 -7
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +63 -46
- data/src/core/ext/filters/client_channel/retry_filter.cc +80 -102
- data/src/core/ext/filters/client_channel/retry_service_config.cc +192 -234
- data/src/core/ext/filters/client_channel/retry_service_config.h +20 -23
- data/src/core/ext/filters/client_channel/retry_throttle.cc +8 -8
- data/src/core/ext/filters/client_channel/retry_throttle.h +8 -7
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +2 -2
- data/src/core/ext/filters/client_channel/subchannel.cc +21 -25
- data/src/core/ext/filters/client_channel/subchannel.h +2 -2
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +11 -12
- data/src/core/ext/filters/deadline/deadline_filter.cc +13 -14
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +1 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +0 -4
- data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.cc +118 -0
- data/src/core/ext/filters/fault_injection/{service_config_parser.h → fault_injection_service_config_parser.h} +20 -12
- data/src/core/ext/filters/http/client/http_client_filter.cc +16 -16
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +13 -13
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +34 -34
- data/src/core/ext/filters/http/server/http_server_filter.cc +26 -25
- data/src/core/ext/filters/message_size/message_size_filter.cc +86 -117
- data/src/core/ext/filters/message_size/message_size_filter.h +22 -15
- data/src/core/ext/filters/rbac/rbac_filter.cc +12 -12
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +728 -530
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +4 -3
- data/src/core/ext/filters/server_config_selector/server_config_selector.h +1 -1
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +6 -7
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +17 -21
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +57 -72
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +212 -253
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +42 -11
- data/src/core/ext/transport/chttp2/transport/flow_control.h +4 -3
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +16 -15
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +13 -13
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +15 -17
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +5 -4
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +31 -39
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +24 -8
- data/src/core/ext/transport/chttp2/transport/parsing.cc +51 -52
- data/src/core/ext/transport/chttp2/transport/varint.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/varint.h +11 -8
- data/src/core/ext/transport/chttp2/transport/writing.cc +16 -16
- data/src/core/ext/transport/inproc/inproc_transport.cc +97 -115
- data/src/core/ext/xds/certificate_provider_store.cc +4 -4
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +4 -7
- data/src/core/ext/xds/xds_api.cc +15 -68
- data/src/core/ext/xds/xds_api.h +3 -7
- data/src/core/ext/xds/xds_bootstrap.h +0 -1
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +3 -12
- data/src/core/ext/xds/xds_bootstrap_grpc.h +16 -1
- data/src/core/ext/xds/xds_certificate_provider.cc +22 -25
- data/src/core/ext/xds/xds_channel_stack_modifier.cc +0 -1
- data/src/core/ext/xds/xds_client.cc +122 -90
- data/src/core/ext/xds/xds_client.h +7 -2
- data/src/core/ext/xds/xds_client_grpc.cc +5 -24
- data/src/core/ext/xds/xds_cluster.cc +291 -183
- data/src/core/ext/xds/xds_cluster.h +11 -15
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +32 -29
- data/src/core/ext/xds/xds_cluster_specifier_plugin.h +35 -16
- data/src/core/ext/xds/xds_common_types.cc +208 -141
- data/src/core/ext/xds/xds_common_types.h +19 -13
- data/src/core/ext/xds/xds_endpoint.cc +214 -129
- data/src/core/ext/xds/xds_endpoint.h +4 -7
- data/src/core/ext/xds/xds_http_fault_filter.cc +56 -43
- data/src/core/ext/xds/xds_http_fault_filter.h +13 -21
- data/src/core/ext/xds/xds_http_filters.cc +60 -73
- data/src/core/ext/xds/xds_http_filters.h +67 -19
- data/src/core/ext/xds/xds_http_rbac_filter.cc +152 -207
- data/src/core/ext/xds/xds_http_rbac_filter.h +12 -15
- data/src/core/ext/xds/xds_lb_policy_registry.cc +122 -169
- data/src/core/ext/xds/xds_lb_policy_registry.h +10 -11
- data/src/core/ext/xds/xds_listener.cc +459 -417
- data/src/core/ext/xds/xds_listener.h +43 -47
- data/src/core/ext/xds/xds_resource_type.h +3 -11
- data/src/core/ext/xds/xds_resource_type_impl.h +8 -13
- data/src/core/ext/xds/xds_route_config.cc +94 -80
- data/src/core/ext/xds/xds_route_config.h +10 -10
- data/src/core/ext/xds/xds_routing.cc +2 -1
- data/src/core/ext/xds/xds_routing.h +2 -0
- data/src/core/ext/xds/xds_server_config_fetcher.cc +109 -94
- data/src/core/ext/xds/xds_transport_grpc.cc +4 -5
- data/src/core/lib/address_utils/parse_address.cc +11 -10
- data/src/core/lib/channel/channel_args.h +16 -1
- data/src/core/lib/channel/channel_stack.cc +23 -20
- data/src/core/lib/channel/channel_stack.h +17 -4
- data/src/core/lib/channel/channel_stack_builder.cc +4 -7
- data/src/core/lib/channel/channel_stack_builder.h +14 -6
- data/src/core/lib/channel/channel_stack_builder_impl.cc +25 -7
- data/src/core/lib/channel/channel_stack_builder_impl.h +2 -0
- data/src/core/lib/channel/channel_trace.cc +4 -5
- data/src/core/lib/channel/channelz.cc +1 -1
- data/src/core/lib/channel/connected_channel.cc +695 -35
- data/src/core/lib/channel/connected_channel.h +0 -4
- data/src/core/lib/channel/promise_based_filter.cc +1004 -140
- data/src/core/lib/channel/promise_based_filter.h +364 -87
- data/src/core/lib/compression/message_compress.cc +5 -5
- data/src/core/lib/debug/event_log.cc +88 -0
- data/src/core/lib/debug/event_log.h +81 -0
- data/src/core/lib/debug/histogram_view.cc +69 -0
- data/src/core/lib/{slice/slice_refcount.cc → debug/histogram_view.h} +15 -13
- data/src/core/lib/debug/stats.cc +22 -119
- data/src/core/lib/debug/stats.h +29 -35
- data/src/core/lib/debug/stats_data.cc +224 -73
- data/src/core/lib/debug/stats_data.h +263 -122
- data/src/core/lib/event_engine/common_closures.h +71 -0
- data/src/core/lib/event_engine/default_event_engine.cc +38 -15
- data/src/core/lib/event_engine/default_event_engine.h +15 -3
- data/src/core/lib/event_engine/default_event_engine_factory.cc +2 -4
- data/src/core/lib/event_engine/memory_allocator.cc +1 -1
- data/src/core/lib/event_engine/poller.h +10 -4
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +618 -0
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +129 -0
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +901 -0
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +97 -0
- data/src/core/lib/event_engine/posix_engine/event_poller.h +111 -0
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +74 -0
- data/src/core/lib/event_engine/{executor/threaded_executor.cc → posix_engine/event_poller_posix_default.h} +13 -16
- data/src/core/lib/event_engine/posix_engine/internal_errqueue.cc +77 -0
- data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +179 -0
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +267 -0
- data/src/core/lib/event_engine/posix_engine/lockfree_event.h +73 -0
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +1270 -0
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +682 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +453 -18
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +148 -24
- data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +80 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1081 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +361 -0
- data/src/core/lib/event_engine/posix_engine/timer.h +9 -8
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +57 -194
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +21 -49
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +301 -0
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +179 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc +126 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +45 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +151 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +45 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +76 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc +67 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +37 -0
- data/src/core/lib/event_engine/slice.cc +7 -6
- data/src/core/lib/event_engine/slice_buffer.cc +2 -2
- data/src/core/lib/event_engine/thread_pool.cc +106 -25
- data/src/core/lib/event_engine/thread_pool.h +32 -9
- data/src/core/lib/event_engine/windows/win_socket.cc +7 -7
- data/src/core/lib/event_engine/windows/windows_engine.cc +18 -12
- data/src/core/lib/event_engine/windows/windows_engine.h +8 -4
- data/src/core/lib/experiments/config.cc +1 -1
- data/src/core/lib/experiments/experiments.cc +13 -2
- data/src/core/lib/experiments/experiments.h +8 -1
- data/src/core/lib/gpr/cpu_linux.cc +6 -2
- data/src/core/lib/gpr/log_linux.cc +3 -4
- data/src/core/lib/gpr/string.h +1 -1
- data/src/core/lib/gpr/tmpfile_posix.cc +3 -2
- data/src/core/lib/gprpp/load_file.cc +75 -0
- data/src/core/lib/gprpp/load_file.h +33 -0
- data/src/core/lib/gprpp/per_cpu.h +46 -0
- data/src/core/lib/gprpp/stat_posix.cc +5 -4
- data/src/core/lib/gprpp/stat_windows.cc +3 -2
- data/src/core/lib/gprpp/status_helper.h +1 -3
- data/src/core/lib/gprpp/strerror.cc +41 -0
- data/src/core/{ext/xds/xds_resource_type.cc → lib/gprpp/strerror.h} +9 -13
- data/src/core/lib/gprpp/thd_windows.cc +1 -2
- data/src/core/lib/gprpp/time.cc +3 -4
- data/src/core/lib/gprpp/time.h +13 -2
- data/src/core/lib/gprpp/validation_errors.h +18 -1
- data/src/core/lib/http/httpcli.cc +40 -44
- data/src/core/lib/http/httpcli.h +6 -5
- data/src/core/lib/http/httpcli_security_connector.cc +4 -6
- data/src/core/lib/http/parser.cc +54 -65
- data/src/core/lib/iomgr/buffer_list.cc +105 -116
- data/src/core/lib/iomgr/buffer_list.h +60 -44
- data/src/core/lib/iomgr/call_combiner.cc +11 -10
- data/src/core/lib/iomgr/call_combiner.h +3 -4
- data/src/core/lib/iomgr/cfstream_handle.cc +13 -16
- data/src/core/lib/iomgr/closure.h +49 -5
- data/src/core/lib/iomgr/combiner.cc +2 -2
- data/src/core/lib/iomgr/endpoint.h +1 -1
- data/src/core/lib/iomgr/endpoint_cfstream.cc +26 -25
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/error.cc +27 -42
- data/src/core/lib/iomgr/error.h +22 -152
- data/src/core/lib/iomgr/ev_apple.cc +4 -4
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +26 -25
- data/src/core/lib/iomgr/ev_poll_posix.cc +27 -31
- data/src/core/lib/iomgr/exec_ctx.cc +3 -4
- data/src/core/lib/iomgr/exec_ctx.h +2 -3
- data/src/core/lib/iomgr/executor.cc +1 -2
- data/src/core/lib/iomgr/internal_errqueue.cc +3 -1
- data/src/core/lib/iomgr/iocp_windows.cc +1 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +2 -1
- data/src/core/lib/iomgr/load_file.cc +5 -9
- data/src/core/lib/iomgr/lockfree_event.cc +10 -10
- data/src/core/lib/iomgr/pollset_windows.cc +4 -4
- data/src/core/lib/iomgr/python_util.h +2 -2
- data/src/core/lib/iomgr/resolve_address.cc +8 -3
- data/src/core/lib/iomgr/resolve_address.h +3 -4
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +14 -25
- data/src/core/lib/iomgr/resolve_address_posix.h +1 -2
- data/src/core/lib/iomgr/resolve_address_windows.cc +14 -17
- data/src/core/lib/iomgr/resolve_address_windows.h +1 -2
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +30 -29
- data/src/core/lib/iomgr/socket_utils_posix.cc +1 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
- data/src/core/lib/iomgr/socket_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -10
- data/src/core/lib/iomgr/tcp_client_posix.cc +31 -35
- data/src/core/lib/iomgr/tcp_client_windows.cc +8 -12
- data/src/core/lib/iomgr/tcp_posix.cc +92 -108
- data/src/core/lib/iomgr/tcp_server_posix.cc +34 -34
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +18 -21
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +12 -13
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +1 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +26 -29
- data/src/core/lib/iomgr/tcp_windows.cc +27 -34
- data/src/core/lib/iomgr/timer.h +8 -8
- data/src/core/lib/iomgr/timer_generic.cc +9 -15
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +4 -3
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +10 -8
- data/src/core/lib/json/json_channel_args.h +42 -0
- data/src/core/lib/json/json_object_loader.cc +7 -2
- data/src/core/lib/json/json_object_loader.h +22 -0
- data/src/core/lib/json/json_util.cc +5 -5
- data/src/core/lib/json/json_util.h +4 -4
- data/src/core/lib/load_balancing/lb_policy.cc +1 -1
- data/src/core/lib/load_balancing/lb_policy.h +4 -0
- data/src/core/lib/load_balancing/subchannel_interface.h +0 -7
- data/src/core/lib/matchers/matchers.cc +3 -4
- data/src/core/lib/promise/activity.cc +16 -2
- data/src/core/lib/promise/activity.h +38 -15
- data/src/core/lib/promise/arena_promise.h +80 -51
- data/src/core/lib/promise/context.h +13 -6
- data/src/core/lib/promise/detail/basic_seq.h +9 -28
- data/src/core/lib/promise/detail/promise_factory.h +58 -10
- data/src/core/lib/promise/detail/status.h +28 -0
- data/src/core/lib/promise/detail/switch.h +1455 -0
- data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +3 -1
- data/src/core/lib/promise/for_each.h +129 -0
- data/src/core/lib/promise/loop.h +7 -5
- data/src/core/lib/promise/map_pipe.h +87 -0
- data/src/core/lib/promise/pipe.cc +19 -0
- data/src/core/lib/promise/pipe.h +505 -0
- data/src/core/lib/promise/poll.h +13 -0
- data/src/core/lib/promise/seq.h +3 -5
- data/src/core/lib/promise/sleep.cc +5 -4
- data/src/core/lib/promise/sleep.h +1 -2
- data/src/core/lib/promise/try_concurrently.h +341 -0
- data/src/core/lib/promise/try_seq.h +10 -13
- data/src/core/lib/resolver/server_address.cc +1 -0
- data/src/core/lib/resolver/server_address.h +1 -3
- data/src/core/lib/resource_quota/api.cc +0 -1
- data/src/core/lib/resource_quota/arena.cc +19 -0
- data/src/core/lib/resource_quota/arena.h +89 -0
- data/src/core/lib/resource_quota/memory_quota.cc +1 -0
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +1 -3
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +4 -2
- data/src/core/lib/security/authorization/matchers.cc +25 -22
- data/src/core/lib/security/authorization/rbac_policy.cc +2 -3
- data/src/core/lib/security/context/security_context.h +10 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +3 -4
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +77 -55
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +4 -3
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -51
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +17 -21
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +21 -25
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +1 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +27 -24
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +1 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -2
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +5 -5
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +24 -30
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -5
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +19 -27
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +4 -11
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +29 -41
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +1 -1
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +6 -11
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +8 -15
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +2 -2
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +2 -6
- data/src/core/lib/security/security_connector/load_system_roots_supported.cc +1 -4
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +7 -11
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +9 -14
- data/src/core/lib/security/security_connector/ssl_utils.cc +5 -7
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +21 -27
- data/src/core/lib/security/transport/client_auth_filter.cc +1 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +26 -28
- data/src/core/lib/security/transport/security_handshaker.cc +53 -53
- data/src/core/lib/security/transport/server_auth_filter.cc +21 -21
- data/src/core/lib/security/transport/tsi_error.cc +6 -3
- data/src/core/lib/security/util/json_util.cc +4 -5
- data/src/core/lib/service_config/service_config.h +1 -1
- data/src/core/lib/service_config/service_config_impl.cc +111 -158
- data/src/core/lib/service_config/service_config_impl.h +14 -17
- data/src/core/lib/service_config/service_config_parser.cc +14 -31
- data/src/core/lib/service_config/service_config_parser.h +14 -10
- data/src/core/lib/slice/b64.cc +2 -2
- data/src/core/lib/slice/slice.cc +7 -1
- data/src/core/lib/slice/slice.h +19 -6
- data/src/core/lib/slice/slice_buffer.cc +13 -14
- data/src/core/lib/slice/slice_internal.h +13 -21
- data/src/core/lib/slice/slice_refcount.h +34 -19
- data/src/core/lib/surface/byte_buffer.cc +3 -4
- data/src/core/lib/surface/byte_buffer_reader.cc +4 -4
- data/src/core/lib/surface/call.cc +1366 -239
- data/src/core/lib/surface/call.h +44 -0
- data/src/core/lib/surface/call_details.cc +3 -3
- data/src/core/lib/surface/call_trace.cc +113 -0
- data/src/core/lib/surface/call_trace.h +30 -0
- data/src/core/lib/surface/channel.cc +44 -49
- data/src/core/lib/surface/channel.h +9 -1
- data/src/core/lib/surface/channel_ping.cc +1 -1
- data/src/core/lib/surface/channel_stack_type.cc +4 -0
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.cc +38 -52
- data/src/core/lib/surface/init.cc +8 -39
- data/src/core/lib/surface/init_internally.h +8 -0
- data/src/core/lib/surface/lame_client.cc +10 -8
- data/src/core/lib/surface/server.cc +48 -70
- data/src/core/lib/surface/server.h +3 -4
- data/src/core/lib/surface/validate_metadata.cc +11 -12
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/connectivity_state.cc +2 -2
- data/src/core/lib/transport/error_utils.cc +34 -28
- data/src/core/lib/transport/error_utils.h +3 -3
- data/src/core/lib/transport/handshaker.cc +14 -14
- data/src/core/lib/transport/handshaker.h +1 -1
- data/src/core/lib/transport/handshaker_factory.h +26 -0
- data/src/core/lib/transport/handshaker_registry.cc +8 -2
- data/src/core/lib/transport/handshaker_registry.h +3 -4
- data/src/core/lib/transport/http_connect_handshaker.cc +23 -24
- data/src/core/lib/transport/metadata_batch.h +17 -1
- data/src/core/lib/transport/parsed_metadata.cc +2 -6
- data/src/core/lib/transport/tcp_connect_handshaker.cc +15 -20
- data/src/core/lib/transport/transport.cc +63 -17
- data/src/core/lib/transport/transport.h +64 -68
- data/src/core/lib/transport/transport_impl.h +1 -1
- data/src/core/lib/transport/transport_op_string.cc +7 -6
- data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -10
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -14
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +10 -10
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +8 -8
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +2 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +7 -7
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +7 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +1 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +5 -5
- data/src/core/tsi/fake_transport_security.cc +3 -3
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +7 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +6 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +0 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +0 -3
- 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/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +0 -43
- data/src/ruby/spec/generic/active_call_spec.rb +12 -3
- data/third_party/abseil-cpp/absl/cleanup/cleanup.h +140 -0
- data/third_party/abseil-cpp/absl/cleanup/internal/cleanup.h +100 -0
- data/third_party/zlib/compress.c +3 -3
- data/third_party/zlib/crc32.c +21 -12
- data/third_party/zlib/deflate.c +112 -106
- data/third_party/zlib/deflate.h +2 -2
- data/third_party/zlib/gzlib.c +1 -1
- data/third_party/zlib/gzread.c +3 -5
- data/third_party/zlib/gzwrite.c +1 -1
- data/third_party/zlib/infback.c +10 -7
- data/third_party/zlib/inflate.c +5 -2
- data/third_party/zlib/inftrees.c +2 -2
- data/third_party/zlib/inftrees.h +1 -1
- data/third_party/zlib/trees.c +61 -62
- data/third_party/zlib/uncompr.c +2 -2
- data/third_party/zlib/zconf.h +16 -3
- data/third_party/zlib/zlib.h +10 -10
- data/third_party/zlib/zutil.c +9 -7
- data/third_party/zlib/zutil.h +1 -0
- metadata +55 -18
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +0 -188
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +0 -187
- data/src/core/lib/event_engine/executor/threaded_executor.h +0 -44
- data/src/core/lib/gpr/murmur_hash.cc +0 -82
- data/src/core/lib/gpr/murmur_hash.h +0 -29
- data/src/core/lib/gpr/tls.h +0 -156
- data/src/core/lib/promise/call_push_pull.h +0 -148
- data/src/core/lib/slice/slice_api.cc +0 -39
- data/src/core/lib/slice/slice_buffer_api.cc +0 -35
- data/src/core/lib/slice/slice_refcount_base.h +0 -60
@@ -60,6 +60,7 @@
|
|
60
60
|
#include "src/core/ext/transport/chttp2/transport/varint.h"
|
61
61
|
#include "src/core/lib/channel/channel_args.h"
|
62
62
|
#include "src/core/lib/debug/stats.h"
|
63
|
+
#include "src/core/lib/debug/stats_data.h"
|
63
64
|
#include "src/core/lib/experiments/experiments.h"
|
64
65
|
#include "src/core/lib/gpr/useful.h"
|
65
66
|
#include "src/core/lib/gprpp/bitset.h"
|
@@ -81,7 +82,6 @@
|
|
81
82
|
#include "src/core/lib/slice/slice.h"
|
82
83
|
#include "src/core/lib/slice/slice_buffer.h"
|
83
84
|
#include "src/core/lib/slice/slice_internal.h"
|
84
|
-
#include "src/core/lib/slice/slice_refcount.h"
|
85
85
|
#include "src/core/lib/transport/bdp_estimator.h"
|
86
86
|
#include "src/core/lib/transport/connectivity_state.h"
|
87
87
|
#include "src/core/lib/transport/error_utils.h"
|
@@ -231,19 +231,17 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
|
|
231
231
|
|
232
232
|
grpc_endpoint_destroy(ep);
|
233
233
|
|
234
|
-
|
234
|
+
grpc_slice_buffer_destroy(&qbuf);
|
235
235
|
|
236
|
-
|
236
|
+
grpc_slice_buffer_destroy(&outbuf);
|
237
237
|
|
238
|
-
grpc_error_handle error =
|
239
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed");
|
238
|
+
grpc_error_handle error = GRPC_ERROR_CREATE("Transport destroyed");
|
240
239
|
// ContextList::Execute follows semantics of a callback function and does not
|
241
240
|
// take a ref on error
|
242
241
|
grpc_core::ContextList::Execute(cl, nullptr, error);
|
243
|
-
GRPC_ERROR_UNREF(error);
|
244
242
|
cl = nullptr;
|
245
243
|
|
246
|
-
|
244
|
+
grpc_slice_buffer_destroy(&read_buffer);
|
247
245
|
grpc_chttp2_goaway_parser_destroy(&goaway_parser);
|
248
246
|
|
249
247
|
for (i = 0; i < STREAM_LIST_COUNT; i++) {
|
@@ -251,16 +249,13 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
|
|
251
249
|
GPR_ASSERT(lists[i].tail == nullptr);
|
252
250
|
}
|
253
251
|
|
254
|
-
GRPC_ERROR_UNREF(goaway_error);
|
255
|
-
|
256
252
|
GPR_ASSERT(grpc_chttp2_stream_map_size(&stream_map) == 0);
|
257
253
|
|
258
254
|
grpc_chttp2_stream_map_destroy(&stream_map);
|
259
255
|
|
260
256
|
GRPC_COMBINER_UNREF(combiner, "chttp2_transport");
|
261
257
|
|
262
|
-
cancel_pings(this,
|
263
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"));
|
258
|
+
cancel_pings(this, GRPC_ERROR_CREATE("Transport destroyed"));
|
264
259
|
|
265
260
|
while (write_cb_pool) {
|
266
261
|
grpc_chttp2_write_cb* next = write_cb_pool->next;
|
@@ -268,7 +263,6 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
|
|
268
263
|
write_cb_pool = next;
|
269
264
|
}
|
270
265
|
|
271
|
-
GRPC_ERROR_UNREF(closed_with_error);
|
272
266
|
gpr_free(ping_acks);
|
273
267
|
if (grpc_core::test_only_destruct_callback != nullptr) {
|
274
268
|
grpc_core::test_only_destruct_callback();
|
@@ -544,9 +538,9 @@ static void destroy_transport_locked(void* tp, grpc_error_handle /*error*/) {
|
|
544
538
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
545
539
|
t->destroying = 1;
|
546
540
|
close_transport_locked(
|
547
|
-
t, grpc_error_set_int(
|
548
|
-
|
549
|
-
|
541
|
+
t, grpc_error_set_int(GRPC_ERROR_CREATE("Transport destroyed"),
|
542
|
+
grpc_core::StatusIntProperty::kOccurredDuringWrite,
|
543
|
+
t->write_state));
|
550
544
|
t->memory_owner.Reset();
|
551
545
|
// Must be the last line.
|
552
546
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "destroy");
|
@@ -555,30 +549,30 @@ static void destroy_transport_locked(void* tp, grpc_error_handle /*error*/) {
|
|
555
549
|
static void destroy_transport(grpc_transport* gt) {
|
556
550
|
grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
|
557
551
|
t->combiner->Run(GRPC_CLOSURE_CREATE(destroy_transport_locked, t, nullptr),
|
558
|
-
|
552
|
+
absl::OkStatus());
|
559
553
|
}
|
560
554
|
|
561
555
|
static void close_transport_locked(grpc_chttp2_transport* t,
|
562
556
|
grpc_error_handle error) {
|
563
|
-
end_all_the_calls(t,
|
564
|
-
cancel_pings(t,
|
565
|
-
if (
|
557
|
+
end_all_the_calls(t, error);
|
558
|
+
cancel_pings(t, error);
|
559
|
+
if (t->closed_with_error.ok()) {
|
566
560
|
if (!grpc_error_has_clear_grpc_status(error)) {
|
567
|
-
error =
|
568
|
-
|
561
|
+
error =
|
562
|
+
grpc_error_set_int(error, grpc_core::StatusIntProperty::kRpcStatus,
|
563
|
+
GRPC_STATUS_UNAVAILABLE);
|
569
564
|
}
|
570
565
|
if (t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
571
|
-
if (
|
566
|
+
if (t->close_transport_on_writes_finished.ok()) {
|
572
567
|
t->close_transport_on_writes_finished =
|
573
|
-
|
574
|
-
"Delayed close due to in-progress write");
|
568
|
+
GRPC_ERROR_CREATE("Delayed close due to in-progress write");
|
575
569
|
}
|
576
570
|
t->close_transport_on_writes_finished =
|
577
571
|
grpc_error_add_child(t->close_transport_on_writes_finished, error);
|
578
572
|
return;
|
579
573
|
}
|
580
|
-
GPR_ASSERT(!
|
581
|
-
t->closed_with_error =
|
574
|
+
GPR_ASSERT(!error.ok());
|
575
|
+
t->closed_with_error = error;
|
582
576
|
connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN, absl::Status(),
|
583
577
|
"close_transport");
|
584
578
|
if (t->ping_state.is_delayed_ping_timer_set) {
|
@@ -607,19 +601,17 @@ static void close_transport_locked(grpc_chttp2_transport* t,
|
|
607
601
|
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:close");
|
608
602
|
}
|
609
603
|
GPR_ASSERT(t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE);
|
610
|
-
grpc_endpoint_shutdown(t->ep,
|
604
|
+
grpc_endpoint_shutdown(t->ep, error);
|
611
605
|
}
|
612
606
|
if (t->notify_on_receive_settings != nullptr) {
|
613
607
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, t->notify_on_receive_settings,
|
614
|
-
|
608
|
+
error);
|
615
609
|
t->notify_on_receive_settings = nullptr;
|
616
610
|
}
|
617
611
|
if (t->notify_on_close != nullptr) {
|
618
|
-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, t->notify_on_close,
|
619
|
-
GRPC_ERROR_REF(error));
|
612
|
+
grpc_core::ExecCtx::Run(DEBUG_LOCATION, t->notify_on_close, error);
|
620
613
|
t->notify_on_close = nullptr;
|
621
614
|
}
|
622
|
-
GRPC_ERROR_UNREF(error);
|
623
615
|
}
|
624
616
|
|
625
617
|
#ifndef NDEBUG
|
@@ -684,7 +676,7 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
684
676
|
GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, id) == nullptr);
|
685
677
|
}
|
686
678
|
|
687
|
-
|
679
|
+
grpc_slice_buffer_destroy(&frame_storage);
|
688
680
|
|
689
681
|
for (int i = 0; i < STREAM_LIST_COUNT; i++) {
|
690
682
|
if (GPR_UNLIKELY(included.is_set(i))) {
|
@@ -699,11 +691,9 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
|
|
699
691
|
GPR_ASSERT(recv_initial_metadata_ready == nullptr);
|
700
692
|
GPR_ASSERT(recv_message_ready == nullptr);
|
701
693
|
GPR_ASSERT(recv_trailing_metadata_finished == nullptr);
|
702
|
-
|
703
|
-
GRPC_ERROR_UNREF(read_closed_error);
|
704
|
-
GRPC_ERROR_UNREF(write_closed_error);
|
694
|
+
grpc_slice_buffer_destroy(&flow_controlled_buffer);
|
705
695
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "stream");
|
706
|
-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, destroy_stream_arg,
|
696
|
+
grpc_core::ExecCtx::Run(DEBUG_LOCATION, destroy_stream_arg, absl::OkStatus());
|
707
697
|
}
|
708
698
|
|
709
699
|
static int init_stream(grpc_transport* gt, grpc_stream* gs,
|
@@ -727,7 +717,7 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
|
|
727
717
|
s->destroy_stream_arg = then_schedule_closure;
|
728
718
|
t->combiner->Run(
|
729
719
|
GRPC_CLOSURE_INIT(&s->destroy_stream, destroy_stream_locked, s, nullptr),
|
730
|
-
|
720
|
+
absl::OkStatus());
|
731
721
|
}
|
732
722
|
|
733
723
|
grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
|
@@ -775,9 +765,9 @@ static void set_write_state(grpc_chttp2_transport* t,
|
|
775
765
|
// from peer while we had some pending writes)
|
776
766
|
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
777
767
|
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &t->run_after_write);
|
778
|
-
if (!
|
768
|
+
if (!t->close_transport_on_writes_finished.ok()) {
|
779
769
|
grpc_error_handle err = t->close_transport_on_writes_finished;
|
780
|
-
t->close_transport_on_writes_finished =
|
770
|
+
t->close_transport_on_writes_finished = absl::OkStatus();
|
781
771
|
close_transport_locked(t, err);
|
782
772
|
}
|
783
773
|
}
|
@@ -809,7 +799,7 @@ void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
|
|
809
799
|
t->combiner->FinallyRun(
|
810
800
|
GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
|
811
801
|
write_action_begin_locked, t, nullptr),
|
812
|
-
|
802
|
+
absl::OkStatus());
|
813
803
|
break;
|
814
804
|
case GRPC_CHTTP2_WRITE_STATE_WRITING:
|
815
805
|
set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
|
@@ -822,8 +812,7 @@ void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
|
|
822
812
|
|
823
813
|
void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
|
824
814
|
grpc_chttp2_stream* s) {
|
825
|
-
if (
|
826
|
-
grpc_chttp2_list_add_writable_stream(t, s)) {
|
815
|
+
if (t->closed_with_error.ok() && grpc_chttp2_list_add_writable_stream(t, s)) {
|
827
816
|
GRPC_CHTTP2_STREAM_REF(s, "chttp2_writing:become");
|
828
817
|
}
|
829
818
|
}
|
@@ -841,7 +830,7 @@ static void write_action_begin_locked(void* gt,
|
|
841
830
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
|
842
831
|
GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE);
|
843
832
|
grpc_chttp2_begin_write_result r;
|
844
|
-
if (!
|
833
|
+
if (!t->closed_with_error.ok()) {
|
845
834
|
r.writing = false;
|
846
835
|
} else {
|
847
836
|
r = grpc_chttp2_begin_write(t);
|
@@ -851,7 +840,7 @@ static void write_action_begin_locked(void* gt,
|
|
851
840
|
r.partial ? GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE
|
852
841
|
: GRPC_CHTTP2_WRITE_STATE_WRITING,
|
853
842
|
begin_writing_desc(r.partial));
|
854
|
-
write_action(t,
|
843
|
+
write_action(t, absl::OkStatus());
|
855
844
|
if (t->reading_paused_on_pending_induced_frames) {
|
856
845
|
GPR_ASSERT(t->num_pending_induced_frames == 0);
|
857
846
|
// We had paused reading, because we had many induced frames (SETTINGS
|
@@ -896,7 +885,7 @@ static void write_action_end(void* tp, grpc_error_handle error) {
|
|
896
885
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
897
886
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->write_action_end_locked,
|
898
887
|
write_action_end_locked, t, nullptr),
|
899
|
-
|
888
|
+
error);
|
900
889
|
}
|
901
890
|
|
902
891
|
// Callback from the grpc_endpoint after bytes have been written by calling
|
@@ -905,8 +894,8 @@ static void write_action_end_locked(void* tp, grpc_error_handle error) {
|
|
905
894
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
906
895
|
|
907
896
|
bool closed = false;
|
908
|
-
if (!
|
909
|
-
close_transport_locked(t,
|
897
|
+
if (!error.ok()) {
|
898
|
+
close_transport_locked(t, error);
|
910
899
|
closed = true;
|
911
900
|
}
|
912
901
|
|
@@ -914,8 +903,7 @@ static void write_action_end_locked(void* tp, grpc_error_handle error) {
|
|
914
903
|
t->sent_goaway_state = GRPC_CHTTP2_FINAL_GOAWAY_SENT;
|
915
904
|
closed = true;
|
916
905
|
if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
917
|
-
close_transport_locked(
|
918
|
-
t, GRPC_ERROR_CREATE_FROM_STATIC_STRING("goaway sent"));
|
906
|
+
close_transport_locked(t, GRPC_ERROR_CREATE("goaway sent"));
|
919
907
|
}
|
920
908
|
}
|
921
909
|
|
@@ -939,11 +927,11 @@ static void write_action_end_locked(void* tp, grpc_error_handle error) {
|
|
939
927
|
t->combiner->FinallyRun(
|
940
928
|
GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
|
941
929
|
write_action_begin_locked, t, nullptr),
|
942
|
-
|
930
|
+
absl::OkStatus());
|
943
931
|
break;
|
944
932
|
}
|
945
933
|
|
946
|
-
grpc_chttp2_end_write(t,
|
934
|
+
grpc_chttp2_end_write(t, error);
|
947
935
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing");
|
948
936
|
}
|
949
937
|
|
@@ -972,9 +960,8 @@ static void cancel_unstarted_streams(grpc_chttp2_transport* t,
|
|
972
960
|
s->trailing_metadata_buffer.Set(
|
973
961
|
grpc_core::GrpcStreamNetworkState(),
|
974
962
|
grpc_core::GrpcStreamNetworkState::kNotSentOnWire);
|
975
|
-
grpc_chttp2_cancel_stream(t, s,
|
963
|
+
grpc_chttp2_cancel_stream(t, s, error);
|
976
964
|
}
|
977
|
-
GRPC_ERROR_UNREF(error);
|
978
965
|
}
|
979
966
|
|
980
967
|
void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
@@ -982,16 +969,15 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
|
982
969
|
uint32_t last_stream_id,
|
983
970
|
absl::string_view goaway_text) {
|
984
971
|
// Discard the error from a previous goaway frame (if any)
|
985
|
-
if (!
|
986
|
-
GRPC_ERROR_UNREF(t->goaway_error);
|
972
|
+
if (!t->goaway_error.ok()) {
|
987
973
|
}
|
988
974
|
t->goaway_error = grpc_error_set_str(
|
989
975
|
grpc_error_set_int(
|
990
|
-
grpc_error_set_int(
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
976
|
+
grpc_error_set_int(GRPC_ERROR_CREATE("GOAWAY received"),
|
977
|
+
grpc_core::StatusIntProperty::kHttp2Error,
|
978
|
+
static_cast<intptr_t>(goaway_error)),
|
979
|
+
grpc_core::StatusIntProperty::kRpcStatus, GRPC_STATUS_UNAVAILABLE),
|
980
|
+
grpc_core::StatusStrProperty::kRawBytes, goaway_text);
|
995
981
|
|
996
982
|
GRPC_CHTTP2_IF_TRACING(
|
997
983
|
gpr_log(GPR_INFO, "transport %p got goaway with last stream id %d", t,
|
@@ -1000,10 +986,10 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
|
1000
986
|
// received a GOAWAY with a non NO_ERROR code.
|
1001
987
|
if (goaway_error != GRPC_HTTP2_NO_ERROR) {
|
1002
988
|
gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string.c_str(),
|
1003
|
-
goaway_error,
|
989
|
+
goaway_error, grpc_core::StatusToString(t->goaway_error).c_str());
|
1004
990
|
}
|
1005
991
|
if (t->is_client) {
|
1006
|
-
cancel_unstarted_streams(t,
|
992
|
+
cancel_unstarted_streams(t, t->goaway_error);
|
1007
993
|
// Cancel all unseen streams
|
1008
994
|
grpc_chttp2_stream_map_for_each(
|
1009
995
|
&t->stream_map,
|
@@ -1014,8 +1000,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
|
1014
1000
|
s->trailing_metadata_buffer.Set(
|
1015
1001
|
grpc_core::GrpcStreamNetworkState(),
|
1016
1002
|
grpc_core::GrpcStreamNetworkState::kNotSeenByServer);
|
1017
|
-
grpc_chttp2_cancel_stream(s->t, s,
|
1018
|
-
GRPC_ERROR_REF(s->t->goaway_error));
|
1003
|
+
grpc_chttp2_cancel_stream(s->t, s, s->t->goaway_error);
|
1019
1004
|
}
|
1020
1005
|
},
|
1021
1006
|
&last_stream_id);
|
@@ -1035,7 +1020,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
|
1035
1020
|
t->peer_string.c_str(), t->keepalive_time.ToString().c_str());
|
1036
1021
|
constexpr int max_keepalive_time_millis =
|
1037
1022
|
INT_MAX / KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
|
1038
|
-
|
1023
|
+
int64_t throttled_keepalive_time =
|
1039
1024
|
t->keepalive_time.millis() > max_keepalive_time_millis
|
1040
1025
|
? INT_MAX
|
1041
1026
|
: t->keepalive_time.millis() * KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
|
@@ -1054,8 +1039,8 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
|
|
1054
1039
|
grpc_chttp2_stream* s;
|
1055
1040
|
// maybe cancel out streams that haven't yet started if we have received a
|
1056
1041
|
// GOAWAY
|
1057
|
-
if (!
|
1058
|
-
cancel_unstarted_streams(t,
|
1042
|
+
if (!t->goaway_error.ok()) {
|
1043
|
+
cancel_unstarted_streams(t, t->goaway_error);
|
1059
1044
|
return;
|
1060
1045
|
}
|
1061
1046
|
// start streams where we have free grpc_chttp2_stream ids and free
|
@@ -1095,9 +1080,9 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
|
|
1095
1080
|
grpc_core::GrpcStreamNetworkState::kNotSentOnWire);
|
1096
1081
|
grpc_chttp2_cancel_stream(
|
1097
1082
|
t, s,
|
1098
|
-
grpc_error_set_int(
|
1099
|
-
|
1100
|
-
|
1083
|
+
grpc_error_set_int(GRPC_ERROR_CREATE("Stream IDs exhausted"),
|
1084
|
+
grpc_core::StatusIntProperty::kRpcStatus,
|
1085
|
+
GRPC_STATUS_UNAVAILABLE));
|
1101
1086
|
}
|
1102
1087
|
}
|
1103
1088
|
}
|
@@ -1124,7 +1109,7 @@ static void null_then_sched_closure(grpc_closure** closure) {
|
|
1124
1109
|
// completion, have the application see it, and make a new operation on the
|
1125
1110
|
// call which recycles the batch BEFORE the call to start_batch completes,
|
1126
1111
|
// forcing a race.
|
1127
|
-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, c,
|
1112
|
+
grpc_core::ExecCtx::Run(DEBUG_LOCATION, c, absl::OkStatus());
|
1128
1113
|
}
|
1129
1114
|
|
1130
1115
|
void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
@@ -1135,7 +1120,6 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1135
1120
|
grpc_closure* closure = *pclosure;
|
1136
1121
|
*pclosure = nullptr;
|
1137
1122
|
if (closure == nullptr) {
|
1138
|
-
GRPC_ERROR_UNREF(error);
|
1139
1123
|
return;
|
1140
1124
|
}
|
1141
1125
|
closure->next_data.scratch -= CLOSURE_BARRIER_FIRST_REF_BIT;
|
@@ -1149,20 +1133,20 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|
1149
1133
|
CLOSURE_BARRIER_FIRST_REF_BIT),
|
1150
1134
|
static_cast<int>(closure->next_data.scratch %
|
1151
1135
|
CLOSURE_BARRIER_FIRST_REF_BIT),
|
1152
|
-
desc,
|
1136
|
+
desc, grpc_core::StatusToString(error).c_str(),
|
1153
1137
|
write_state_name(t->write_state));
|
1154
1138
|
}
|
1155
|
-
if (!
|
1139
|
+
if (!error.ok()) {
|
1156
1140
|
grpc_error_handle cl_err =
|
1157
1141
|
grpc_core::internal::StatusMoveFromHeapPtr(closure->error_data.error);
|
1158
|
-
if (
|
1159
|
-
cl_err =
|
1142
|
+
if (cl_err.ok()) {
|
1143
|
+
cl_err = GRPC_ERROR_CREATE(absl::StrCat(
|
1160
1144
|
"Error in HTTP transport completing operation: ", desc,
|
1161
1145
|
" write_state=", write_state_name(t->write_state), " refs=",
|
1162
1146
|
closure->next_data.scratch / CLOSURE_BARRIER_FIRST_REF_BIT, " flags=",
|
1163
1147
|
closure->next_data.scratch % CLOSURE_BARRIER_FIRST_REF_BIT));
|
1164
|
-
cl_err = grpc_error_set_str(
|
1165
|
-
|
1148
|
+
cl_err = grpc_error_set_str(
|
1149
|
+
cl_err, grpc_core::StatusStrProperty::kTargetAddress, t->peer_string);
|
1166
1150
|
}
|
1167
1151
|
cl_err = grpc_error_add_child(cl_err, error);
|
1168
1152
|
closure->error_data.error = grpc_core::internal::StatusAllocHeapPtr(cl_err);
|
@@ -1189,6 +1173,7 @@ static bool contains_non_ok_status(grpc_metadata_batch* batch) {
|
|
1189
1173
|
|
1190
1174
|
static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
|
1191
1175
|
bool is_client, bool is_initial) {
|
1176
|
+
gpr_log(GPR_INFO, "--metadata--");
|
1192
1177
|
const std::string prefix = absl::StrCat(
|
1193
1178
|
"HTTP:", id, is_initial ? ":HDR" : ":TRL", is_client ? ":CLI:" : ":SVR:");
|
1194
1179
|
md_batch->Log([&prefix](absl::string_view key, absl::string_view value) {
|
@@ -1256,7 +1241,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1256
1241
|
}
|
1257
1242
|
if (!s->write_closed) {
|
1258
1243
|
if (t->is_client) {
|
1259
|
-
if (
|
1244
|
+
if (t->closed_with_error.ok()) {
|
1260
1245
|
GPR_ASSERT(s->id == 0);
|
1261
1246
|
grpc_chttp2_list_add_waiting_for_concurrency(t, s);
|
1262
1247
|
maybe_start_some_streams(t);
|
@@ -1267,9 +1252,10 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1267
1252
|
grpc_chttp2_cancel_stream(
|
1268
1253
|
t, s,
|
1269
1254
|
grpc_error_set_int(
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1255
|
+
GRPC_ERROR_CREATE_REFERENCING("Transport closed",
|
1256
|
+
&t->closed_with_error, 1),
|
1257
|
+
grpc_core::StatusIntProperty::kRpcStatus,
|
1258
|
+
GRPC_STATUS_UNAVAILABLE));
|
1273
1259
|
}
|
1274
1260
|
} else {
|
1275
1261
|
GPR_ASSERT(s->id != 0);
|
@@ -1284,7 +1270,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1284
1270
|
s->send_initial_metadata = nullptr;
|
1285
1271
|
grpc_chttp2_complete_closure_step(
|
1286
1272
|
t, s, &s->send_initial_metadata_finished,
|
1287
|
-
|
1273
|
+
GRPC_ERROR_CREATE_REFERENCING(
|
1288
1274
|
"Attempt to send initial metadata after stream was closed",
|
1289
1275
|
&s->write_closed_error, 1),
|
1290
1276
|
"send_initial_metadata_finished");
|
@@ -1297,7 +1283,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1297
1283
|
|
1298
1284
|
if (op->send_message) {
|
1299
1285
|
t->num_messages_in_next_write++;
|
1300
|
-
|
1286
|
+
grpc_core::global_stats().IncrementHttp2SendMessageSize(
|
1301
1287
|
op->payload->send_message.send_message->Length());
|
1302
1288
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
|
1303
1289
|
s->send_message_finished = add_closure_barrier(op->on_complete);
|
@@ -1308,7 +1294,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1308
1294
|
// started. The surface layer will notice that the stream has been closed
|
1309
1295
|
// for writes and fail the send message op.
|
1310
1296
|
grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
|
1311
|
-
|
1297
|
+
absl::OkStatus(),
|
1312
1298
|
"fetching_send_message_finished");
|
1313
1299
|
} else {
|
1314
1300
|
uint8_t* frame_hdr = grpc_slice_buffer_tiny_add(
|
@@ -1337,13 +1323,13 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1337
1323
|
slices + op_payload->send_message.send_message->Count();
|
1338
1324
|
for (grpc_slice* slice = slices; slice != end; slice++) {
|
1339
1325
|
grpc_slice_buffer_add(&s->flow_controlled_buffer,
|
1340
|
-
|
1326
|
+
grpc_core::CSliceRef(*slice));
|
1341
1327
|
}
|
1342
1328
|
|
1343
1329
|
int64_t notify_offset = s->next_message_end_offset;
|
1344
1330
|
if (notify_offset <= s->flow_controlled_bytes_written) {
|
1345
1331
|
grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
|
1346
|
-
|
1332
|
+
absl::OkStatus(),
|
1347
1333
|
"fetching_send_message_finished");
|
1348
1334
|
} else {
|
1349
1335
|
grpc_chttp2_write_cb* cb = t->write_cb_pool;
|
@@ -1388,10 +1374,9 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1388
1374
|
grpc_chttp2_complete_closure_step(
|
1389
1375
|
t, s, &s->send_trailing_metadata_finished,
|
1390
1376
|
op->payload->send_trailing_metadata.send_trailing_metadata->empty()
|
1391
|
-
?
|
1392
|
-
:
|
1393
|
-
|
1394
|
-
"stream was closed"),
|
1377
|
+
? absl::OkStatus()
|
1378
|
+
: GRPC_ERROR_CREATE("Attempt to send trailing metadata after "
|
1379
|
+
"stream was closed"),
|
1395
1380
|
"send_trailing_metadata_finished");
|
1396
1381
|
} else if (s->id != 0) {
|
1397
1382
|
// TODO(ctiller): check if there's flow control for any outstanding
|
@@ -1410,6 +1395,9 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1410
1395
|
op_payload->recv_initial_metadata.recv_initial_metadata;
|
1411
1396
|
s->trailing_metadata_available =
|
1412
1397
|
op_payload->recv_initial_metadata.trailing_metadata_available;
|
1398
|
+
if (s->parsed_trailers_only && s->trailing_metadata_available != nullptr) {
|
1399
|
+
*s->trailing_metadata_available = true;
|
1400
|
+
}
|
1413
1401
|
if (op_payload->recv_initial_metadata.peer_string != nullptr) {
|
1414
1402
|
gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
|
1415
1403
|
(gpr_atm)t->peer_string.c_str());
|
@@ -1441,7 +1429,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1441
1429
|
}
|
1442
1430
|
|
1443
1431
|
if (on_complete != nullptr) {
|
1444
|
-
grpc_chttp2_complete_closure_step(t, s, &on_complete,
|
1432
|
+
grpc_chttp2_complete_closure_step(t, s, &on_complete, absl::OkStatus(),
|
1445
1433
|
"op->on_complete");
|
1446
1434
|
}
|
1447
1435
|
|
@@ -1475,49 +1463,46 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
|
|
1475
1463
|
op->handler_private.extra_arg = gs;
|
1476
1464
|
t->combiner->Run(GRPC_CLOSURE_INIT(&op->handler_private.closure,
|
1477
1465
|
perform_stream_op_locked, op, nullptr),
|
1478
|
-
|
1466
|
+
absl::OkStatus());
|
1479
1467
|
}
|
1480
1468
|
|
1481
1469
|
static void cancel_pings(grpc_chttp2_transport* t, grpc_error_handle error) {
|
1482
1470
|
// callback remaining pings: they're not allowed to call into the transport,
|
1483
1471
|
// and maybe they hold resources that need to be freed
|
1484
1472
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
1485
|
-
GPR_ASSERT(!
|
1473
|
+
GPR_ASSERT(!error.ok());
|
1486
1474
|
for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) {
|
1487
|
-
grpc_closure_list_fail_all(&pq->lists[j],
|
1475
|
+
grpc_closure_list_fail_all(&pq->lists[j], error);
|
1488
1476
|
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &pq->lists[j]);
|
1489
1477
|
}
|
1490
|
-
GRPC_ERROR_UNREF(error);
|
1491
1478
|
}
|
1492
1479
|
|
1493
1480
|
static void send_ping_locked(grpc_chttp2_transport* t,
|
1494
1481
|
grpc_closure* on_initiate, grpc_closure* on_ack) {
|
1495
|
-
if (!
|
1496
|
-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_initiate,
|
1497
|
-
|
1498
|
-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_ack,
|
1499
|
-
GRPC_ERROR_REF(t->closed_with_error));
|
1482
|
+
if (!t->closed_with_error.ok()) {
|
1483
|
+
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_initiate, t->closed_with_error);
|
1484
|
+
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_ack, t->closed_with_error);
|
1500
1485
|
return;
|
1501
1486
|
}
|
1502
1487
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
1503
1488
|
grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_INITIATE], on_initiate,
|
1504
|
-
|
1489
|
+
absl::OkStatus());
|
1505
1490
|
grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_NEXT], on_ack,
|
1506
|
-
|
1491
|
+
absl::OkStatus());
|
1507
1492
|
}
|
1508
1493
|
|
1509
1494
|
// Specialized form of send_ping_locked for keepalive ping. If there is already
|
1510
1495
|
// a ping in progress, the keepalive ping would piggyback onto that ping,
|
1511
1496
|
// instead of waiting for that ping to complete and then starting a new ping.
|
1512
1497
|
static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
|
1513
|
-
if (!
|
1498
|
+
if (!t->closed_with_error.ok()) {
|
1514
1499
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
|
1515
1500
|
start_keepalive_ping_locked, t, nullptr),
|
1516
|
-
|
1501
|
+
t->closed_with_error);
|
1517
1502
|
t->combiner->Run(
|
1518
1503
|
GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
|
1519
1504
|
finish_keepalive_ping_locked, t, nullptr),
|
1520
|
-
|
1505
|
+
t->closed_with_error);
|
1521
1506
|
return;
|
1522
1507
|
}
|
1523
1508
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
@@ -1525,37 +1510,37 @@ static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
|
|
1525
1510
|
// There is a ping in flight. Add yourself to the inflight closure list.
|
1526
1511
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
|
1527
1512
|
start_keepalive_ping_locked, t, nullptr),
|
1528
|
-
|
1513
|
+
t->closed_with_error);
|
1529
1514
|
grpc_closure_list_append(
|
1530
1515
|
&pq->lists[GRPC_CHTTP2_PCL_INFLIGHT],
|
1531
1516
|
GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
|
1532
1517
|
finish_keepalive_ping, t, grpc_schedule_on_exec_ctx),
|
1533
|
-
|
1518
|
+
absl::OkStatus());
|
1534
1519
|
return;
|
1535
1520
|
}
|
1536
1521
|
grpc_closure_list_append(
|
1537
1522
|
&pq->lists[GRPC_CHTTP2_PCL_INITIATE],
|
1538
1523
|
GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked, start_keepalive_ping,
|
1539
1524
|
t, grpc_schedule_on_exec_ctx),
|
1540
|
-
|
1525
|
+
absl::OkStatus());
|
1541
1526
|
grpc_closure_list_append(
|
1542
1527
|
&pq->lists[GRPC_CHTTP2_PCL_NEXT],
|
1543
1528
|
GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked, finish_keepalive_ping,
|
1544
1529
|
t, grpc_schedule_on_exec_ctx),
|
1545
|
-
|
1530
|
+
absl::OkStatus());
|
1546
1531
|
}
|
1547
1532
|
|
1548
1533
|
void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error_handle error) {
|
1549
1534
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
1550
1535
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->retry_initiate_ping_locked,
|
1551
1536
|
retry_initiate_ping_locked, t, nullptr),
|
1552
|
-
|
1537
|
+
error);
|
1553
1538
|
}
|
1554
1539
|
|
1555
1540
|
static void retry_initiate_ping_locked(void* tp, grpc_error_handle error) {
|
1556
1541
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
1557
1542
|
t->ping_state.is_delayed_ping_timer_set = false;
|
1558
|
-
if (
|
1543
|
+
if (error.ok()) {
|
1559
1544
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
|
1560
1545
|
}
|
1561
1546
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "retry_initiate_ping_locked");
|
@@ -1611,7 +1596,7 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
|
|
1611
1596
|
// We already sent the final GOAWAY.
|
1612
1597
|
return;
|
1613
1598
|
}
|
1614
|
-
if (t_->destroying || !
|
1599
|
+
if (t_->destroying || !t_->closed_with_error.ok()) {
|
1615
1600
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
1616
1601
|
GPR_INFO,
|
1617
1602
|
"transport:%p %s peer:%s Transport already shutting down. "
|
@@ -1636,7 +1621,7 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
|
|
1636
1621
|
auto* self = static_cast<GracefulGoaway*>(arg);
|
1637
1622
|
self->t_->combiner->Run(
|
1638
1623
|
GRPC_CLOSURE_INIT(&self->on_ping_ack_, OnPingAckLocked, self, nullptr),
|
1639
|
-
|
1624
|
+
absl::OkStatus());
|
1640
1625
|
}
|
1641
1626
|
|
1642
1627
|
static void OnPingAckLocked(void* arg, grpc_error_handle /* error */) {
|
@@ -1648,13 +1633,13 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
|
|
1648
1633
|
|
1649
1634
|
static void OnTimer(void* arg, grpc_error_handle error) {
|
1650
1635
|
auto* self = static_cast<GracefulGoaway*>(arg);
|
1651
|
-
if (!
|
1636
|
+
if (!error.ok()) {
|
1652
1637
|
self->Unref();
|
1653
1638
|
return;
|
1654
1639
|
}
|
1655
1640
|
self->t_->combiner->Run(
|
1656
1641
|
GRPC_CLOSURE_INIT(&self->on_timer_, OnTimerLocked, self, nullptr),
|
1657
|
-
|
1642
|
+
absl::OkStatus());
|
1658
1643
|
}
|
1659
1644
|
|
1660
1645
|
static void OnTimerLocked(void* arg, grpc_error_handle /* error */) {
|
@@ -1689,7 +1674,7 @@ static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error,
|
|
1689
1674
|
t->sent_goaway_state == GRPC_CHTTP2_GRACEFUL_GOAWAY) {
|
1690
1675
|
// We want to log this irrespective of whether http tracing is enabled
|
1691
1676
|
gpr_log(GPR_DEBUG, "%s: Sending goaway err=%s", t->peer_string.c_str(),
|
1692
|
-
|
1677
|
+
grpc_core::StatusToString(error).c_str());
|
1693
1678
|
t->sent_goaway_state = GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED;
|
1694
1679
|
grpc_chttp2_goaway_append(
|
1695
1680
|
t->last_new_stream_id, static_cast<uint32_t>(http_error),
|
@@ -1698,22 +1683,21 @@ static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error,
|
|
1698
1683
|
// Final GOAWAY has already been sent.
|
1699
1684
|
}
|
1700
1685
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT);
|
1701
|
-
GRPC_ERROR_UNREF(error);
|
1702
1686
|
}
|
1703
1687
|
|
1704
1688
|
void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t) {
|
1705
1689
|
if (++t->ping_recv_state.ping_strikes > t->ping_policy.max_ping_strikes &&
|
1706
1690
|
t->ping_policy.max_ping_strikes != 0) {
|
1707
1691
|
send_goaway(t,
|
1708
|
-
grpc_error_set_int(
|
1709
|
-
|
1710
|
-
|
1692
|
+
grpc_error_set_int(GRPC_ERROR_CREATE("too_many_pings"),
|
1693
|
+
grpc_core::StatusIntProperty::kHttp2Error,
|
1694
|
+
GRPC_HTTP2_ENHANCE_YOUR_CALM),
|
1711
1695
|
/*immediate_disconnect_hint=*/true);
|
1712
1696
|
// The transport will be closed after the write is done
|
1713
1697
|
close_transport_locked(
|
1714
|
-
t, grpc_error_set_int(
|
1715
|
-
|
1716
|
-
|
1698
|
+
t, grpc_error_set_int(GRPC_ERROR_CREATE("Too many pings"),
|
1699
|
+
grpc_core::StatusIntProperty::kRpcStatus,
|
1700
|
+
GRPC_STATUS_UNAVAILABLE));
|
1717
1701
|
}
|
1718
1702
|
}
|
1719
1703
|
|
@@ -1732,7 +1716,7 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1732
1716
|
grpc_chttp2_transport* t =
|
1733
1717
|
static_cast<grpc_chttp2_transport*>(op->handler_private.extra_arg);
|
1734
1718
|
|
1735
|
-
if (!
|
1719
|
+
if (!op->goaway_error.ok()) {
|
1736
1720
|
send_goaway(t, op->goaway_error, /*immediate_disconnect_hint=*/false);
|
1737
1721
|
}
|
1738
1722
|
|
@@ -1762,13 +1746,13 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1762
1746
|
t->state_tracker.RemoveWatcher(op->stop_connectivity_watch);
|
1763
1747
|
}
|
1764
1748
|
|
1765
|
-
if (!
|
1766
|
-
send_goaway(t,
|
1749
|
+
if (!op->disconnect_with_error.ok()) {
|
1750
|
+
send_goaway(t, op->disconnect_with_error,
|
1767
1751
|
/*immediate_disconnect_hint=*/true);
|
1768
1752
|
close_transport_locked(t, op->disconnect_with_error);
|
1769
1753
|
}
|
1770
1754
|
|
1771
|
-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, op->on_consumed,
|
1755
|
+
grpc_core::ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, absl::OkStatus());
|
1772
1756
|
|
1773
1757
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "transport_op");
|
1774
1758
|
}
|
@@ -1783,7 +1767,7 @@ static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
|
|
1783
1767
|
GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op");
|
1784
1768
|
t->combiner->Run(GRPC_CLOSURE_INIT(&op->handler_private.closure,
|
1785
1769
|
perform_transport_op_locked, op, nullptr),
|
1786
|
-
|
1770
|
+
absl::OkStatus());
|
1787
1771
|
}
|
1788
1772
|
|
1789
1773
|
//
|
@@ -1795,7 +1779,7 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
|
|
1795
1779
|
if (s->recv_initial_metadata_ready != nullptr &&
|
1796
1780
|
s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) {
|
1797
1781
|
if (s->seen_error) {
|
1798
|
-
|
1782
|
+
grpc_slice_buffer_reset_and_unref(&s->frame_storage);
|
1799
1783
|
}
|
1800
1784
|
*s->recv_initial_metadata = std::move(s->initial_metadata_buffer);
|
1801
1785
|
s->recv_initial_metadata->Set(grpc_core::PeerString(), t->peer_string);
|
@@ -1818,24 +1802,24 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
|
|
1818
1802
|
|
1819
1803
|
grpc_core::chttp2::StreamFlowControl::IncomingUpdateContext upd(
|
1820
1804
|
&s->flow_control);
|
1821
|
-
grpc_error_handle error
|
1805
|
+
grpc_error_handle error;
|
1822
1806
|
|
1823
1807
|
// Lambda is immediately invoked as a big scoped section that can be
|
1824
1808
|
// exited out of at any point by returning.
|
1825
1809
|
[&]() {
|
1826
1810
|
if (s->final_metadata_requested && s->seen_error) {
|
1827
|
-
|
1811
|
+
grpc_slice_buffer_reset_and_unref(&s->frame_storage);
|
1828
1812
|
s->recv_message->reset();
|
1829
1813
|
} else {
|
1830
1814
|
if (s->frame_storage.length != 0) {
|
1831
1815
|
while (true) {
|
1832
1816
|
GPR_ASSERT(s->frame_storage.length > 0);
|
1833
|
-
|
1817
|
+
int64_t min_progress_size;
|
1834
1818
|
auto r = grpc_deframe_unprocessed_incoming_frames(
|
1835
1819
|
s, &min_progress_size, &**s->recv_message, s->recv_message_flags);
|
1836
1820
|
if (absl::holds_alternative<grpc_core::Pending>(r)) {
|
1837
1821
|
if (s->read_closed) {
|
1838
|
-
|
1822
|
+
grpc_slice_buffer_reset_and_unref(&s->frame_storage);
|
1839
1823
|
s->recv_message->reset();
|
1840
1824
|
break;
|
1841
1825
|
} else {
|
@@ -1844,9 +1828,9 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
|
|
1844
1828
|
}
|
1845
1829
|
} else {
|
1846
1830
|
error = absl::get<grpc_error_handle>(r);
|
1847
|
-
if (!
|
1831
|
+
if (!error.ok()) {
|
1848
1832
|
s->seen_error = true;
|
1849
|
-
|
1833
|
+
grpc_slice_buffer_reset_and_unref(&s->frame_storage);
|
1850
1834
|
break;
|
1851
1835
|
} else {
|
1852
1836
|
if (t->channelz_socket != nullptr) {
|
@@ -1865,7 +1849,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
|
|
1865
1849
|
}
|
1866
1850
|
// save the length of the buffer before handing control back to application
|
1867
1851
|
// threads. Needed to support correct flow control bookkeeping
|
1868
|
-
if (
|
1852
|
+
if (error.ok() && s->recv_message->has_value()) {
|
1869
1853
|
null_then_sched_closure(&s->recv_message_ready);
|
1870
1854
|
} else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
|
1871
1855
|
if (s->call_failed_before_recv_message != nullptr) {
|
@@ -1874,7 +1858,6 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
|
|
1874
1858
|
}
|
1875
1859
|
null_then_sched_closure(&s->recv_message_ready);
|
1876
1860
|
}
|
1877
|
-
GRPC_ERROR_UNREF(error);
|
1878
1861
|
}();
|
1879
1862
|
|
1880
1863
|
upd.SetPendingSize(s->frame_storage.length);
|
@@ -1887,7 +1870,7 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
|
1887
1870
|
if (s->recv_trailing_metadata_finished != nullptr && s->read_closed &&
|
1888
1871
|
s->write_closed) {
|
1889
1872
|
if (s->seen_error || !t->is_client) {
|
1890
|
-
|
1873
|
+
grpc_slice_buffer_reset_and_unref(&s->frame_storage);
|
1891
1874
|
}
|
1892
1875
|
if (s->read_closed && s->frame_storage.length == 0 &&
|
1893
1876
|
s->recv_trailing_metadata_finished != nullptr) {
|
@@ -1914,7 +1897,7 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
|
|
1914
1897
|
post_benign_reclaimer(t);
|
1915
1898
|
if (t->sent_goaway_state == GRPC_CHTTP2_FINAL_GOAWAY_SENT) {
|
1916
1899
|
close_transport_locked(
|
1917
|
-
t,
|
1900
|
+
t, GRPC_ERROR_CREATE_REFERENCING(
|
1918
1901
|
"Last stream closed after sending GOAWAY", &error, 1));
|
1919
1902
|
}
|
1920
1903
|
}
|
@@ -1924,8 +1907,6 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
|
|
1924
1907
|
grpc_chttp2_list_remove_stalled_by_stream(t, s);
|
1925
1908
|
grpc_chttp2_list_remove_stalled_by_transport(t, s);
|
1926
1909
|
|
1927
|
-
GRPC_ERROR_UNREF(error);
|
1928
|
-
|
1929
1910
|
maybe_start_some_streams(t);
|
1930
1911
|
}
|
1931
1912
|
|
@@ -1947,7 +1928,7 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|
1947
1928
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
|
1948
1929
|
}
|
1949
1930
|
}
|
1950
|
-
if (!
|
1931
|
+
if (!due_to_error.ok() && !s->seen_error) {
|
1951
1932
|
s->seen_error = true;
|
1952
1933
|
}
|
1953
1934
|
grpc_chttp2_mark_stream_closed(t, s, 1, 1, due_to_error);
|
@@ -1979,13 +1960,11 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|
1979
1960
|
s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE;
|
1980
1961
|
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
1981
1962
|
}
|
1982
|
-
|
1983
|
-
GRPC_ERROR_UNREF(error);
|
1984
1963
|
}
|
1985
1964
|
|
1986
1965
|
static void add_error(grpc_error_handle error, grpc_error_handle* refs,
|
1987
1966
|
size_t* nrefs) {
|
1988
|
-
if (
|
1967
|
+
if (error.ok()) return;
|
1989
1968
|
for (size_t i = 0; i < *nrefs; i++) {
|
1990
1969
|
if (error == refs[i]) {
|
1991
1970
|
return;
|
@@ -2003,12 +1982,10 @@ static grpc_error_handle removal_error(grpc_error_handle extra_error,
|
|
2003
1982
|
add_error(s->read_closed_error, refs, &nrefs);
|
2004
1983
|
add_error(s->write_closed_error, refs, &nrefs);
|
2005
1984
|
add_error(extra_error, refs, &nrefs);
|
2006
|
-
grpc_error_handle error
|
1985
|
+
grpc_error_handle error;
|
2007
1986
|
if (nrefs > 0) {
|
2008
|
-
error =
|
2009
|
-
refs, nrefs);
|
1987
|
+
error = GRPC_ERROR_CREATE_REFERENCING(main_error_msg, refs, nrefs);
|
2010
1988
|
}
|
2011
|
-
GRPC_ERROR_UNREF(extra_error);
|
2012
1989
|
return error;
|
2013
1990
|
}
|
2014
1991
|
|
@@ -2018,12 +1995,11 @@ static void flush_write_list(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|
2018
1995
|
while (*list) {
|
2019
1996
|
grpc_chttp2_write_cb* cb = *list;
|
2020
1997
|
*list = cb->next;
|
2021
|
-
grpc_chttp2_complete_closure_step(t, s, &cb->closure,
|
1998
|
+
grpc_chttp2_complete_closure_step(t, s, &cb->closure, error,
|
2022
1999
|
"on_write_finished_cb");
|
2023
2000
|
cb->next = t->write_cb_pool;
|
2024
2001
|
t->write_cb_pool = cb;
|
2025
2002
|
}
|
2026
|
-
GRPC_ERROR_UNREF(error);
|
2027
2003
|
}
|
2028
2004
|
|
2029
2005
|
void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
@@ -2033,19 +2009,16 @@ void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
|
2033
2009
|
removal_error(error, s, "Pending writes failed due to stream closure");
|
2034
2010
|
s->send_initial_metadata = nullptr;
|
2035
2011
|
grpc_chttp2_complete_closure_step(t, s, &s->send_initial_metadata_finished,
|
2036
|
-
|
2037
|
-
"send_initial_metadata_finished");
|
2012
|
+
error, "send_initial_metadata_finished");
|
2038
2013
|
|
2039
2014
|
s->send_trailing_metadata = nullptr;
|
2040
2015
|
s->sent_trailing_metadata_op = nullptr;
|
2041
2016
|
grpc_chttp2_complete_closure_step(t, s, &s->send_trailing_metadata_finished,
|
2042
|
-
|
2043
|
-
"send_trailing_metadata_finished");
|
2017
|
+
error, "send_trailing_metadata_finished");
|
2044
2018
|
|
2045
|
-
grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
|
2046
|
-
GRPC_ERROR_REF(error),
|
2019
|
+
grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished, error,
|
2047
2020
|
"fetching_send_message_finished");
|
2048
|
-
flush_write_list(t, s, &s->on_write_finished_cbs,
|
2021
|
+
flush_write_list(t, s, &s->on_write_finished_cbs, error);
|
2049
2022
|
flush_write_list(t, s, &s->on_flow_controlled_cbs, error);
|
2050
2023
|
}
|
2051
2024
|
|
@@ -2055,7 +2028,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|
2055
2028
|
if (s->read_closed && s->write_closed) {
|
2056
2029
|
// already closed, but we should still fake the status if needed.
|
2057
2030
|
grpc_error_handle overall_error = removal_error(error, s, "Stream removed");
|
2058
|
-
if (!
|
2031
|
+
if (!overall_error.ok()) {
|
2059
2032
|
grpc_chttp2_fake_status(t, s, overall_error);
|
2060
2033
|
}
|
2061
2034
|
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
@@ -2064,26 +2037,25 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|
2064
2037
|
bool closed_read = false;
|
2065
2038
|
bool became_closed = false;
|
2066
2039
|
if (close_reads && !s->read_closed) {
|
2067
|
-
s->read_closed_error =
|
2040
|
+
s->read_closed_error = error;
|
2068
2041
|
s->read_closed = true;
|
2069
2042
|
closed_read = true;
|
2070
2043
|
}
|
2071
2044
|
if (close_writes && !s->write_closed) {
|
2072
|
-
s->write_closed_error =
|
2045
|
+
s->write_closed_error = error;
|
2073
2046
|
s->write_closed = true;
|
2074
|
-
grpc_chttp2_fail_pending_writes(t, s,
|
2047
|
+
grpc_chttp2_fail_pending_writes(t, s, error);
|
2075
2048
|
}
|
2076
2049
|
if (s->read_closed && s->write_closed) {
|
2077
2050
|
became_closed = true;
|
2078
|
-
grpc_error_handle overall_error =
|
2079
|
-
removal_error(GRPC_ERROR_REF(error), s, "Stream removed");
|
2051
|
+
grpc_error_handle overall_error = removal_error(error, s, "Stream removed");
|
2080
2052
|
if (s->id != 0) {
|
2081
|
-
remove_stream(t, s->id,
|
2053
|
+
remove_stream(t, s->id, overall_error);
|
2082
2054
|
} else {
|
2083
2055
|
// Purge streams waiting on concurrency still waiting for id assignment
|
2084
2056
|
grpc_chttp2_list_remove_waiting_for_concurrency(t, s);
|
2085
2057
|
}
|
2086
|
-
if (!
|
2058
|
+
if (!overall_error.ok()) {
|
2087
2059
|
grpc_chttp2_fake_status(t, s, overall_error);
|
2088
2060
|
}
|
2089
2061
|
}
|
@@ -2100,7 +2072,6 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|
2100
2072
|
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
|
2101
2073
|
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2");
|
2102
2074
|
}
|
2103
|
-
GRPC_ERROR_UNREF(error);
|
2104
2075
|
}
|
2105
2076
|
|
2106
2077
|
static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
@@ -2209,7 +2180,7 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|
2209
2180
|
|
2210
2181
|
size_t msg_len = message.length();
|
2211
2182
|
GPR_ASSERT(msg_len <= UINT32_MAX);
|
2212
|
-
grpc_core::VarintWriter<1> msg_len_writer(msg_len);
|
2183
|
+
grpc_core::VarintWriter<1> msg_len_writer(static_cast<uint32_t>(msg_len));
|
2213
2184
|
message_pfx = GRPC_SLICE_MALLOC(14 + msg_len_writer.length());
|
2214
2185
|
p = GRPC_SLICE_START_PTR(message_pfx);
|
2215
2186
|
*p++ = 0x00; /* literal header, not indexed */
|
@@ -2270,7 +2241,7 @@ struct cancel_stream_cb_args {
|
|
2270
2241
|
static void cancel_stream_cb(void* user_data, uint32_t /*key*/, void* stream) {
|
2271
2242
|
cancel_stream_cb_args* args = static_cast<cancel_stream_cb_args*>(user_data);
|
2272
2243
|
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(stream);
|
2273
|
-
grpc_chttp2_cancel_stream(args->t, s,
|
2244
|
+
grpc_chttp2_cancel_stream(args->t, s, args->error);
|
2274
2245
|
}
|
2275
2246
|
|
2276
2247
|
static void end_all_the_calls(grpc_chttp2_transport* t,
|
@@ -2278,14 +2249,14 @@ static void end_all_the_calls(grpc_chttp2_transport* t,
|
|
2278
2249
|
intptr_t http2_error;
|
2279
2250
|
// If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server.
|
2280
2251
|
if (!t->is_client && !grpc_error_has_clear_grpc_status(error) &&
|
2281
|
-
!grpc_error_get_int(error,
|
2282
|
-
|
2252
|
+
!grpc_error_get_int(error, grpc_core::StatusIntProperty::kHttp2Error,
|
2253
|
+
&http2_error)) {
|
2254
|
+
error = grpc_error_set_int(error, grpc_core::StatusIntProperty::kRpcStatus,
|
2283
2255
|
GRPC_STATUS_UNAVAILABLE);
|
2284
2256
|
}
|
2285
|
-
cancel_unstarted_streams(t,
|
2257
|
+
cancel_unstarted_streams(t, error);
|
2286
2258
|
cancel_stream_cb_args args = {error, t};
|
2287
2259
|
grpc_chttp2_stream_map_for_each(&t->stream_map, cancel_stream_cb, &args);
|
2288
|
-
GRPC_ERROR_UNREF(error);
|
2289
2260
|
}
|
2290
2261
|
|
2291
2262
|
//
|
@@ -2335,26 +2306,25 @@ void grpc_chttp2_act_on_flowctl_action(
|
|
2335
2306
|
static grpc_error_handle try_http_parsing(grpc_chttp2_transport* t) {
|
2336
2307
|
grpc_http_parser parser;
|
2337
2308
|
size_t i = 0;
|
2338
|
-
grpc_error_handle error
|
2309
|
+
grpc_error_handle error;
|
2339
2310
|
grpc_http_response response;
|
2340
2311
|
|
2341
2312
|
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
|
2342
2313
|
|
2343
|
-
grpc_error_handle parse_error
|
2344
|
-
for (; i < t->read_buffer.count &&
|
2314
|
+
grpc_error_handle parse_error;
|
2315
|
+
for (; i < t->read_buffer.count && parse_error.ok(); i++) {
|
2345
2316
|
parse_error =
|
2346
2317
|
grpc_http_parser_parse(&parser, t->read_buffer.slices[i], nullptr);
|
2347
2318
|
}
|
2348
|
-
if (
|
2349
|
-
(parse_error = grpc_http_parser_eof(&parser)) ==
|
2319
|
+
if (parse_error.ok() &&
|
2320
|
+
(parse_error = grpc_http_parser_eof(&parser)) == absl::OkStatus()) {
|
2350
2321
|
error = grpc_error_set_int(
|
2351
|
-
grpc_error_set_int(
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2322
|
+
grpc_error_set_int(
|
2323
|
+
GRPC_ERROR_CREATE("Trying to connect an http1.x server"),
|
2324
|
+
grpc_core::StatusIntProperty::kHttpStatus, response.status),
|
2325
|
+
grpc_core::StatusIntProperty::kRpcStatus,
|
2355
2326
|
grpc_http2_status_to_grpc_status(response.status));
|
2356
2327
|
}
|
2357
|
-
GRPC_ERROR_UNREF(parse_error);
|
2358
2328
|
|
2359
2329
|
grpc_http_parser_destroy(&parser);
|
2360
2330
|
grpc_http_response_destroy(&response);
|
@@ -2365,38 +2335,31 @@ static void read_action(void* tp, grpc_error_handle error) {
|
|
2365
2335
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2366
2336
|
t->combiner->Run(
|
2367
2337
|
GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, nullptr),
|
2368
|
-
|
2338
|
+
error);
|
2369
2339
|
}
|
2370
2340
|
|
2371
2341
|
static void read_action_locked(void* tp, grpc_error_handle error) {
|
2372
2342
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2373
2343
|
|
2374
|
-
(void)GRPC_ERROR_REF(error);
|
2375
|
-
|
2376
2344
|
grpc_error_handle err = error;
|
2377
|
-
if (!
|
2378
|
-
err = grpc_error_set_int(
|
2379
|
-
|
2380
|
-
|
2381
|
-
t->write_state);
|
2345
|
+
if (!err.ok()) {
|
2346
|
+
err = grpc_error_set_int(
|
2347
|
+
GRPC_ERROR_CREATE_REFERENCING("Endpoint read failed", &err, 1),
|
2348
|
+
grpc_core::StatusIntProperty::kOccurredDuringWrite, t->write_state);
|
2382
2349
|
}
|
2383
2350
|
std::swap(err, error);
|
2384
|
-
|
2385
|
-
if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
|
2351
|
+
if (t->closed_with_error.ok()) {
|
2386
2352
|
size_t i = 0;
|
2387
|
-
grpc_error_handle errors[3] = {
|
2388
|
-
|
2389
|
-
for (; i < t->read_buffer.count && errors[1] == GRPC_ERROR_NONE; i++) {
|
2353
|
+
grpc_error_handle errors[3] = {error, absl::OkStatus(), absl::OkStatus()};
|
2354
|
+
for (; i < t->read_buffer.count && errors[1] == absl::OkStatus(); i++) {
|
2390
2355
|
errors[1] = grpc_chttp2_perform_read(t, t->read_buffer.slices[i]);
|
2391
2356
|
}
|
2392
|
-
if (errors[1] !=
|
2357
|
+
if (errors[1] != absl::OkStatus()) {
|
2393
2358
|
errors[2] = try_http_parsing(t);
|
2394
|
-
|
2395
|
-
|
2396
|
-
"Failed parsing HTTP/2", errors, GPR_ARRAY_SIZE(errors));
|
2359
|
+
error = GRPC_ERROR_CREATE_REFERENCING("Failed parsing HTTP/2", errors,
|
2360
|
+
GPR_ARRAY_SIZE(errors));
|
2397
2361
|
}
|
2398
2362
|
for (i = 0; i < GPR_ARRAY_SIZE(errors); i++) {
|
2399
|
-
GRPC_ERROR_UNREF(errors[i]);
|
2400
2363
|
}
|
2401
2364
|
|
2402
2365
|
if (t->initial_window_update != 0) {
|
@@ -2413,27 +2376,27 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2413
2376
|
}
|
2414
2377
|
|
2415
2378
|
bool keep_reading = false;
|
2416
|
-
if (
|
2417
|
-
error =
|
2418
|
-
|
2379
|
+
if (error.ok() && !t->closed_with_error.ok()) {
|
2380
|
+
error = GRPC_ERROR_CREATE_REFERENCING("Transport closed",
|
2381
|
+
&t->closed_with_error, 1);
|
2419
2382
|
}
|
2420
|
-
if (!
|
2383
|
+
if (!error.ok()) {
|
2421
2384
|
// If a goaway frame was received, this might be the reason why the read
|
2422
2385
|
// failed. Add this info to the error
|
2423
|
-
if (!
|
2424
|
-
error = grpc_error_add_child(error,
|
2386
|
+
if (!t->goaway_error.ok()) {
|
2387
|
+
error = grpc_error_add_child(error, t->goaway_error);
|
2425
2388
|
}
|
2426
2389
|
|
2427
|
-
close_transport_locked(t,
|
2390
|
+
close_transport_locked(t, error);
|
2428
2391
|
t->endpoint_reading = 0;
|
2429
|
-
} else if (
|
2392
|
+
} else if (t->closed_with_error.ok()) {
|
2430
2393
|
keep_reading = true;
|
2431
2394
|
// Since we have read a byte, reset the keepalive timer
|
2432
2395
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
|
2433
2396
|
grpc_timer_cancel(&t->keepalive_ping_timer);
|
2434
2397
|
}
|
2435
2398
|
}
|
2436
|
-
|
2399
|
+
grpc_slice_buffer_reset_and_unref(&t->read_buffer);
|
2437
2400
|
|
2438
2401
|
if (keep_reading) {
|
2439
2402
|
if (t->num_pending_induced_frames >= DEFAULT_MAX_PENDING_INDUCED_FRAMES) {
|
@@ -2449,12 +2412,10 @@ static void read_action_locked(void* tp, grpc_error_handle error) {
|
|
2449
2412
|
} else {
|
2450
2413
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action");
|
2451
2414
|
}
|
2452
|
-
|
2453
|
-
GRPC_ERROR_UNREF(error);
|
2454
2415
|
}
|
2455
2416
|
|
2456
2417
|
static void continue_read_action_locked(grpc_chttp2_transport* t) {
|
2457
|
-
const bool urgent = !
|
2418
|
+
const bool urgent = !t->goaway_error.ok();
|
2458
2419
|
GRPC_CLOSURE_INIT(&t->read_action_locked, read_action, t,
|
2459
2420
|
grpc_schedule_on_exec_ctx);
|
2460
2421
|
grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent,
|
@@ -2478,16 +2439,16 @@ static void start_bdp_ping(void* tp, grpc_error_handle error) {
|
|
2478
2439
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2479
2440
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked,
|
2480
2441
|
start_bdp_ping_locked, t, nullptr),
|
2481
|
-
|
2442
|
+
error);
|
2482
2443
|
}
|
2483
2444
|
|
2484
2445
|
static void start_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
2485
2446
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2486
2447
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
2487
2448
|
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string.c_str(),
|
2488
|
-
|
2449
|
+
grpc_core::StatusToString(error).c_str());
|
2489
2450
|
}
|
2490
|
-
if (!
|
2451
|
+
if (!error.ok() || !t->closed_with_error.ok()) {
|
2491
2452
|
return;
|
2492
2453
|
}
|
2493
2454
|
// Reset the keepalive ping timer
|
@@ -2502,16 +2463,16 @@ static void finish_bdp_ping(void* tp, grpc_error_handle error) {
|
|
2502
2463
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2503
2464
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked,
|
2504
2465
|
finish_bdp_ping_locked, t, nullptr),
|
2505
|
-
|
2466
|
+
error);
|
2506
2467
|
}
|
2507
2468
|
|
2508
2469
|
static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
2509
2470
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2510
2471
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
2511
2472
|
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string.c_str(),
|
2512
|
-
|
2473
|
+
grpc_core::StatusToString(error).c_str());
|
2513
2474
|
}
|
2514
|
-
if (!
|
2475
|
+
if (!error.ok() || !t->closed_with_error.ok()) {
|
2515
2476
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2516
2477
|
return;
|
2517
2478
|
}
|
@@ -2520,7 +2481,7 @@ static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
|
2520
2481
|
// finish_bdp_ping_locked to be run later.
|
2521
2482
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked,
|
2522
2483
|
finish_bdp_ping_locked, t, nullptr),
|
2523
|
-
|
2484
|
+
error);
|
2524
2485
|
return;
|
2525
2486
|
}
|
2526
2487
|
t->bdp_ping_started = false;
|
@@ -2541,7 +2502,7 @@ static void next_bdp_ping_timer_expired(void* tp, grpc_error_handle error) {
|
|
2541
2502
|
t->combiner->Run(
|
2542
2503
|
GRPC_CLOSURE_INIT(&t->next_bdp_ping_timer_expired_locked,
|
2543
2504
|
next_bdp_ping_timer_expired_locked, t, nullptr),
|
2544
|
-
|
2505
|
+
error);
|
2545
2506
|
}
|
2546
2507
|
|
2547
2508
|
static void next_bdp_ping_timer_expired_locked(void* tp,
|
@@ -2549,7 +2510,7 @@ static void next_bdp_ping_timer_expired_locked(void* tp,
|
|
2549
2510
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
2550
2511
|
GPR_ASSERT(t->have_next_bdp_ping_timer);
|
2551
2512
|
t->have_next_bdp_ping_timer = false;
|
2552
|
-
if (!
|
2513
|
+
if (!error.ok()) {
|
2553
2514
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
|
2554
2515
|
return;
|
2555
2516
|
}
|
@@ -2625,15 +2586,15 @@ static void init_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2625
2586
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2626
2587
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked,
|
2627
2588
|
init_keepalive_ping_locked, t, nullptr),
|
2628
|
-
|
2589
|
+
error);
|
2629
2590
|
}
|
2630
2591
|
|
2631
2592
|
static void init_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2632
2593
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2633
2594
|
GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING);
|
2634
|
-
if (t->destroying || !
|
2595
|
+
if (t->destroying || !t->closed_with_error.ok()) {
|
2635
2596
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
|
2636
|
-
} else if (
|
2597
|
+
} else if (error.ok()) {
|
2637
2598
|
if (t->keepalive_permit_without_calls ||
|
2638
2599
|
grpc_chttp2_stream_map_size(&t->stream_map) > 0) {
|
2639
2600
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING;
|
@@ -2649,7 +2610,7 @@ static void init_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
|
2649
2610
|
grpc_core::Timestamp::Now() + t->keepalive_time,
|
2650
2611
|
&t->init_keepalive_ping_locked);
|
2651
2612
|
}
|
2652
|
-
} else if (error ==
|
2613
|
+
} else if (error == absl::CancelledError()) {
|
2653
2614
|
// The keepalive ping timer may be cancelled by bdp
|
2654
2615
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
|
2655
2616
|
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
|
@@ -2670,12 +2631,12 @@ static void start_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2670
2631
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2671
2632
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
|
2672
2633
|
start_keepalive_ping_locked, t, nullptr),
|
2673
|
-
|
2634
|
+
error);
|
2674
2635
|
}
|
2675
2636
|
|
2676
2637
|
static void start_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2677
2638
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2678
|
-
if (!
|
2639
|
+
if (!error.ok()) {
|
2679
2640
|
return;
|
2680
2641
|
}
|
2681
2642
|
if (t->channelz_socket != nullptr) {
|
@@ -2698,13 +2659,13 @@ static void finish_keepalive_ping(void* arg, grpc_error_handle error) {
|
|
2698
2659
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2699
2660
|
t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
|
2700
2661
|
finish_keepalive_ping_locked, t, nullptr),
|
2701
|
-
|
2662
|
+
error);
|
2702
2663
|
}
|
2703
2664
|
|
2704
2665
|
static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
2705
2666
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2706
2667
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2707
|
-
if (
|
2668
|
+
if (error.ok()) {
|
2708
2669
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
|
2709
2670
|
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
|
2710
2671
|
gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string.c_str());
|
@@ -2715,7 +2676,7 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
|
2715
2676
|
t->combiner->Run(
|
2716
2677
|
GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
|
2717
2678
|
finish_keepalive_ping_locked, t, nullptr),
|
2718
|
-
|
2679
|
+
error);
|
2719
2680
|
return;
|
2720
2681
|
}
|
2721
2682
|
t->keepalive_ping_started = false;
|
@@ -2737,27 +2698,26 @@ static void keepalive_watchdog_fired(void* arg, grpc_error_handle error) {
|
|
2737
2698
|
t->combiner->Run(
|
2738
2699
|
GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
|
2739
2700
|
keepalive_watchdog_fired_locked, t, nullptr),
|
2740
|
-
|
2701
|
+
error);
|
2741
2702
|
}
|
2742
2703
|
|
2743
2704
|
static void keepalive_watchdog_fired_locked(void* arg,
|
2744
2705
|
grpc_error_handle error) {
|
2745
2706
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2746
2707
|
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
2747
|
-
if (
|
2708
|
+
if (error.ok()) {
|
2748
2709
|
gpr_log(GPR_INFO, "%s: Keepalive watchdog fired. Closing transport.",
|
2749
2710
|
t->peer_string.c_str());
|
2750
2711
|
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
|
2751
2712
|
close_transport_locked(
|
2752
|
-
t, grpc_error_set_int(
|
2753
|
-
|
2754
|
-
GRPC_ERROR_INT_GRPC_STATUS,
|
2713
|
+
t, grpc_error_set_int(GRPC_ERROR_CREATE("keepalive watchdog timeout"),
|
2714
|
+
grpc_core::StatusIntProperty::kRpcStatus,
|
2755
2715
|
GRPC_STATUS_UNAVAILABLE));
|
2756
2716
|
}
|
2757
2717
|
} else {
|
2758
2718
|
// The watchdog timer should have been cancelled by
|
2759
2719
|
// finish_keepalive_ping_locked.
|
2760
|
-
if (GPR_UNLIKELY(error !=
|
2720
|
+
if (GPR_UNLIKELY(error != absl::CancelledError())) {
|
2761
2721
|
gpr_log(GPR_ERROR, "keepalive_ping_end state error: %d (expect: %d)",
|
2762
2722
|
t->keepalive_state, GRPC_CHTTP2_KEEPALIVE_STATE_PINGING);
|
2763
2723
|
}
|
@@ -2810,7 +2770,7 @@ static void post_benign_reclaimer(grpc_chttp2_transport* t) {
|
|
2810
2770
|
benign_reclaimer_locked, t,
|
2811
2771
|
grpc_schedule_on_exec_ctx);
|
2812
2772
|
t->active_reclamation = std::move(*sweep);
|
2813
|
-
t->combiner->Run(&t->benign_reclaimer_locked,
|
2773
|
+
t->combiner->Run(&t->benign_reclaimer_locked, absl::OkStatus());
|
2814
2774
|
} else {
|
2815
2775
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
|
2816
2776
|
}
|
@@ -2830,7 +2790,8 @@ static void post_destructive_reclaimer(grpc_chttp2_transport* t) {
|
|
2830
2790
|
destructive_reclaimer_locked, t,
|
2831
2791
|
grpc_schedule_on_exec_ctx);
|
2832
2792
|
t->active_reclamation = std::move(*sweep);
|
2833
|
-
t->combiner->Run(&t->destructive_reclaimer_locked,
|
2793
|
+
t->combiner->Run(&t->destructive_reclaimer_locked,
|
2794
|
+
absl::OkStatus());
|
2834
2795
|
} else {
|
2835
2796
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
|
2836
2797
|
}
|
@@ -2840,8 +2801,7 @@ static void post_destructive_reclaimer(grpc_chttp2_transport* t) {
|
|
2840
2801
|
|
2841
2802
|
static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
|
2842
2803
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2843
|
-
if (
|
2844
|
-
grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
2804
|
+
if (error.ok() && grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
2845
2805
|
// Channel with no active streams: send a goaway to try and make it
|
2846
2806
|
// disconnect cleanly
|
2847
2807
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
@@ -2849,12 +2809,11 @@ static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
2849
2809
|
t->peer_string.c_str());
|
2850
2810
|
}
|
2851
2811
|
send_goaway(t,
|
2852
|
-
grpc_error_set_int(
|
2853
|
-
|
2854
|
-
|
2812
|
+
grpc_error_set_int(GRPC_ERROR_CREATE("Buffers full"),
|
2813
|
+
grpc_core::StatusIntProperty::kHttp2Error,
|
2814
|
+
GRPC_HTTP2_ENHANCE_YOUR_CALM),
|
2855
2815
|
/*immediate_disconnect_hint=*/true);
|
2856
|
-
} else if (
|
2857
|
-
GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
2816
|
+
} else if (error.ok() && GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
2858
2817
|
gpr_log(GPR_INFO,
|
2859
2818
|
"HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
|
2860
2819
|
" streams",
|
@@ -2862,7 +2821,7 @@ static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
2862
2821
|
grpc_chttp2_stream_map_size(&t->stream_map));
|
2863
2822
|
}
|
2864
2823
|
t->benign_reclaimer_registered = false;
|
2865
|
-
if (error !=
|
2824
|
+
if (error != absl::CancelledError()) {
|
2866
2825
|
t->active_reclamation.Finish();
|
2867
2826
|
}
|
2868
2827
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
|
@@ -2872,7 +2831,7 @@ static void destructive_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
2872
2831
|
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
2873
2832
|
size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
|
2874
2833
|
t->destructive_reclaimer_registered = false;
|
2875
|
-
if (
|
2834
|
+
if (error.ok() && n > 0) {
|
2876
2835
|
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
|
2877
2836
|
grpc_chttp2_stream_map_rand(&t->stream_map));
|
2878
2837
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
@@ -2881,8 +2840,8 @@ static void destructive_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
2881
2840
|
}
|
2882
2841
|
grpc_chttp2_cancel_stream(
|
2883
2842
|
t, s,
|
2884
|
-
grpc_error_set_int(
|
2885
|
-
|
2843
|
+
grpc_error_set_int(GRPC_ERROR_CREATE("Buffers full"),
|
2844
|
+
grpc_core::StatusIntProperty::kHttp2Error,
|
2886
2845
|
GRPC_HTTP2_ENHANCE_YOUR_CALM));
|
2887
2846
|
if (n > 1) {
|
2888
2847
|
// Since we cancel one stream per destructive reclamation, if
|
@@ -2892,7 +2851,7 @@ static void destructive_reclaimer_locked(void* arg, grpc_error_handle error) {
|
|
2892
2851
|
post_destructive_reclaimer(t);
|
2893
2852
|
}
|
2894
2853
|
}
|
2895
|
-
if (error !=
|
2854
|
+
if (error != absl::CancelledError()) {
|
2896
2855
|
t->active_reclamation.Finish();
|
2897
2856
|
}
|
2898
2857
|
GRPC_CHTTP2_UNREF_TRANSPORT(t, "destructive_reclaimer");
|
@@ -3000,5 +2959,5 @@ void grpc_chttp2_transport_start_reading(
|
|
3000
2959
|
t->notify_on_close = notify_on_close;
|
3001
2960
|
t->combiner->Run(
|
3002
2961
|
GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, nullptr),
|
3003
|
-
|
2962
|
+
absl::OkStatus());
|
3004
2963
|
}
|