grpc 1.50.0.pre1 → 1.51.0
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/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 +57 -20
- 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
@@ -81,15 +81,14 @@ void CFStreamHandle::ReadCallback(CFReadStreamRef stream,
|
|
81
81
|
stream_error = CFReadStreamCopyError(stream);
|
82
82
|
error = grpc_error_set_int(
|
83
83
|
GRPC_ERROR_CREATE_FROM_CFERROR(stream_error, "read error"),
|
84
|
-
|
84
|
+
grpc_core::StatusIntProperty::kRpcStatus, GRPC_STATUS_UNAVAILABLE);
|
85
85
|
CFRelease(stream_error);
|
86
|
-
handle->open_event_.SetShutdown(
|
87
|
-
handle->write_event_.SetShutdown(
|
88
|
-
handle->read_event_.SetShutdown(
|
89
|
-
GRPC_ERROR_UNREF(error);
|
86
|
+
handle->open_event_.SetShutdown(error);
|
87
|
+
handle->write_event_.SetShutdown(error);
|
88
|
+
handle->read_event_.SetShutdown(error);
|
90
89
|
break;
|
91
90
|
default:
|
92
|
-
GPR_UNREACHABLE_CODE(return
|
91
|
+
GPR_UNREACHABLE_CODE(return);
|
93
92
|
}
|
94
93
|
}
|
95
94
|
void CFStreamHandle::WriteCallback(CFWriteStreamRef stream,
|
@@ -116,15 +115,14 @@ void CFStreamHandle::WriteCallback(CFWriteStreamRef stream,
|
|
116
115
|
stream_error = CFWriteStreamCopyError(stream);
|
117
116
|
error = grpc_error_set_int(
|
118
117
|
GRPC_ERROR_CREATE_FROM_CFERROR(stream_error, "write error"),
|
119
|
-
|
118
|
+
grpc_core::StatusIntProperty::kRpcStatus, GRPC_STATUS_UNAVAILABLE);
|
120
119
|
CFRelease(stream_error);
|
121
|
-
handle->open_event_.SetShutdown(
|
122
|
-
handle->write_event_.SetShutdown(
|
123
|
-
handle->read_event_.SetShutdown(
|
124
|
-
GRPC_ERROR_UNREF(error);
|
120
|
+
handle->open_event_.SetShutdown(error);
|
121
|
+
handle->write_event_.SetShutdown(error);
|
122
|
+
handle->read_event_.SetShutdown(error);
|
125
123
|
break;
|
126
124
|
default:
|
127
|
-
GPR_UNREACHABLE_CODE(return
|
125
|
+
GPR_UNREACHABLE_CODE(return);
|
128
126
|
}
|
129
127
|
}
|
130
128
|
|
@@ -172,10 +170,9 @@ void CFStreamHandle::NotifyOnWrite(grpc_closure* closure) {
|
|
172
170
|
}
|
173
171
|
|
174
172
|
void CFStreamHandle::Shutdown(grpc_error_handle error) {
|
175
|
-
open_event_.SetShutdown(
|
176
|
-
read_event_.SetShutdown(
|
177
|
-
write_event_.SetShutdown(
|
178
|
-
GRPC_ERROR_UNREF(error);
|
173
|
+
open_event_.SetShutdown(error);
|
174
|
+
read_event_.SetShutdown(error);
|
175
|
+
write_event_.SetShutdown(error);
|
179
176
|
}
|
180
177
|
|
181
178
|
void CFStreamHandle::Ref(const char* file, int line, const char* reason) {
|
@@ -45,7 +45,7 @@ typedef struct grpc_closure_list {
|
|
45
45
|
/** gRPC Callback definition.
|
46
46
|
*
|
47
47
|
* \param arg Arbitrary input.
|
48
|
-
* \param error
|
48
|
+
* \param error absl::OkStatus() if no error occurred, otherwise some grpc_error
|
49
49
|
* describing what went wrong.
|
50
50
|
* Error contract: it is not the cb's job to unref this error;
|
51
51
|
* the closure scheduler will do that after the cb returns */
|
@@ -118,6 +118,54 @@ inline grpc_closure* grpc_closure_init(grpc_closure* closure,
|
|
118
118
|
grpc_closure_init(closure, cb, cb_arg)
|
119
119
|
#endif
|
120
120
|
|
121
|
+
namespace grpc_core {
|
122
|
+
template <typename T, void (T::*cb)(grpc_error_handle)>
|
123
|
+
grpc_closure MakeMemberClosure(T* p, DebugLocation location = DebugLocation()) {
|
124
|
+
grpc_closure out;
|
125
|
+
GRPC_CLOSURE_INIT(
|
126
|
+
&out, [](void* p, grpc_error_handle e) { (static_cast<T*>(p)->*cb)(e); },
|
127
|
+
p, nullptr);
|
128
|
+
#ifndef NDEBUG
|
129
|
+
out.file_created = location.file();
|
130
|
+
out.line_created = location.line();
|
131
|
+
#else
|
132
|
+
(void)location;
|
133
|
+
#endif
|
134
|
+
return out;
|
135
|
+
}
|
136
|
+
|
137
|
+
template <typename T, void (T::*cb)()>
|
138
|
+
grpc_closure MakeMemberClosure(T* p, DebugLocation location = DebugLocation()) {
|
139
|
+
grpc_closure out;
|
140
|
+
GRPC_CLOSURE_INIT(
|
141
|
+
&out, [](void* p, grpc_error_handle) { (static_cast<T*>(p)->*cb)(); }, p,
|
142
|
+
nullptr);
|
143
|
+
#ifndef NDEBUG
|
144
|
+
out.file_created = location.file();
|
145
|
+
out.line_created = location.line();
|
146
|
+
#else
|
147
|
+
(void)location;
|
148
|
+
#endif
|
149
|
+
return out;
|
150
|
+
}
|
151
|
+
|
152
|
+
template <typename F>
|
153
|
+
grpc_closure* NewClosure(F f) {
|
154
|
+
struct Closure : public grpc_closure {
|
155
|
+
explicit Closure(F f) : f(std::move(f)) {}
|
156
|
+
F f;
|
157
|
+
static void Run(void* arg, grpc_error_handle error) {
|
158
|
+
auto self = static_cast<Closure*>(arg);
|
159
|
+
self->f(error);
|
160
|
+
delete self;
|
161
|
+
}
|
162
|
+
};
|
163
|
+
Closure* c = new Closure(std::move(f));
|
164
|
+
GRPC_CLOSURE_INIT(c, Closure::Run, c, nullptr);
|
165
|
+
return c;
|
166
|
+
}
|
167
|
+
} // namespace grpc_core
|
168
|
+
|
121
169
|
namespace closure_impl {
|
122
170
|
|
123
171
|
struct wrapped_closure {
|
@@ -195,7 +243,6 @@ inline bool grpc_closure_list_append(grpc_closure_list* closure_list,
|
|
195
243
|
grpc_closure* closure,
|
196
244
|
grpc_error_handle error) {
|
197
245
|
if (closure == nullptr) {
|
198
|
-
GRPC_ERROR_UNREF(error);
|
199
246
|
return false;
|
200
247
|
}
|
201
248
|
closure->error_data.error = grpc_core::internal::StatusAllocHeapPtr(error);
|
@@ -211,7 +258,6 @@ inline void grpc_closure_list_fail_all(grpc_closure_list* list,
|
|
211
258
|
grpc_core::internal::StatusAllocHeapPtr(forced_failure);
|
212
259
|
}
|
213
260
|
}
|
214
|
-
GRPC_ERROR_UNREF(forced_failure);
|
215
261
|
}
|
216
262
|
|
217
263
|
/** append all closures from \a src to \a dst and empty \a src. */
|
@@ -241,7 +287,6 @@ class Closure {
|
|
241
287
|
grpc_error_handle error) {
|
242
288
|
(void)location;
|
243
289
|
if (closure == nullptr) {
|
244
|
-
GRPC_ERROR_UNREF(error);
|
245
290
|
return;
|
246
291
|
}
|
247
292
|
#ifndef NDEBUG
|
@@ -258,7 +303,6 @@ class Closure {
|
|
258
303
|
gpr_log(GPR_DEBUG, "closure %p finished", closure);
|
259
304
|
}
|
260
305
|
#endif
|
261
|
-
GRPC_ERROR_UNREF(error);
|
262
306
|
}
|
263
307
|
};
|
264
308
|
} // namespace grpc_core
|
@@ -171,7 +171,7 @@ static void offload(void* arg, grpc_error_handle /*error*/) {
|
|
171
171
|
static void queue_offload(grpc_core::Combiner* lock) {
|
172
172
|
move_next();
|
173
173
|
GRPC_COMBINER_TRACE(gpr_log(GPR_INFO, "C:%p queue_offload", lock));
|
174
|
-
grpc_core::Executor::Run(&lock->offload,
|
174
|
+
grpc_core::Executor::Run(&lock->offload, absl::OkStatus());
|
175
175
|
}
|
176
176
|
|
177
177
|
bool grpc_combiner_continue_exec_ctx() {
|
@@ -316,7 +316,7 @@ static void enqueue_finally(void* closure, grpc_error_handle error) {
|
|
316
316
|
grpc_core::Combiner* lock =
|
317
317
|
reinterpret_cast<grpc_core::Combiner*>(cl->error_data.scratch);
|
318
318
|
cl->error_data.scratch = 0;
|
319
|
-
combiner_finally_exec(lock, cl,
|
319
|
+
combiner_finally_exec(lock, cl, error);
|
320
320
|
}
|
321
321
|
|
322
322
|
namespace grpc_core {
|
@@ -56,7 +56,7 @@ struct grpc_endpoint_vtable {
|
|
56
56
|
Callback success indicates that the endpoint can accept more reads, failure
|
57
57
|
indicates the endpoint is closed.
|
58
58
|
Valid slices may be placed into \a slices even when the callback is
|
59
|
-
invoked with !
|
59
|
+
invoked with !error.ok(). */
|
60
60
|
void grpc_endpoint_read(grpc_endpoint* ep, grpc_slice_buffer* slices,
|
61
61
|
grpc_closure* cb, bool urgent, int min_progress_size);
|
62
62
|
|
@@ -36,6 +36,7 @@
|
|
36
36
|
#import "src/core/lib/iomgr/endpoint_cfstream.h"
|
37
37
|
#include "src/core/lib/iomgr/error_cfstream.h"
|
38
38
|
#include "src/core/lib/iomgr/sockaddr.h"
|
39
|
+
#include "src/core/lib/slice/slice.h"
|
39
40
|
#include "src/core/lib/slice/slice_internal.h"
|
40
41
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
41
42
|
|
@@ -106,9 +107,9 @@ static void CFStreamRef(CFStreamEndpoint* ep) { gpr_ref(&ep->refcount); }
|
|
106
107
|
static grpc_error_handle CFStreamAnnotateError(grpc_error_handle src_error,
|
107
108
|
CFStreamEndpoint* ep) {
|
108
109
|
return grpc_error_set_str(
|
109
|
-
grpc_error_set_int(src_error,
|
110
|
+
grpc_error_set_int(src_error, grpc_core::StatusIntProperty::kRpcStatus,
|
110
111
|
GRPC_STATUS_UNAVAILABLE),
|
111
|
-
|
112
|
+
grpc_core::StatusStrProperty::kTargetAddress, ep->peer_string);
|
112
113
|
}
|
113
114
|
|
114
115
|
static void CallReadCb(CFStreamEndpoint* ep, grpc_error_handle error) {
|
@@ -116,7 +117,8 @@ static void CallReadCb(CFStreamEndpoint* ep, grpc_error_handle error) {
|
|
116
117
|
gpr_log(GPR_DEBUG, "CFStream endpoint:%p call_read_cb %p %p:%p", ep,
|
117
118
|
ep->read_cb, ep->read_cb->cb, ep->read_cb->cb_arg);
|
118
119
|
size_t i;
|
119
|
-
gpr_log(GPR_DEBUG, "read: error=%s",
|
120
|
+
gpr_log(GPR_DEBUG, "read: error=%s",
|
121
|
+
grpc_core::StatusToString(error).c_str());
|
120
122
|
|
121
123
|
for (i = 0; i < ep->read_slices->count; i++) {
|
122
124
|
char* dump = grpc_dump_slice(ep->read_slices->slices[i],
|
@@ -136,7 +138,8 @@ static void CallWriteCb(CFStreamEndpoint* ep, grpc_error_handle error) {
|
|
136
138
|
if (grpc_tcp_trace.enabled()) {
|
137
139
|
gpr_log(GPR_DEBUG, "CFStream endpoint:%p call_write_cb %p %p:%p", ep,
|
138
140
|
ep->write_cb, ep->write_cb->cb, ep->write_cb->cb_arg);
|
139
|
-
gpr_log(GPR_DEBUG, "write: error=%s",
|
141
|
+
gpr_log(GPR_DEBUG, "write: error=%s",
|
142
|
+
grpc_core::StatusToString(error).c_str());
|
140
143
|
}
|
141
144
|
grpc_closure* cb = ep->write_cb;
|
142
145
|
ep->write_cb = nullptr;
|
@@ -147,9 +150,9 @@ static void CallWriteCb(CFStreamEndpoint* ep, grpc_error_handle error) {
|
|
147
150
|
static void ReadAction(void* arg, grpc_error_handle error) {
|
148
151
|
CFStreamEndpoint* ep = static_cast<CFStreamEndpoint*>(arg);
|
149
152
|
GPR_ASSERT(ep->read_cb != nullptr);
|
150
|
-
if (!
|
151
|
-
|
152
|
-
CallReadCb(ep,
|
153
|
+
if (!error.ok()) {
|
154
|
+
grpc_slice_buffer_reset_and_unref(ep->read_slices);
|
155
|
+
CallReadCb(ep, error);
|
153
156
|
EP_UNREF(ep, "read");
|
154
157
|
return;
|
155
158
|
}
|
@@ -160,28 +163,27 @@ static void ReadAction(void* arg, grpc_error_handle error) {
|
|
160
163
|
CFIndex read_size =
|
161
164
|
CFReadStreamRead(ep->read_stream, GRPC_SLICE_START_PTR(slice), len);
|
162
165
|
if (read_size == -1) {
|
163
|
-
|
166
|
+
grpc_slice_buffer_reset_and_unref(ep->read_slices);
|
164
167
|
CFErrorRef stream_error = CFReadStreamCopyError(ep->read_stream);
|
165
168
|
if (stream_error != nullptr) {
|
166
169
|
error = CFStreamAnnotateError(
|
167
170
|
GRPC_ERROR_CREATE_FROM_CFERROR(stream_error, "Read error"), ep);
|
168
171
|
CFRelease(stream_error);
|
169
172
|
} else {
|
170
|
-
error =
|
173
|
+
error = GRPC_ERROR_CREATE("Read error");
|
171
174
|
}
|
172
175
|
CallReadCb(ep, error);
|
173
176
|
EP_UNREF(ep, "read");
|
174
177
|
} else if (read_size == 0) {
|
175
|
-
|
178
|
+
grpc_slice_buffer_reset_and_unref(ep->read_slices);
|
176
179
|
CallReadCb(ep,
|
177
|
-
CFStreamAnnotateError(
|
178
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Socket closed"), ep));
|
180
|
+
CFStreamAnnotateError(GRPC_ERROR_CREATE("Socket closed"), ep));
|
179
181
|
EP_UNREF(ep, "read");
|
180
182
|
} else {
|
181
183
|
if (read_size < static_cast<CFIndex>(len)) {
|
182
184
|
grpc_slice_buffer_trim_end(ep->read_slices, len - read_size, nullptr);
|
183
185
|
}
|
184
|
-
CallReadCb(ep,
|
186
|
+
CallReadCb(ep, absl::OkStatus());
|
185
187
|
EP_UNREF(ep, "read");
|
186
188
|
}
|
187
189
|
}
|
@@ -189,26 +191,25 @@ static void ReadAction(void* arg, grpc_error_handle error) {
|
|
189
191
|
static void WriteAction(void* arg, grpc_error_handle error) {
|
190
192
|
CFStreamEndpoint* ep = static_cast<CFStreamEndpoint*>(arg);
|
191
193
|
GPR_ASSERT(ep->write_cb != nullptr);
|
192
|
-
if (!
|
193
|
-
|
194
|
-
CallWriteCb(ep,
|
194
|
+
if (!error.ok()) {
|
195
|
+
grpc_slice_buffer_reset_and_unref(ep->write_slices);
|
196
|
+
CallWriteCb(ep, error);
|
195
197
|
EP_UNREF(ep, "write");
|
196
198
|
return;
|
197
199
|
}
|
198
|
-
|
199
200
|
grpc_slice slice = grpc_slice_buffer_take_first(ep->write_slices);
|
200
201
|
size_t slice_len = GRPC_SLICE_LENGTH(slice);
|
201
202
|
CFIndex write_size = CFWriteStreamWrite(
|
202
203
|
ep->write_stream, GRPC_SLICE_START_PTR(slice), slice_len);
|
203
204
|
if (write_size == -1) {
|
204
|
-
|
205
|
+
grpc_slice_buffer_reset_and_unref(ep->write_slices);
|
205
206
|
CFErrorRef stream_error = CFWriteStreamCopyError(ep->write_stream);
|
206
207
|
if (stream_error != nullptr) {
|
207
208
|
error = CFStreamAnnotateError(
|
208
209
|
GRPC_ERROR_CREATE_FROM_CFERROR(stream_error, "write failed."), ep);
|
209
210
|
CFRelease(stream_error);
|
210
211
|
} else {
|
211
|
-
error =
|
212
|
+
error = GRPC_ERROR_CREATE("write failed.");
|
212
213
|
}
|
213
214
|
CallWriteCb(ep, error);
|
214
215
|
EP_UNREF(ep, "write");
|
@@ -220,7 +221,7 @@ static void WriteAction(void* arg, grpc_error_handle error) {
|
|
220
221
|
if (ep->write_slices->length > 0) {
|
221
222
|
ep->stream_sync->NotifyOnWrite(&ep->write_action);
|
222
223
|
} else {
|
223
|
-
CallWriteCb(ep,
|
224
|
+
CallWriteCb(ep, absl::OkStatus());
|
224
225
|
EP_UNREF(ep, "write");
|
225
226
|
}
|
226
227
|
|
@@ -230,10 +231,10 @@ static void WriteAction(void* arg, grpc_error_handle error) {
|
|
230
231
|
gpr_log(GPR_DEBUG, "WRITE %p (peer=%s): %s", ep, ep->peer_string.c_str(),
|
231
232
|
dump);
|
232
233
|
gpr_free(dump);
|
233
|
-
|
234
|
+
grpc_core::CSliceUnref(trace_slice);
|
234
235
|
}
|
235
236
|
}
|
236
|
-
|
237
|
+
grpc_core::CSliceUnref(slice);
|
237
238
|
}
|
238
239
|
|
239
240
|
static void CFStreamRead(grpc_endpoint* ep, grpc_slice_buffer* slices,
|
@@ -247,7 +248,7 @@ static void CFStreamRead(grpc_endpoint* ep, grpc_slice_buffer* slices,
|
|
247
248
|
GPR_ASSERT(ep_impl->read_cb == nullptr);
|
248
249
|
ep_impl->read_cb = cb;
|
249
250
|
ep_impl->read_slices = slices;
|
250
|
-
|
251
|
+
grpc_slice_buffer_reset_and_unref(slices);
|
251
252
|
grpc_slice_buffer_add_indexed(
|
252
253
|
slices, GRPC_SLICE_MALLOC(GRPC_TCP_DEFAULT_READ_SLICE_SIZE));
|
253
254
|
EP_REF(ep_impl, "read");
|
@@ -272,14 +273,14 @@ void CFStreamShutdown(grpc_endpoint* ep, grpc_error_handle why) {
|
|
272
273
|
CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep);
|
273
274
|
if (grpc_tcp_trace.enabled()) {
|
274
275
|
gpr_log(GPR_DEBUG, "CFStream endpoint:%p shutdown (%s)", ep_impl,
|
275
|
-
|
276
|
+
grpc_core::StatusToString(why).c_str());
|
276
277
|
}
|
277
278
|
CFReadStreamClose(ep_impl->read_stream);
|
278
279
|
CFWriteStreamClose(ep_impl->write_stream);
|
279
280
|
ep_impl->stream_sync->Shutdown(why);
|
280
281
|
if (grpc_tcp_trace.enabled()) {
|
281
282
|
gpr_log(GPR_DEBUG, "CFStream endpoint:%p shutdown DONE (%s)", ep_impl,
|
282
|
-
|
283
|
+
grpc_core::StatusToString(why).c_str());
|
283
284
|
}
|
284
285
|
}
|
285
286
|
|
@@ -50,8 +50,8 @@ static void create_sockets(int sv[2]) {
|
|
50
50
|
GPR_ASSERT(fcntl(sv[0], F_SETFL, flags | O_NONBLOCK) == 0);
|
51
51
|
flags = fcntl(sv[1], F_GETFL, 0);
|
52
52
|
GPR_ASSERT(fcntl(sv[1], F_SETFL, flags | O_NONBLOCK) == 0);
|
53
|
-
GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[0]) ==
|
54
|
-
GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[1]) ==
|
53
|
+
GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[0]) == absl::OkStatus());
|
54
|
+
GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[1]) == absl::OkStatus());
|
55
55
|
}
|
56
56
|
|
57
57
|
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name,
|
data/src/core/lib/iomgr/error.cc
CHANGED
@@ -22,6 +22,8 @@
|
|
22
22
|
#include <inttypes.h>
|
23
23
|
#include <string.h>
|
24
24
|
|
25
|
+
#include "absl/strings/str_format.h"
|
26
|
+
|
25
27
|
#include <grpc/impl/codegen/status.h>
|
26
28
|
#include <grpc/support/alloc.h>
|
27
29
|
#include <grpc/support/log.h>
|
@@ -33,22 +35,13 @@
|
|
33
35
|
|
34
36
|
#include "src/core/lib/debug/trace.h"
|
35
37
|
#include "src/core/lib/gpr/useful.h"
|
38
|
+
#include "src/core/lib/gprpp/strerror.h"
|
36
39
|
#include "src/core/lib/slice/slice_internal.h"
|
37
40
|
|
38
41
|
grpc_core::DebugOnlyTraceFlag grpc_trace_error_refcount(false,
|
39
42
|
"error_refcount");
|
40
43
|
grpc_core::DebugOnlyTraceFlag grpc_trace_closure(false, "closure");
|
41
44
|
|
42
|
-
static gpr_atm g_error_creation_allowed = true;
|
43
|
-
|
44
|
-
void grpc_disable_error_creation() {
|
45
|
-
gpr_atm_no_barrier_store(&g_error_creation_allowed, false);
|
46
|
-
}
|
47
|
-
|
48
|
-
void grpc_enable_error_creation() {
|
49
|
-
gpr_atm_no_barrier_store(&g_error_creation_allowed, true);
|
50
|
-
}
|
51
|
-
|
52
45
|
absl::Status grpc_status_create(absl::StatusCode code, absl::string_view msg,
|
53
46
|
const grpc_core::DebugLocation& location,
|
54
47
|
size_t children_count, absl::Status* children) {
|
@@ -61,17 +54,14 @@ absl::Status grpc_status_create(absl::StatusCode code, absl::string_view msg,
|
|
61
54
|
return s;
|
62
55
|
}
|
63
56
|
|
64
|
-
std::string grpc_error_std_string(absl::Status error) {
|
65
|
-
return grpc_core::StatusToString(error);
|
66
|
-
}
|
67
|
-
|
68
57
|
absl::Status grpc_os_error(const grpc_core::DebugLocation& location, int err,
|
69
58
|
const char* call_name) {
|
59
|
+
auto err_string = grpc_core::StrError(err);
|
70
60
|
absl::Status s =
|
71
|
-
StatusCreate(absl::StatusCode::kUnknown,
|
61
|
+
StatusCreate(absl::StatusCode::kUnknown, err_string, location, {});
|
72
62
|
grpc_core::StatusSetInt(&s, grpc_core::StatusIntProperty::kErrorNo, err);
|
73
63
|
grpc_core::StatusSetStr(&s, grpc_core::StatusStrProperty::kOsError,
|
74
|
-
|
64
|
+
err_string);
|
75
65
|
grpc_core::StatusSetStr(&s, grpc_core::StatusStrProperty::kSyscall,
|
76
66
|
call_name);
|
77
67
|
return s;
|
@@ -88,32 +78,32 @@ absl::Status grpc_wsa_error(const grpc_core::DebugLocation& location, int err,
|
|
88
78
|
GRPC_STATUS_UNAVAILABLE);
|
89
79
|
StatusSetStr(&s, grpc_core::StatusStrProperty::kOsError, utf8_message);
|
90
80
|
StatusSetStr(&s, grpc_core::StatusStrProperty::kSyscall, call_name);
|
81
|
+
gpr_free(utf8_message);
|
91
82
|
return s;
|
92
83
|
}
|
93
84
|
#endif
|
94
85
|
|
95
86
|
grpc_error_handle grpc_error_set_int(grpc_error_handle src,
|
96
|
-
|
97
|
-
|
87
|
+
grpc_core::StatusIntProperty which,
|
88
|
+
intptr_t value) {
|
89
|
+
if (src.ok()) {
|
98
90
|
src = absl::UnknownError("");
|
99
91
|
StatusSetInt(&src, grpc_core::StatusIntProperty::kRpcStatus,
|
100
92
|
GRPC_STATUS_OK);
|
101
93
|
}
|
102
|
-
grpc_core::StatusSetInt(
|
103
|
-
&src, static_cast<grpc_core::StatusIntProperty>(which), value);
|
94
|
+
grpc_core::StatusSetInt(&src, which, value);
|
104
95
|
return src;
|
105
96
|
}
|
106
97
|
|
107
|
-
bool grpc_error_get_int(grpc_error_handle error,
|
108
|
-
intptr_t* p) {
|
109
|
-
absl::optional<intptr_t> value = grpc_core::StatusGetInt(
|
110
|
-
error, static_cast<grpc_core::StatusIntProperty>(which));
|
98
|
+
bool grpc_error_get_int(grpc_error_handle error,
|
99
|
+
grpc_core::StatusIntProperty which, intptr_t* p) {
|
100
|
+
absl::optional<intptr_t> value = grpc_core::StatusGetInt(error, which);
|
111
101
|
if (value.has_value()) {
|
112
102
|
*p = *value;
|
113
103
|
return true;
|
114
104
|
} else {
|
115
105
|
// TODO(veblush): Remove this once absl::Status migration is done
|
116
|
-
if (which ==
|
106
|
+
if (which == grpc_core::StatusIntProperty::kRpcStatus) {
|
117
107
|
switch (error.code()) {
|
118
108
|
case absl::StatusCode::kOk:
|
119
109
|
*p = GRPC_STATUS_OK;
|
@@ -133,14 +123,14 @@ bool grpc_error_get_int(grpc_error_handle error, grpc_error_ints which,
|
|
133
123
|
}
|
134
124
|
|
135
125
|
grpc_error_handle grpc_error_set_str(grpc_error_handle src,
|
136
|
-
|
126
|
+
grpc_core::StatusStrProperty which,
|
137
127
|
absl::string_view str) {
|
138
|
-
if (
|
128
|
+
if (src.ok()) {
|
139
129
|
src = absl::UnknownError("");
|
140
130
|
StatusSetInt(&src, grpc_core::StatusIntProperty::kRpcStatus,
|
141
131
|
GRPC_STATUS_OK);
|
142
132
|
}
|
143
|
-
if (which ==
|
133
|
+
if (which == grpc_core::StatusStrProperty::kDescription) {
|
144
134
|
// To change the message of absl::Status, a new instance should be created
|
145
135
|
// with a code and payload because it doesn't have a setter for it.
|
146
136
|
absl::Status s = absl::Status(src.code(), str);
|
@@ -150,17 +140,16 @@ grpc_error_handle grpc_error_set_str(grpc_error_handle src,
|
|
150
140
|
});
|
151
141
|
return s;
|
152
142
|
} else {
|
153
|
-
grpc_core::StatusSetStr(
|
154
|
-
&src, static_cast<grpc_core::StatusStrProperty>(which), str);
|
143
|
+
grpc_core::StatusSetStr(&src, which, str);
|
155
144
|
}
|
156
145
|
return src;
|
157
146
|
}
|
158
147
|
|
159
|
-
bool grpc_error_get_str(grpc_error_handle error,
|
160
|
-
std::string* s) {
|
161
|
-
if (which ==
|
162
|
-
// absl::Status uses the message field for
|
163
|
-
// instead of using payload.
|
148
|
+
bool grpc_error_get_str(grpc_error_handle error,
|
149
|
+
grpc_core::StatusStrProperty which, std::string* s) {
|
150
|
+
if (which == grpc_core::StatusStrProperty::kDescription) {
|
151
|
+
// absl::Status uses the message field for
|
152
|
+
// grpc_core::StatusStrProperty::kDescription instead of using payload.
|
164
153
|
absl::string_view msg = error.message();
|
165
154
|
if (msg.empty()) {
|
166
155
|
return false;
|
@@ -169,21 +158,17 @@ bool grpc_error_get_str(grpc_error_handle error, grpc_error_strs which,
|
|
169
158
|
return true;
|
170
159
|
}
|
171
160
|
} else {
|
172
|
-
absl::optional<std::string> value = grpc_core::StatusGetStr(
|
173
|
-
error, static_cast<grpc_core::StatusStrProperty>(which));
|
161
|
+
absl::optional<std::string> value = grpc_core::StatusGetStr(error, which);
|
174
162
|
if (value.has_value()) {
|
175
163
|
*s = std::move(*value);
|
176
164
|
return true;
|
177
165
|
} else {
|
178
166
|
// TODO(veblush): Remove this once absl::Status migration is done
|
179
|
-
if (which ==
|
167
|
+
if (which == grpc_core::StatusStrProperty::kGrpcMessage) {
|
180
168
|
switch (error.code()) {
|
181
169
|
case absl::StatusCode::kOk:
|
182
170
|
*s = "";
|
183
171
|
return true;
|
184
|
-
case absl::StatusCode::kResourceExhausted:
|
185
|
-
*s = "RESOURCE_EXHAUSTED";
|
186
|
-
return true;
|
187
172
|
case absl::StatusCode::kCancelled:
|
188
173
|
*s = "CANCELLED";
|
189
174
|
return true;
|
@@ -210,7 +195,7 @@ grpc_error_handle grpc_error_add_child(grpc_error_handle src,
|
|
210
195
|
|
211
196
|
bool grpc_log_error(const char* what, grpc_error_handle error, const char* file,
|
212
197
|
int line) {
|
213
|
-
GPR_DEBUG_ASSERT(!
|
198
|
+
GPR_DEBUG_ASSERT(!error.ok());
|
214
199
|
gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "%s: %s", what,
|
215
200
|
grpc_core::StatusToString(error).c_str());
|
216
201
|
return false;
|