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
@@ -41,6 +41,7 @@
|
|
41
41
|
#include "src/core/lib/iomgr/sockaddr_windows.h"
|
42
42
|
#include "src/core/lib/iomgr/socket_windows.h"
|
43
43
|
#include "src/core/lib/iomgr/tcp_windows.h"
|
44
|
+
#include "src/core/lib/slice/slice.h"
|
44
45
|
#include "src/core/lib/slice/slice_internal.h"
|
45
46
|
|
46
47
|
/* TODO(apolcyn): remove this hack after fixing upstream.
|
@@ -123,8 +124,8 @@ class GrpcPolledFdWindows {
|
|
123
124
|
}
|
124
125
|
|
125
126
|
~GrpcPolledFdWindows() {
|
126
|
-
|
127
|
-
|
127
|
+
CSliceUnref(read_buf_);
|
128
|
+
CSliceUnref(write_buf_);
|
128
129
|
GPR_ASSERT(read_closure_ == nullptr);
|
129
130
|
GPR_ASSERT(write_closure_ == nullptr);
|
130
131
|
grpc_winsocket_destroy(winsocket_);
|
@@ -144,7 +145,7 @@ class GrpcPolledFdWindows {
|
|
144
145
|
GPR_ASSERT(read_closure_ == nullptr);
|
145
146
|
read_closure_ = read_closure;
|
146
147
|
GPR_ASSERT(GRPC_SLICE_LENGTH(read_buf_) == 0);
|
147
|
-
|
148
|
+
CSliceUnref(read_buf_);
|
148
149
|
GPR_ASSERT(!read_buf_has_data_);
|
149
150
|
read_buf_ = GRPC_SLICE_MALLOC(4192);
|
150
151
|
if (connect_done_) {
|
@@ -223,13 +224,13 @@ class GrpcPolledFdWindows {
|
|
223
224
|
return;
|
224
225
|
}
|
225
226
|
if (socket_type_ == SOCK_DGRAM) {
|
226
|
-
ScheduleAndNullWriteClosure(
|
227
|
+
ScheduleAndNullWriteClosure(absl::OkStatus());
|
227
228
|
} else {
|
228
229
|
GPR_ASSERT(socket_type_ == SOCK_STREAM);
|
229
230
|
int wsa_error_code = 0;
|
230
231
|
switch (tcp_write_state_) {
|
231
232
|
case WRITE_IDLE:
|
232
|
-
ScheduleAndNullWriteClosure(
|
233
|
+
ScheduleAndNullWriteClosure(absl::OkStatus());
|
233
234
|
break;
|
234
235
|
case WRITE_REQUESTED:
|
235
236
|
tcp_write_state_ = WRITE_PENDING;
|
@@ -354,12 +355,12 @@ class GrpcPolledFdWindows {
|
|
354
355
|
// to write everything inline.
|
355
356
|
GRPC_CARES_TRACE_LOG("fd:|%s| SendVUDP called", GetName());
|
356
357
|
GPR_ASSERT(GRPC_SLICE_LENGTH(write_buf_) == 0);
|
357
|
-
|
358
|
+
CSliceUnref(write_buf_);
|
358
359
|
write_buf_ = FlattenIovec(iov, iov_count);
|
359
360
|
DWORD bytes_sent = 0;
|
360
361
|
int wsa_error_code = 0;
|
361
362
|
if (SendWriteBuf(&bytes_sent, nullptr, &wsa_error_code) != 0) {
|
362
|
-
|
363
|
+
CSliceUnref(write_buf_);
|
363
364
|
write_buf_ = grpc_empty_slice();
|
364
365
|
wsa_error_ctx->SetWSAError(wsa_error_code);
|
365
366
|
char* msg = gpr_format_message(wsa_error_code);
|
@@ -387,7 +388,7 @@ class GrpcPolledFdWindows {
|
|
387
388
|
case WRITE_IDLE:
|
388
389
|
tcp_write_state_ = WRITE_REQUESTED;
|
389
390
|
GPR_ASSERT(GRPC_SLICE_LENGTH(write_buf_) == 0);
|
390
|
-
|
391
|
+
CSliceUnref(write_buf_);
|
391
392
|
write_buf_ = FlattenIovec(iov, iov_count);
|
392
393
|
wsa_error_ctx->SetWSAError(WSAEWOULDBLOCK);
|
393
394
|
return -1;
|
@@ -410,7 +411,7 @@ class GrpcPolledFdWindows {
|
|
410
411
|
GRPC_SLICE_START_PTR(write_buf_)[i]);
|
411
412
|
total_sent++;
|
412
413
|
}
|
413
|
-
|
414
|
+
CSliceUnref(currently_attempted);
|
414
415
|
tcp_write_state_ = WRITE_IDLE;
|
415
416
|
return total_sent;
|
416
417
|
}
|
@@ -429,13 +430,13 @@ class GrpcPolledFdWindows {
|
|
429
430
|
"fd:%s InnerOnTcpConnectLocked error:|%s| "
|
430
431
|
"pending_register_for_readable:%d"
|
431
432
|
" pending_register_for_writeable:%d",
|
432
|
-
GetName(),
|
433
|
+
GetName(), StatusToString(error).c_str(),
|
433
434
|
pending_continue_register_for_on_readable_locked_,
|
434
435
|
pending_continue_register_for_on_writeable_locked_);
|
435
436
|
GPR_ASSERT(!connect_done_);
|
436
437
|
connect_done_ = true;
|
437
438
|
GPR_ASSERT(wsa_connect_error_ == 0);
|
438
|
-
if (
|
439
|
+
if (error.ok()) {
|
439
440
|
DWORD transferred_bytes = 0;
|
440
441
|
DWORD flags;
|
441
442
|
BOOL wsa_success =
|
@@ -568,7 +569,6 @@ class GrpcPolledFdWindows {
|
|
568
569
|
|
569
570
|
static void OnIocpReadable(void* arg, grpc_error_handle error) {
|
570
571
|
GrpcPolledFdWindows* polled_fd = static_cast<GrpcPolledFdWindows*>(arg);
|
571
|
-
(void)GRPC_ERROR_REF(error);
|
572
572
|
MutexLock lock(polled_fd->mu_);
|
573
573
|
polled_fd->OnIocpReadableLocked(error);
|
574
574
|
}
|
@@ -579,7 +579,7 @@ class GrpcPolledFdWindows {
|
|
579
579
|
// the entire resolution attempt. Doing so will allow the "inject broken
|
580
580
|
// nameserver list" test to pass on Windows.
|
581
581
|
void OnIocpReadableLocked(grpc_error_handle error) {
|
582
|
-
if (
|
582
|
+
if (error.ok()) {
|
583
583
|
if (winsocket_->read_info.wsa_error != 0) {
|
584
584
|
/* WSAEMSGSIZE would be due to receiving more data
|
585
585
|
* than our read buffer's fixed capacity. Assume that
|
@@ -592,16 +592,16 @@ class GrpcPolledFdWindows {
|
|
592
592
|
"fd:|%s| OnIocpReadableInner winsocket_->read_info.wsa_error "
|
593
593
|
"code:|%d| msg:|%s|",
|
594
594
|
GetName(), winsocket_->read_info.wsa_error,
|
595
|
-
|
595
|
+
StatusToString(error).c_str());
|
596
596
|
}
|
597
597
|
}
|
598
598
|
}
|
599
|
-
if (
|
599
|
+
if (error.ok()) {
|
600
600
|
read_buf_ = grpc_slice_sub_no_ref(
|
601
601
|
read_buf_, 0, winsocket_->read_info.bytes_transferred);
|
602
602
|
read_buf_has_data_ = true;
|
603
603
|
} else {
|
604
|
-
|
604
|
+
CSliceUnref(read_buf_);
|
605
605
|
read_buf_ = grpc_empty_slice();
|
606
606
|
}
|
607
607
|
GRPC_CARES_TRACE_LOG(
|
@@ -612,7 +612,6 @@ class GrpcPolledFdWindows {
|
|
612
612
|
|
613
613
|
static void OnIocpWriteable(void* arg, grpc_error_handle error) {
|
614
614
|
GrpcPolledFdWindows* polled_fd = static_cast<GrpcPolledFdWindows*>(arg);
|
615
|
-
(void)GRPC_ERROR_REF(error);
|
616
615
|
MutexLock lock(polled_fd->mu_);
|
617
616
|
polled_fd->OnIocpWriteableLocked(error);
|
618
617
|
}
|
@@ -620,7 +619,7 @@ class GrpcPolledFdWindows {
|
|
620
619
|
void OnIocpWriteableLocked(grpc_error_handle error) {
|
621
620
|
GRPC_CARES_TRACE_LOG("OnIocpWriteableInner. fd:|%s|", GetName());
|
622
621
|
GPR_ASSERT(socket_type_ == SOCK_STREAM);
|
623
|
-
if (
|
622
|
+
if (error.ok()) {
|
624
623
|
if (winsocket_->write_info.wsa_error != 0) {
|
625
624
|
error = GRPC_WSA_ERROR(winsocket_->write_info.wsa_error,
|
626
625
|
"OnIocpWriteableInner");
|
@@ -628,18 +627,18 @@ class GrpcPolledFdWindows {
|
|
628
627
|
"fd:|%s| OnIocpWriteableInner. winsocket_->write_info.wsa_error "
|
629
628
|
"code:|%d| msg:|%s|",
|
630
629
|
GetName(), winsocket_->write_info.wsa_error,
|
631
|
-
|
630
|
+
StatusToString(error).c_str());
|
632
631
|
}
|
633
632
|
}
|
634
633
|
GPR_ASSERT(tcp_write_state_ == WRITE_PENDING);
|
635
|
-
if (
|
634
|
+
if (error.ok()) {
|
636
635
|
tcp_write_state_ = WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY;
|
637
636
|
write_buf_ = grpc_slice_sub_no_ref(
|
638
637
|
write_buf_, 0, winsocket_->write_info.bytes_transferred);
|
639
638
|
GRPC_CARES_TRACE_LOG("fd:|%s| OnIocpWriteableInner. bytes transferred:%d",
|
640
639
|
GetName(), winsocket_->write_info.bytes_transferred);
|
641
640
|
} else {
|
642
|
-
|
641
|
+
CSliceUnref(write_buf_);
|
643
642
|
write_buf_ = grpc_empty_slice();
|
644
643
|
}
|
645
644
|
ScheduleAndNullWriteClosure(error);
|
@@ -795,7 +794,7 @@ class SockToPolledFdMap {
|
|
795
794
|
// If a gRPC polled fd has not made it in to the driver's list yet, then
|
796
795
|
// the driver has not and will never see this socket.
|
797
796
|
if (!polled_fd->gotten_into_driver_list()) {
|
798
|
-
polled_fd->ShutdownLocked(
|
797
|
+
polled_fd->ShutdownLocked(GRPC_ERROR_CREATE(
|
799
798
|
"Shut down c-ares fd before without it ever having made it into the "
|
800
799
|
"driver's list"));
|
801
800
|
}
|
@@ -875,7 +874,7 @@ class GrpcPolledFdFactoryWindows : public GrpcPolledFdFactory {
|
|
875
874
|
};
|
876
875
|
|
877
876
|
std::unique_ptr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Mutex* mu) {
|
878
|
-
return
|
877
|
+
return std::make_unique<GrpcPolledFdFactoryWindows>(mu);
|
879
878
|
}
|
880
879
|
|
881
880
|
} // namespace grpc_core
|
@@ -23,8 +23,10 @@
|
|
23
23
|
|
24
24
|
#include "absl/strings/string_view.h"
|
25
25
|
|
26
|
+
#include "src/core/lib/gprpp/status_helper.h"
|
26
27
|
#include "src/core/lib/iomgr/sockaddr.h"
|
27
28
|
|
29
|
+
// IWYU pragma: no_include <arpa/inet.h>
|
28
30
|
// IWYU pragma: no_include <arpa/nameser.h>
|
29
31
|
// IWYU pragma: no_include <inttypes.h>
|
30
32
|
// IWYU pragma: no_include <netdb.h>
|
@@ -43,7 +45,6 @@
|
|
43
45
|
#include <address_sorting/address_sorting.h>
|
44
46
|
#include <ares.h>
|
45
47
|
|
46
|
-
#include "absl/memory/memory.h"
|
47
48
|
#include "absl/status/status.h"
|
48
49
|
#include "absl/status/statusor.h"
|
49
50
|
#include "absl/strings/str_cat.h"
|
@@ -225,8 +226,7 @@ static void fd_node_shutdown_locked(fd_node* fdn, const char* reason)
|
|
225
226
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&grpc_ares_request::mu) {
|
226
227
|
if (!fdn->already_shutdown) {
|
227
228
|
fdn->already_shutdown = true;
|
228
|
-
fdn->grpc_polled_fd->ShutdownLocked(
|
229
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING(reason));
|
229
|
+
fdn->grpc_polled_fd->ShutdownLocked(GRPC_ERROR_CREATE(reason));
|
230
230
|
}
|
231
231
|
}
|
232
232
|
|
@@ -294,8 +294,8 @@ static void on_timeout(void* arg, grpc_error_handle error) {
|
|
294
294
|
"request:%p ev_driver=%p on_timeout_locked. driver->shutting_down=%d. "
|
295
295
|
"err=%s",
|
296
296
|
driver->request, driver, driver->shutting_down,
|
297
|
-
|
298
|
-
if (!driver->shutting_down &&
|
297
|
+
grpc_core::StatusToString(error).c_str());
|
298
|
+
if (!driver->shutting_down && error.ok()) {
|
299
299
|
grpc_ares_ev_driver_shutdown_locked(driver);
|
300
300
|
}
|
301
301
|
grpc_ares_ev_driver_unref(driver);
|
@@ -320,8 +320,8 @@ static void on_ares_backup_poll_alarm(void* arg, grpc_error_handle error) {
|
|
320
320
|
"driver->shutting_down=%d. "
|
321
321
|
"err=%s",
|
322
322
|
driver->request, driver, driver->shutting_down,
|
323
|
-
|
324
|
-
if (!driver->shutting_down &&
|
323
|
+
grpc_core::StatusToString(error).c_str());
|
324
|
+
if (!driver->shutting_down && error.ok()) {
|
325
325
|
fd_node* fdn = driver->fds;
|
326
326
|
while (fdn != nullptr) {
|
327
327
|
if (!fdn->already_shutdown) {
|
@@ -363,17 +363,17 @@ static void on_readable(void* arg, grpc_error_handle error) {
|
|
363
363
|
fdn->readable_registered = false;
|
364
364
|
GRPC_CARES_TRACE_LOG("request:%p readable on %s", fdn->ev_driver->request,
|
365
365
|
fdn->grpc_polled_fd->GetName());
|
366
|
-
if (
|
366
|
+
if (error.ok() && !ev_driver->shutting_down) {
|
367
367
|
do {
|
368
368
|
ares_process_fd(ev_driver->channel, as, ARES_SOCKET_BAD);
|
369
369
|
} while (fdn->grpc_polled_fd->IsFdStillReadableLocked());
|
370
370
|
} else {
|
371
|
-
// If error is not
|
372
|
-
// timed out. The pending lookups made on
|
373
|
-
// by the following ares_cancel() and the
|
374
|
-
// with a status of ARES_ECANCELLED. The
|
375
|
-
// ev_driver will be cleaned up in the
|
376
|
-
// grpc_ares_notify_on_event_locked().
|
371
|
+
// If error is not absl::OkStatus() or the resolution was cancelled, it
|
372
|
+
// means the fd has been shutdown or timed out. The pending lookups made on
|
373
|
+
// this ev_driver will be cancelled by the following ares_cancel() and the
|
374
|
+
// on_done callbacks will be invoked with a status of ARES_ECANCELLED. The
|
375
|
+
// remaining file descriptors in this ev_driver will be cleaned up in the
|
376
|
+
// follwing grpc_ares_notify_on_event_locked().
|
377
377
|
ares_cancel(ev_driver->channel);
|
378
378
|
}
|
379
379
|
grpc_ares_notify_on_event_locked(ev_driver);
|
@@ -389,15 +389,15 @@ static void on_writable(void* arg, grpc_error_handle error) {
|
|
389
389
|
fdn->writable_registered = false;
|
390
390
|
GRPC_CARES_TRACE_LOG("request:%p writable on %s", ev_driver->request,
|
391
391
|
fdn->grpc_polled_fd->GetName());
|
392
|
-
if (
|
392
|
+
if (error.ok() && !ev_driver->shutting_down) {
|
393
393
|
ares_process_fd(ev_driver->channel, ARES_SOCKET_BAD, as);
|
394
394
|
} else {
|
395
|
-
// If error is not
|
396
|
-
// timed out. The pending lookups made on
|
397
|
-
// by the following ares_cancel() and the
|
398
|
-
// with a status of ARES_ECANCELLED. The
|
399
|
-
// ev_driver will be cleaned up in the
|
400
|
-
// grpc_ares_notify_on_event_locked().
|
395
|
+
// If error is not absl::OkStatus() or the resolution was cancelled, it
|
396
|
+
// means the fd has been shutdown or timed out. The pending lookups made on
|
397
|
+
// this ev_driver will be cancelled by the following ares_cancel() and the
|
398
|
+
// on_done callbacks will be invoked with a status of ARES_ECANCELLED. The
|
399
|
+
// remaining file descriptors in this ev_driver will be cleaned up in the
|
400
|
+
// follwing grpc_ares_notify_on_event_locked().
|
401
401
|
ares_cancel(ev_driver->channel);
|
402
402
|
}
|
403
403
|
grpc_ares_notify_on_event_locked(ev_driver);
|
@@ -527,7 +527,7 @@ grpc_error_handle grpc_ares_ev_driver_create_locked(
|
|
527
527
|
grpc_ares_test_only_inject_config((*ev_driver)->channel);
|
528
528
|
GRPC_CARES_TRACE_LOG("request:%p grpc_ares_ev_driver_create_locked", request);
|
529
529
|
if (status != ARES_SUCCESS) {
|
530
|
-
grpc_error_handle err =
|
530
|
+
grpc_error_handle err = GRPC_ERROR_CREATE(absl::StrCat(
|
531
531
|
"Failed to init ares channel. C-ares error: ", ares_strerror(status)));
|
532
532
|
delete *ev_driver;
|
533
533
|
return err;
|
@@ -541,7 +541,7 @@ grpc_error_handle grpc_ares_ev_driver_create_locked(
|
|
541
541
|
(*ev_driver)
|
542
542
|
->polled_fd_factory->ConfigureAresChannelLocked((*ev_driver)->channel);
|
543
543
|
(*ev_driver)->query_timeout_ms = query_timeout_ms;
|
544
|
-
return
|
544
|
+
return absl::OkStatus();
|
545
545
|
}
|
546
546
|
|
547
547
|
static void log_address_sorting_list(const grpc_ares_request* r,
|
@@ -603,8 +603,7 @@ void grpc_ares_complete_request_locked(grpc_ares_request* r)
|
|
603
603
|
r->ev_driver = nullptr;
|
604
604
|
if (r->addresses_out != nullptr && *r->addresses_out != nullptr) {
|
605
605
|
grpc_cares_wrapper_address_sorting_sort(r, r->addresses_out->get());
|
606
|
-
|
607
|
-
r->error = GRPC_ERROR_NONE;
|
606
|
+
r->error = absl::OkStatus();
|
608
607
|
// TODO(apolcyn): allow c-ares to return a service config
|
609
608
|
// with no addresses along side it
|
610
609
|
}
|
@@ -659,7 +658,7 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/,
|
|
659
658
|
std::unique_ptr<ServerAddressList>* address_list_ptr =
|
660
659
|
hr->is_balancer ? r->balancer_addresses_out : r->addresses_out;
|
661
660
|
if (*address_list_ptr == nullptr) {
|
662
|
-
*address_list_ptr =
|
661
|
+
*address_list_ptr = std::make_unique<ServerAddressList>();
|
663
662
|
}
|
664
663
|
ServerAddressList& addresses = **address_list_ptr;
|
665
664
|
for (size_t i = 0; hostent->h_addr_list[i] != nullptr; ++i) {
|
@@ -710,7 +709,7 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/,
|
|
710
709
|
hr->qtype, hr->host, hr->is_balancer, ares_strerror(status));
|
711
710
|
GRPC_CARES_TRACE_LOG("request:%p on_hostbyname_done_locked: %s", r,
|
712
711
|
error_msg.c_str());
|
713
|
-
grpc_error_handle error =
|
712
|
+
grpc_error_handle error = GRPC_ERROR_CREATE(error_msg);
|
714
713
|
r->error = grpc_error_add_child(error, r->error);
|
715
714
|
}
|
716
715
|
destroy_hostbyname_request_locked(hr);
|
@@ -745,7 +744,6 @@ static void on_srv_query_done_locked(void* arg, int status, int /*timeouts*/,
|
|
745
744
|
r, srv_it->host, htons(srv_it->port), true /* is_balancer */, "A");
|
746
745
|
ares_gethostbyname(r->ev_driver->channel, hr->host, AF_INET,
|
747
746
|
on_hostbyname_done_locked, hr);
|
748
|
-
grpc_ares_notify_on_event_locked(r->ev_driver);
|
749
747
|
}
|
750
748
|
}
|
751
749
|
if (reply != nullptr) {
|
@@ -757,7 +755,7 @@ static void on_srv_query_done_locked(void* arg, int status, int /*timeouts*/,
|
|
757
755
|
ares_strerror(status));
|
758
756
|
GRPC_CARES_TRACE_LOG("request:%p on_srv_query_done_locked: %s", r,
|
759
757
|
error_msg.c_str());
|
760
|
-
grpc_error_handle error =
|
758
|
+
grpc_error_handle error = GRPC_ERROR_CREATE(error_msg);
|
761
759
|
r->error = grpc_error_add_child(error, r->error);
|
762
760
|
}
|
763
761
|
delete q;
|
@@ -776,7 +774,7 @@ static void on_txt_done_locked(void* arg, int status, int /*timeouts*/,
|
|
776
774
|
const size_t prefix_len = sizeof(g_service_config_attribute_prefix) - 1;
|
777
775
|
struct ares_txt_ext* result = nullptr;
|
778
776
|
struct ares_txt_ext* reply = nullptr;
|
779
|
-
grpc_error_handle error
|
777
|
+
grpc_error_handle error;
|
780
778
|
if (status != ARES_SUCCESS) goto fail;
|
781
779
|
GRPC_CARES_TRACE_LOG("request:%p on_txt_done_locked name=%s ARES_SUCCESS", r,
|
782
780
|
q->name().c_str());
|
@@ -820,7 +818,7 @@ fail:
|
|
820
818
|
q->name(), ares_strerror(status));
|
821
819
|
GRPC_CARES_TRACE_LOG("request:%p on_txt_done_locked %s", r,
|
822
820
|
error_msg.c_str());
|
823
|
-
error =
|
821
|
+
error = GRPC_ERROR_CREATE(error_msg);
|
824
822
|
r->error = grpc_error_add_child(error, r->error);
|
825
823
|
}
|
826
824
|
|
@@ -848,17 +846,17 @@ grpc_error_handle set_request_dns_server(grpc_ares_request* r,
|
|
848
846
|
r->dns_server_addr.tcp_port = grpc_sockaddr_get_port(&addr);
|
849
847
|
r->dns_server_addr.udp_port = grpc_sockaddr_get_port(&addr);
|
850
848
|
} else {
|
851
|
-
return
|
849
|
+
return GRPC_ERROR_CREATE(
|
852
850
|
absl::StrCat("cannot parse authority ", dns_server));
|
853
851
|
}
|
854
852
|
int status =
|
855
853
|
ares_set_servers_ports(r->ev_driver->channel, &r->dns_server_addr);
|
856
854
|
if (status != ARES_SUCCESS) {
|
857
|
-
return
|
855
|
+
return GRPC_ERROR_CREATE(absl::StrCat(
|
858
856
|
"C-ares status is not ARES_SUCCESS: ", ares_strerror(status)));
|
859
857
|
}
|
860
858
|
}
|
861
|
-
return
|
859
|
+
return absl::OkStatus();
|
862
860
|
}
|
863
861
|
|
864
862
|
// Common logic for all lookup methods.
|
@@ -868,26 +866,26 @@ grpc_error_handle grpc_dns_lookup_ares_continued(
|
|
868
866
|
const char* default_port, grpc_pollset_set* interested_parties,
|
869
867
|
int query_timeout_ms, std::string* host, std::string* port, bool check_port)
|
870
868
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(r->mu) {
|
871
|
-
grpc_error_handle error
|
869
|
+
grpc_error_handle error;
|
872
870
|
/* parse name, splitting it into host and port parts */
|
873
871
|
grpc_core::SplitHostPort(name, host, port);
|
874
872
|
if (host->empty()) {
|
875
|
-
error =
|
876
|
-
|
877
|
-
|
873
|
+
error =
|
874
|
+
grpc_error_set_str(GRPC_ERROR_CREATE("unparseable host:port"),
|
875
|
+
grpc_core::StatusStrProperty::kTargetAddress, name);
|
878
876
|
return error;
|
879
877
|
} else if (check_port && port->empty()) {
|
880
878
|
if (default_port == nullptr || strlen(default_port) == 0) {
|
881
|
-
error = grpc_error_set_str(
|
882
|
-
|
883
|
-
|
879
|
+
error = grpc_error_set_str(GRPC_ERROR_CREATE("no port in name"),
|
880
|
+
grpc_core::StatusStrProperty::kTargetAddress,
|
881
|
+
name);
|
884
882
|
return error;
|
885
883
|
}
|
886
884
|
*port = default_port;
|
887
885
|
}
|
888
886
|
error = grpc_ares_ev_driver_create_locked(&r->ev_driver, interested_parties,
|
889
887
|
query_timeout_ms, r);
|
890
|
-
if (!
|
888
|
+
if (!error.ok()) return error;
|
891
889
|
// If dns_server is specified, use it.
|
892
890
|
error = set_request_dns_server(r, dns_server);
|
893
891
|
return error;
|
@@ -921,7 +919,7 @@ static bool inner_resolve_as_ip_literal_locked(
|
|
921
919
|
grpc_parse_ipv6_hostport(hostport->c_str(), &addr,
|
922
920
|
false /* log errors */)) {
|
923
921
|
GPR_ASSERT(*addrs == nullptr);
|
924
|
-
*addrs =
|
922
|
+
*addrs = std::make_unique<ServerAddressList>();
|
925
923
|
(*addrs)->emplace_back(addr.addr, addr.len, grpc_core::ChannelArgs());
|
926
924
|
return true;
|
927
925
|
}
|
@@ -979,7 +977,7 @@ static bool inner_maybe_resolve_localhost_manually_locked(
|
|
979
977
|
}
|
980
978
|
if (gpr_stricmp(host->c_str(), "localhost") == 0) {
|
981
979
|
GPR_ASSERT(*addrs == nullptr);
|
982
|
-
*addrs =
|
980
|
+
*addrs = std::make_unique<grpc_core::ServerAddressList>();
|
983
981
|
uint16_t numeric_port = grpc_strhtons(port->c_str());
|
984
982
|
// Append the ipv6 loopback address.
|
985
983
|
struct sockaddr_in6 ipv6_loopback_addr;
|
@@ -1053,7 +1051,7 @@ static grpc_ares_request* grpc_dns_lookup_hostname_ares_impl(
|
|
1053
1051
|
grpc_error_handle error = grpc_dns_lookup_ares_continued(
|
1054
1052
|
r, dns_server, name, default_port, interested_parties, query_timeout_ms,
|
1055
1053
|
&host, &port, true);
|
1056
|
-
if (!
|
1054
|
+
if (!error.ok()) {
|
1057
1055
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_done, error);
|
1058
1056
|
return r;
|
1059
1057
|
}
|
@@ -1088,7 +1086,7 @@ grpc_ares_request* grpc_dns_lookup_srv_ares_impl(
|
|
1088
1086
|
r->balancer_addresses_out = balancer_addresses;
|
1089
1087
|
GRPC_CARES_TRACE_LOG(
|
1090
1088
|
"request:%p c-ares grpc_dns_lookup_srv_ares_impl name=%s", r, name);
|
1091
|
-
grpc_error_handle error
|
1089
|
+
grpc_error_handle error;
|
1092
1090
|
// Don't query for SRV records if the target is "localhost"
|
1093
1091
|
if (target_matches_localhost(name)) {
|
1094
1092
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_done, error);
|
@@ -1100,7 +1098,7 @@ grpc_ares_request* grpc_dns_lookup_srv_ares_impl(
|
|
1100
1098
|
error = grpc_dns_lookup_ares_continued(r, dns_server, name, nullptr,
|
1101
1099
|
interested_parties, query_timeout_ms,
|
1102
1100
|
&host, &port, false);
|
1103
|
-
if (!
|
1101
|
+
if (!error.ok()) {
|
1104
1102
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_done, error);
|
1105
1103
|
return r;
|
1106
1104
|
}
|
@@ -1126,7 +1124,7 @@ grpc_ares_request* grpc_dns_lookup_txt_ares_impl(
|
|
1126
1124
|
r->service_config_json_out = service_config_json;
|
1127
1125
|
GRPC_CARES_TRACE_LOG(
|
1128
1126
|
"request:%p c-ares grpc_dns_lookup_txt_ares_impl name=%s", r, name);
|
1129
|
-
grpc_error_handle error
|
1127
|
+
grpc_error_handle error;
|
1130
1128
|
// Don't query for TXT records if the target is "localhost"
|
1131
1129
|
if (target_matches_localhost(name)) {
|
1132
1130
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_done, error);
|
@@ -1138,7 +1136,7 @@ grpc_ares_request* grpc_dns_lookup_txt_ares_impl(
|
|
1138
1136
|
error = grpc_dns_lookup_ares_continued(r, dns_server, name, nullptr,
|
1139
1137
|
interested_parties, query_timeout_ms,
|
1140
1138
|
&host, &port, false);
|
1141
|
-
if (!
|
1139
|
+
if (!error.ok()) {
|
1142
1140
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_done, error);
|
1143
1141
|
return r;
|
1144
1142
|
}
|
@@ -1191,15 +1189,15 @@ void (*grpc_cancel_ares_request)(grpc_ares_request* r) =
|
|
1191
1189
|
grpc_error_handle grpc_ares_init(void) {
|
1192
1190
|
int status = ares_library_init(ARES_LIB_INIT_ALL);
|
1193
1191
|
if (status != ARES_SUCCESS) {
|
1194
|
-
return
|
1192
|
+
return GRPC_ERROR_CREATE(
|
1195
1193
|
absl::StrCat("ares_library_init failed: ", ares_strerror(status)));
|
1196
1194
|
}
|
1197
|
-
return
|
1195
|
+
return absl::OkStatus();
|
1198
1196
|
}
|
1199
1197
|
|
1200
1198
|
void grpc_ares_cleanup(void) { ares_library_cleanup(); }
|
1201
1199
|
#else
|
1202
|
-
grpc_error_handle grpc_ares_init(void) { return
|
1200
|
+
grpc_error_handle grpc_ares_init(void) { return absl::OkStatus(); }
|
1203
1201
|
void grpc_ares_cleanup(void) {}
|
1204
1202
|
#endif // GPR_WINDOWS
|
1205
1203
|
|
@@ -75,7 +75,7 @@ struct grpc_ares_request {
|
|
75
75
|
/** number of ongoing queries */
|
76
76
|
size_t pending_queries ABSL_GUARDED_BY(mu) = 0;
|
77
77
|
/** the errors explaining query failures, appended to in query callbacks */
|
78
|
-
grpc_error_handle error ABSL_GUARDED_BY(mu)
|
78
|
+
grpc_error_handle error ABSL_GUARDED_BY(mu);
|
79
79
|
};
|
80
80
|
|
81
81
|
/* Asynchronously resolve \a name (A/AAAA records only).
|
@@ -23,7 +23,6 @@
|
|
23
23
|
#include <vector>
|
24
24
|
|
25
25
|
#include "absl/functional/bind_front.h"
|
26
|
-
#include "absl/memory/memory.h"
|
27
26
|
#include "absl/status/status.h"
|
28
27
|
#include "absl/status/statusor.h"
|
29
28
|
#include "absl/strings/str_cat.h"
|
@@ -51,7 +50,6 @@
|
|
51
50
|
#include "src/core/lib/iomgr/resolved_address.h"
|
52
51
|
#include "src/core/lib/resolver/resolver.h"
|
53
52
|
#include "src/core/lib/resolver/resolver_factory.h"
|
54
|
-
#include "src/core/lib/resolver/resolver_registry.h"
|
55
53
|
#include "src/core/lib/resolver/server_address.h"
|
56
54
|
#include "src/core/lib/uri/uri_parser.h"
|
57
55
|
|
@@ -190,12 +188,12 @@ void RegisterNativeDnsResolver(CoreConfiguration::Builder* builder) {
|
|
190
188
|
if (gpr_stricmp(resolver, "native") == 0) {
|
191
189
|
gpr_log(GPR_DEBUG, "Using native dns resolver");
|
192
190
|
builder->resolver_registry()->RegisterResolverFactory(
|
193
|
-
|
191
|
+
std::make_unique<NativeClientChannelDNSResolverFactory>());
|
194
192
|
} else {
|
195
193
|
if (!builder->resolver_registry()->HasResolverFactory("dns")) {
|
196
194
|
gpr_log(GPR_DEBUG, "Using native dns resolver");
|
197
195
|
builder->resolver_registry()->RegisterResolverFactory(
|
198
|
-
|
196
|
+
std::make_unique<NativeClientChannelDNSResolverFactory>());
|
199
197
|
}
|
200
198
|
}
|
201
199
|
}
|
@@ -24,7 +24,6 @@
|
|
24
24
|
#include <memory>
|
25
25
|
#include <utility>
|
26
26
|
|
27
|
-
#include "absl/memory/memory.h"
|
28
27
|
#include "absl/status/status.h"
|
29
28
|
#include "absl/status/statusor.h"
|
30
29
|
#include "absl/strings/string_view.h"
|
@@ -38,7 +37,6 @@
|
|
38
37
|
#include "src/core/lib/gprpp/orphanable.h"
|
39
38
|
#include "src/core/lib/gprpp/work_serializer.h"
|
40
39
|
#include "src/core/lib/resolver/resolver_factory.h"
|
41
|
-
#include "src/core/lib/resolver/resolver_registry.h"
|
42
40
|
#include "src/core/lib/resolver/server_address.h"
|
43
41
|
#include "src/core/lib/service_config/service_config.h"
|
44
42
|
#include "src/core/lib/uri/uri_parser.h"
|
@@ -362,7 +360,7 @@ class FakeResolverFactory : public ResolverFactory {
|
|
362
360
|
|
363
361
|
void RegisterFakeResolver(CoreConfiguration::Builder* builder) {
|
364
362
|
builder->resolver_registry()->RegisterResolverFactory(
|
365
|
-
|
363
|
+
std::make_unique<FakeResolverFactory>());
|
366
364
|
}
|
367
365
|
|
368
366
|
} // namespace grpc_core
|