grpc 1.83.0 → 1.84.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +21 -17
- data/include/grpc/credentials.h +10 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +9 -0
- data/src/core/call/call_filters.h +4 -2
- data/src/core/call/client_call.cc +20 -8
- data/src/core/call/client_call.h +4 -0
- data/src/core/call/interception_chain.cc +2 -0
- data/src/core/call/interception_chain.h +14 -1
- data/src/core/call/metadata.cc +1 -3
- data/src/core/call/metadata_batch.h +13 -5
- data/src/core/call/server_call.cc +31 -14
- data/src/core/call/server_call.h +4 -0
- data/src/core/channelz/text_encode.cc +9 -4
- data/src/core/channelz/v2tov1/convert.cc +2 -2
- data/src/core/client_channel/backup_poller.cc +1 -2
- data/src/core/client_channel/client_channel.cc +6 -33
- data/src/core/client_channel/client_channel_filter.cc +22 -55
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_service_config.cc +3 -19
- data/src/core/client_channel/direct_channel.cc +7 -1
- data/src/core/client_channel/direct_channel.h +2 -2
- data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
- data/src/core/client_channel/subchannel.cc +310 -1058
- data/src/core/client_channel/subchannel.h +44 -329
- data/src/core/client_channel/subchannel_metrics.cc +48 -0
- data/src/core/client_channel/subchannel_metrics.h +60 -0
- data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
- data/src/core/credentials/call/json_util.h +1 -0
- data/src/core/credentials/call/jwt/json_token.cc +10 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
- data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
- data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
- data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
- data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
- data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
- data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
- data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
- data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
- data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
- data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
- data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
- data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
- data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
- data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
- data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
- data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +25 -32
- data/src/core/ext/filters/http/message_compress/compression_filter.h +0 -1
- data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
- data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +80 -70
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
- data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +33 -2
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +55 -23
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -0
- data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
- data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +13 -5
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
- data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
- data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
- data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
- data/src/core/filter/auth/server_auth_filter.cc +2 -3
- data/src/core/filter/composite/composite_filter.cc +45 -33
- data/src/core/filter/composite/composite_filter.h +5 -4
- data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
- data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
- data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
- data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
- data/src/core/filter/filter_args.h +13 -2
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
- data/src/core/handshaker/security/security_handshaker.cc +9 -6
- data/src/core/lib/channel/channel_stack.cc +3 -0
- data/src/core/lib/channel/channel_stack.h +2 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
- data/src/core/lib/channel/promise_based_filter.cc +132 -20
- data/src/core/lib/channel/promise_based_filter.h +42 -12
- data/src/core/lib/compression/compression_internal.cc +4 -5
- data/src/core/lib/compression/message_compress.cc +132 -97
- data/src/core/lib/compression/message_compress.h +24 -0
- data/src/core/lib/debug/trace_flags.cc +8 -0
- data/src/core/lib/debug/trace_flags.h +3 -0
- data/src/core/lib/event_engine/ares_resolver.cc +54 -50
- data/src/core/lib/event_engine/ares_resolver.h +3 -2
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
- data/src/core/lib/experiments/experiments.cc +81 -102
- data/src/core/lib/experiments/experiments.h +57 -56
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
- data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
- data/src/core/lib/iomgr/error.cc +2 -6
- data/src/core/lib/iomgr/error_cfstream.cc +1 -1
- data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
- data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
- data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
- data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/systemd_utils.cc +0 -1
- data/src/core/lib/iomgr/tcp_client.h +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +23 -15
- data/src/core/lib/iomgr/tcp_server.h +1 -1
- data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.cc +5 -10
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/vsock.h +3 -1
- data/src/core/lib/resource_quota/memory_quota.cc +1 -1
- data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
- data/src/core/lib/security/authorization/rbac_policy.h +21 -3
- data/src/core/lib/surface/call.cc +3 -9
- data/src/core/lib/surface/call_utils.h +113 -0
- data/src/core/lib/surface/channel_create.cc +1 -1
- data/src/core/lib/surface/channel_create.h +0 -2
- data/src/core/lib/surface/channel_init.cc +77 -38
- data/src/core/lib/surface/channel_init.h +30 -16
- data/src/core/lib/surface/filter_stack_call.cc +5 -10
- data/src/core/lib/surface/init.cc +13 -27
- data/src/core/lib/surface/legacy_channel.cc +3 -1
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/error_utils.cc +0 -27
- data/src/core/lib/transport/error_utils.h +0 -16
- data/src/core/lib/transport/transport.h +7 -5
- data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
- data/src/core/load_balancing/rls/rls.cc +28 -11
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
- data/src/core/load_balancing/xds/cds.cc +3 -1
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
- data/src/core/mitigation_engine/mitigation.h +14 -5
- data/src/core/mitigation_engine/mitigation_engine.h +7 -3
- data/src/core/mitigation_engine/mitigation_provider.h +2 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
- data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
- data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
- data/src/core/resolver/xds/xds_resolver.cc +35 -9
- data/src/core/server/server.cc +2 -6
- data/src/core/server/server_config_selector.h +18 -3
- data/src/core/server/server_config_selector_filter.cc +178 -91
- data/src/core/server/server_config_selector_filter.h +58 -3
- data/src/core/server/xds_server_config_fetcher.cc +196 -129
- data/src/core/server/xds_server_config_fetcher.h +49 -0
- data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
- data/src/core/telemetry/histogram.h +94 -14
- data/src/core/telemetry/instrument.cc +179 -74
- data/src/core/telemetry/instrument.h +78 -30
- data/src/core/telemetry/metrics.h +5 -0
- data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
- data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
- data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
- data/src/core/tsi/ssl_telemetry_utils.h +12 -2
- data/src/core/tsi/ssl_transport_security.cc +238 -80
- data/src/core/tsi/ssl_transport_security.h +63 -33
- data/src/core/tsi/tls_telemetry.cc +31 -0
- data/src/core/tsi/tls_telemetry.h +47 -0
- data/src/core/tsi/transport_security.cc +2 -2
- data/src/core/tsi/transport_security.h +1 -1
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
- data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
- data/src/core/util/http_client/httpcli.cc +16 -53
- data/src/core/util/http_client/httpcli.h +0 -7
- data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
- data/src/core/util/linux/cpu.cc +1 -1
- data/src/core/util/load_file.cc +3 -9
- data/src/core/util/load_file.h +3 -4
- data/src/core/util/matchers.h +8 -0
- data/src/core/util/posix/cpu.cc +1 -1
- data/src/core/util/status_helper.cc +0 -20
- data/src/core/util/status_helper.h +3 -14
- data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
- data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
- data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
- data/src/core/xds/grpc/xds_client_grpc.h +0 -4
- data/src/core/xds/grpc/xds_cluster.h +1 -0
- data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
- data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
- data/src/core/xds/grpc/xds_common_types.cc +0 -91
- data/src/core/xds/grpc/xds_common_types.h +1 -47
- data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
- data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
- data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
- data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
- data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
- data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
- data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
- data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
- data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
- data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
- data/src/core/xds/grpc/xds_http_filter.cc +2 -1
- data/src/core/xds/grpc/xds_http_filter.h +6 -5
- data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
- data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
- data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
- data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
- data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
- data/src/core/xds/grpc/xds_listener.cc +2 -0
- data/src/core/xds/grpc/xds_listener.h +5 -0
- data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
- data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
- data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
- data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
- data/src/core/xds/grpc/xds_route_config.cc +2 -0
- data/src/core/xds/grpc/xds_route_config.h +3 -1
- data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
- data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
- data/src/core/xds/grpc/xds_routing.cc +116 -69
- data/src/core/xds/grpc/xds_routing.h +19 -8
- data/src/core/xds/grpc/xds_tls_context.cc +117 -0
- data/src/core/xds/grpc/xds_tls_context.h +76 -0
- data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
- data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
- data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_call.c +26 -15
- data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/test/client.rb +5 -4
- data/src/ruby/spec/call_spec.rb +14 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
- metadata +50 -35
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
- data/src/core/lib/iomgr/resolve_address.cc +0 -59
- data/src/core/lib/iomgr/resolve_address.h +0 -125
- data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
- data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
- data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
- data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
- data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
- data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
- data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
- data/src/core/util/json/json_util.cc +0 -101
- data/src/core/util/json/json_util.h +0 -163
|
@@ -25,168 +25,203 @@
|
|
|
25
25
|
#include <zconf.h>
|
|
26
26
|
#include <zlib.h>
|
|
27
27
|
|
|
28
|
+
#include <algorithm>
|
|
29
|
+
#include <cstdint>
|
|
30
|
+
#include <optional>
|
|
31
|
+
|
|
28
32
|
#include "src/core/lib/slice/slice.h"
|
|
29
33
|
#include "src/core/util/grpc_check.h"
|
|
34
|
+
#include "src/core/util/status_helper.h"
|
|
30
35
|
#include "absl/log/log.h"
|
|
36
|
+
#include "absl/status/status.h"
|
|
37
|
+
#include "absl/status/statusor.h"
|
|
31
38
|
|
|
32
39
|
#define OUTPUT_BLOCK_SIZE 1024
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
namespace grpc_core {
|
|
42
|
+
namespace {
|
|
43
|
+
|
|
44
|
+
absl::StatusOr<SliceBuffer> ZlibBody(z_stream* zs, const SliceBuffer& input,
|
|
45
|
+
int (*flate)(z_stream* zs, int flush),
|
|
46
|
+
std::optional<uint32_t> max_output_size) {
|
|
37
47
|
int r = Z_STREAM_END; // Do not fail on an empty input.
|
|
38
48
|
int flush;
|
|
39
49
|
size_t i;
|
|
40
|
-
|
|
50
|
+
uint32_t remaining_output_size = max_output_size.value_or(UINT32_MAX);
|
|
51
|
+
SliceBuffer output_sb;
|
|
41
52
|
const uInt uint_max = ~uInt{0};
|
|
53
|
+
auto outbuf = MutableSlice::CreateUninitialized(
|
|
54
|
+
std::min<uint32_t>(remaining_output_size, OUTPUT_BLOCK_SIZE));
|
|
42
55
|
|
|
43
|
-
GRPC_CHECK(
|
|
44
|
-
zs->avail_out = static_cast<uInt>
|
|
45
|
-
zs->next_out =
|
|
56
|
+
GRPC_CHECK(outbuf.length() <= uint_max);
|
|
57
|
+
zs->avail_out = static_cast<uInt>(outbuf.length());
|
|
58
|
+
zs->next_out = const_cast<uint8_t*>(outbuf.begin());
|
|
46
59
|
flush = Z_NO_FLUSH;
|
|
47
|
-
for (i = 0; i < input
|
|
48
|
-
if (i == input
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
for (i = 0; i < input.Count(); i++) {
|
|
61
|
+
if (i == input.Count() - 1) {
|
|
62
|
+
flush = Z_FINISH;
|
|
63
|
+
}
|
|
64
|
+
GRPC_CHECK(input[i].length() <= uint_max);
|
|
65
|
+
zs->avail_in = static_cast<uInt>(input[i].length());
|
|
66
|
+
zs->next_in = const_cast<uint8_t*>(input[i].begin());
|
|
52
67
|
do {
|
|
53
68
|
if (zs->avail_out == 0) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
if (max_output_size.has_value() && remaining_output_size == 0) {
|
|
70
|
+
VLOG(2) << "zlib: max provided output size exceeded";
|
|
71
|
+
return absl::ResourceExhaustedError(
|
|
72
|
+
"Decompressed message larger than max");
|
|
73
|
+
}
|
|
74
|
+
output_sb.AppendIndexed(Slice(std::move(outbuf)));
|
|
75
|
+
outbuf = MutableSlice::CreateUninitialized(
|
|
76
|
+
std::min<uint32_t>(remaining_output_size, OUTPUT_BLOCK_SIZE));
|
|
77
|
+
// Update remaining output size to reflect the size of the slice we just
|
|
78
|
+
// filled with compressed / decompressed data.
|
|
79
|
+
if (max_output_size.has_value()) {
|
|
80
|
+
remaining_output_size -= outbuf.length();
|
|
81
|
+
}
|
|
82
|
+
GRPC_CHECK(outbuf.length() <= uint_max);
|
|
83
|
+
zs->avail_out = static_cast<uInt>(outbuf.length());
|
|
84
|
+
zs->next_out = const_cast<uint8_t*>(outbuf.begin());
|
|
59
85
|
}
|
|
60
86
|
r = flate(zs, flush);
|
|
61
87
|
if (r < 0 && r != Z_BUF_ERROR /* not fatal */) {
|
|
62
88
|
VLOG(2) << "zlib error (" << r << ")";
|
|
63
|
-
|
|
89
|
+
return absl::InternalError("Decompression failed due to zlib error");
|
|
64
90
|
}
|
|
65
91
|
} while (zs->avail_out == 0);
|
|
66
92
|
if (zs->avail_in) {
|
|
67
93
|
VLOG(2) << "zlib: not all input consumed";
|
|
68
|
-
|
|
94
|
+
return absl::InternalError(
|
|
95
|
+
"Decompression failed due to not all input "
|
|
96
|
+
"consumed");
|
|
69
97
|
}
|
|
70
98
|
}
|
|
71
99
|
if (r != Z_STREAM_END) {
|
|
72
100
|
VLOG(2) << "zlib: Data error";
|
|
73
|
-
|
|
101
|
+
return absl::InternalError("Decompression failed due to data error");
|
|
74
102
|
}
|
|
75
103
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
104
|
+
// TODO(vigneshbabu): Add a Truncate() method to the Slice type to avoid using
|
|
105
|
+
// the underlying C type here.
|
|
106
|
+
grpc_slice slice = outbuf.TakeCSlice();
|
|
107
|
+
if (slice.refcount) {
|
|
108
|
+
slice.data.refcounted.length -= zs->avail_out;
|
|
109
|
+
} else {
|
|
110
|
+
slice.data.inlined.length -= zs->avail_out;
|
|
111
|
+
}
|
|
112
|
+
output_sb.AppendIndexed(Slice(slice));
|
|
113
|
+
return output_sb;
|
|
85
114
|
}
|
|
86
115
|
|
|
87
|
-
|
|
88
|
-
unsigned int size) {
|
|
116
|
+
void* ZallocGpr(void* /*opaque*/, unsigned int items, unsigned int size) {
|
|
89
117
|
return gpr_malloc(items * size);
|
|
90
118
|
}
|
|
91
119
|
|
|
92
|
-
|
|
120
|
+
void ZFreeGpr(void* /*opaque*/, void* address) { gpr_free(address); }
|
|
93
121
|
|
|
94
|
-
|
|
95
|
-
int gzip) {
|
|
122
|
+
std::optional<SliceBuffer> ZlibCompress(const SliceBuffer& input, int gzip) {
|
|
96
123
|
z_stream zs;
|
|
97
|
-
|
|
98
|
-
size_t i;
|
|
99
|
-
size_t count_before = output->count;
|
|
100
|
-
size_t length_before = output->length;
|
|
124
|
+
absl::StatusOr<SliceBuffer> compression_result;
|
|
101
125
|
memset(&zs, 0, sizeof(zs));
|
|
102
|
-
zs.zalloc =
|
|
103
|
-
zs.zfree =
|
|
104
|
-
r = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
|
|
105
|
-
|
|
126
|
+
zs.zalloc = ZallocGpr;
|
|
127
|
+
zs.zfree = ZFreeGpr;
|
|
128
|
+
bool r = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
|
|
129
|
+
15 | (gzip ? 16 : 0), 8, Z_DEFAULT_STRATEGY);
|
|
106
130
|
GRPC_CHECK(r == Z_OK);
|
|
107
|
-
|
|
108
|
-
if (!r) {
|
|
109
|
-
for (i = count_before; i < output->count; i++) {
|
|
110
|
-
grpc_core::CSliceUnref(output->slices[i]);
|
|
111
|
-
}
|
|
112
|
-
output->count = count_before;
|
|
113
|
-
output->length = length_before;
|
|
114
|
-
}
|
|
131
|
+
compression_result = ZlibBody(&zs, input, deflate, input.Length());
|
|
115
132
|
deflateEnd(&zs);
|
|
116
|
-
|
|
133
|
+
if (compression_result.ok() &&
|
|
134
|
+
compression_result->Length() < input.Length()) {
|
|
135
|
+
return std::move(*compression_result);
|
|
136
|
+
}
|
|
137
|
+
return std::nullopt;
|
|
117
138
|
}
|
|
118
139
|
|
|
119
|
-
|
|
120
|
-
|
|
140
|
+
absl::StatusOr<SliceBuffer> ZlibDecompress(
|
|
141
|
+
const SliceBuffer& input, int gzip,
|
|
142
|
+
std::optional<uint32_t> max_output_size) {
|
|
121
143
|
z_stream zs;
|
|
122
|
-
|
|
123
|
-
size_t i;
|
|
124
|
-
size_t count_before = output->count;
|
|
125
|
-
size_t length_before = output->length;
|
|
144
|
+
absl::StatusOr<SliceBuffer> decompression_result;
|
|
126
145
|
memset(&zs, 0, sizeof(zs));
|
|
127
|
-
zs.zalloc =
|
|
128
|
-
zs.zfree =
|
|
129
|
-
r = inflateInit2(&zs, 15 | (gzip ? 16 : 0));
|
|
146
|
+
zs.zalloc = ZallocGpr;
|
|
147
|
+
zs.zfree = ZFreeGpr;
|
|
148
|
+
bool r = inflateInit2(&zs, 15 | (gzip ? 16 : 0));
|
|
130
149
|
GRPC_CHECK(r == Z_OK);
|
|
131
|
-
|
|
132
|
-
if (!r) {
|
|
133
|
-
for (i = count_before; i < output->count; i++) {
|
|
134
|
-
grpc_core::CSliceUnref(output->slices[i]);
|
|
135
|
-
}
|
|
136
|
-
output->count = count_before;
|
|
137
|
-
output->length = length_before;
|
|
138
|
-
}
|
|
150
|
+
decompression_result = ZlibBody(&zs, input, inflate, max_output_size);
|
|
139
151
|
inflateEnd(&zs);
|
|
140
|
-
return
|
|
152
|
+
return decompression_result;
|
|
141
153
|
}
|
|
142
154
|
|
|
143
|
-
|
|
144
|
-
size_t i;
|
|
145
|
-
for (i = 0; i < input->count; i++) {
|
|
146
|
-
grpc_slice_buffer_add(output, grpc_core::CSliceRef(input->slices[i]));
|
|
147
|
-
}
|
|
148
|
-
return 1;
|
|
149
|
-
}
|
|
155
|
+
} // namespace
|
|
150
156
|
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
std::optional<SliceBuffer> MessageCompress(grpc_compression_algorithm algorithm,
|
|
158
|
+
const SliceBuffer& input) {
|
|
153
159
|
switch (algorithm) {
|
|
154
160
|
case GRPC_COMPRESS_NONE:
|
|
155
161
|
// the fallback path always needs to be send uncompressed: we simply
|
|
156
162
|
// rely on that here
|
|
157
|
-
return
|
|
163
|
+
return std::nullopt;
|
|
158
164
|
case GRPC_COMPRESS_DEFLATE:
|
|
159
|
-
return
|
|
165
|
+
return ZlibCompress(input, 0);
|
|
160
166
|
case GRPC_COMPRESS_GZIP:
|
|
161
|
-
return
|
|
167
|
+
return ZlibCompress(input, 1);
|
|
162
168
|
case GRPC_COMPRESS_ALGORITHMS_COUNT:
|
|
163
169
|
break;
|
|
164
170
|
}
|
|
165
171
|
LOG(ERROR) << "invalid compression algorithm " << algorithm;
|
|
166
|
-
return
|
|
172
|
+
return std::nullopt;
|
|
167
173
|
}
|
|
168
174
|
|
|
175
|
+
absl::StatusOr<SliceBuffer> MessageDecompress(
|
|
176
|
+
grpc_compression_algorithm algorithm, const SliceBuffer& input,
|
|
177
|
+
std::optional<uint32_t> max_output_size) {
|
|
178
|
+
switch (algorithm) {
|
|
179
|
+
case GRPC_COMPRESS_NONE: {
|
|
180
|
+
SliceBuffer output;
|
|
181
|
+
output.Append(input);
|
|
182
|
+
return output;
|
|
183
|
+
}
|
|
184
|
+
case GRPC_COMPRESS_DEFLATE:
|
|
185
|
+
return ZlibDecompress(input, 0, max_output_size);
|
|
186
|
+
case GRPC_COMPRESS_GZIP:
|
|
187
|
+
return ZlibDecompress(input, 1, max_output_size);
|
|
188
|
+
case GRPC_COMPRESS_ALGORITHMS_COUNT:
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
LOG(ERROR) << "invalid compression algorithm " << algorithm;
|
|
192
|
+
return absl::InternalError("Invalid compression algorithm");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
} // namespace grpc_core
|
|
196
|
+
|
|
169
197
|
int grpc_msg_compress(grpc_compression_algorithm algorithm,
|
|
170
198
|
grpc_slice_buffer* input, grpc_slice_buffer* output) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
199
|
+
int retval = 1;
|
|
200
|
+
grpc_core::SliceBuffer input_sb;
|
|
201
|
+
grpc_slice_buffer_swap(input, input_sb.c_slice_buffer());
|
|
202
|
+
std::optional<grpc_core::SliceBuffer> output_sb =
|
|
203
|
+
grpc_core::MessageCompress(algorithm, input_sb);
|
|
204
|
+
if (!output_sb.has_value()) {
|
|
205
|
+
output_sb.emplace();
|
|
206
|
+
output_sb->Append(input_sb);
|
|
207
|
+
retval = 0;
|
|
174
208
|
}
|
|
175
|
-
|
|
209
|
+
grpc_slice_buffer_swap(input, input_sb.c_slice_buffer());
|
|
210
|
+
grpc_slice_buffer_swap(output, output_sb->c_slice_buffer());
|
|
211
|
+
return retval;
|
|
176
212
|
}
|
|
177
213
|
|
|
178
214
|
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
|
|
179
215
|
grpc_slice_buffer* input, grpc_slice_buffer* output) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
case GRPC_COMPRESS_ALGORITHMS_COUNT:
|
|
188
|
-
break;
|
|
216
|
+
grpc_core::SliceBuffer input_sb;
|
|
217
|
+
grpc_slice_buffer_swap(input, input_sb.c_slice_buffer());
|
|
218
|
+
|
|
219
|
+
absl::StatusOr<grpc_core::SliceBuffer> output_sb =
|
|
220
|
+
grpc_core::MessageDecompress(algorithm, input_sb, std::nullopt);
|
|
221
|
+
if (!output_sb.ok()) {
|
|
222
|
+
return 0;
|
|
189
223
|
}
|
|
190
|
-
|
|
191
|
-
|
|
224
|
+
grpc_slice_buffer_swap(input, input_sb.c_slice_buffer());
|
|
225
|
+
grpc_slice_buffer_swap(output, output_sb->c_slice_buffer());
|
|
226
|
+
return 1;
|
|
192
227
|
}
|
|
@@ -23,6 +23,13 @@
|
|
|
23
23
|
#include <grpc/slice.h>
|
|
24
24
|
#include <grpc/support/port_platform.h>
|
|
25
25
|
|
|
26
|
+
#include <cstdint>
|
|
27
|
+
#include <optional>
|
|
28
|
+
|
|
29
|
+
#include "src/core/lib/slice/slice_buffer.h"
|
|
30
|
+
#include "absl/status/status.h"
|
|
31
|
+
#include "absl/status/statusor.h"
|
|
32
|
+
|
|
26
33
|
// compress 'input' to 'output' using 'algorithm'.
|
|
27
34
|
// On success, appends compressed slices to output and returns 1.
|
|
28
35
|
// On failure, appends uncompressed slices to output and returns 0.
|
|
@@ -35,4 +42,21 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm,
|
|
|
35
42
|
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
|
|
36
43
|
grpc_slice_buffer* input, grpc_slice_buffer* output);
|
|
37
44
|
|
|
45
|
+
namespace grpc_core {
|
|
46
|
+
|
|
47
|
+
// Compresses 'input' using 'algorithm'.
|
|
48
|
+
// On success, returns a SliceBuffer containing the compressed data.
|
|
49
|
+
// On failure, returns nullopt.
|
|
50
|
+
std::optional<SliceBuffer> MessageCompress(grpc_compression_algorithm algorithm,
|
|
51
|
+
const SliceBuffer& input);
|
|
52
|
+
// Decompresses 'input'.
|
|
53
|
+
// On success, returns a SliceBuffer containing the decompressed data.
|
|
54
|
+
// On failure, returns a non-OK status.
|
|
55
|
+
// Fails if the decompressed data would be larger than max_output_size.
|
|
56
|
+
absl::StatusOr<SliceBuffer> MessageDecompress(
|
|
57
|
+
grpc_compression_algorithm algorithm, const SliceBuffer& input,
|
|
58
|
+
std::optional<uint32_t> max_output_size);
|
|
59
|
+
|
|
60
|
+
} // namespace grpc_core
|
|
61
|
+
|
|
38
62
|
#endif // GRPC_SRC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
|
|
@@ -68,6 +68,7 @@ TraceFlag client_channel_trace(false, "client_channel");
|
|
|
68
68
|
TraceFlag client_channel_call_trace(false, "client_channel_call");
|
|
69
69
|
TraceFlag client_channel_lb_call_trace(false, "client_channel_lb_call");
|
|
70
70
|
TraceFlag client_idle_filter_trace(false, "client_idle_filter");
|
|
71
|
+
TraceFlag composite_filter_trace(false, "composite_filter");
|
|
71
72
|
TraceFlag compression_trace(false, "compression");
|
|
72
73
|
TraceFlag connectivity_state_trace(false, "connectivity_state");
|
|
73
74
|
TraceFlag dns_resolver_trace(false, "dns_resolver");
|
|
@@ -79,6 +80,7 @@ TraceFlag event_engine_dns_trace(false, "event_engine_dns");
|
|
|
79
80
|
TraceFlag event_engine_endpoint_trace(false, "event_engine_endpoint");
|
|
80
81
|
TraceFlag event_engine_endpoint_data_trace(false, "event_engine_endpoint_data");
|
|
81
82
|
TraceFlag event_engine_poller_trace(false, "event_engine_poller");
|
|
83
|
+
TraceFlag ext_proc_filter_trace(false, "ext_proc_filter");
|
|
82
84
|
TraceFlag fault_injection_filter_trace(false, "fault_injection_filter");
|
|
83
85
|
TraceFlag flowctl_trace(false, "flowctl");
|
|
84
86
|
TraceFlag fork_trace(false, "fork");
|
|
@@ -109,6 +111,8 @@ TraceFlag rls_lb_trace(false, "rls_lb");
|
|
|
109
111
|
TraceFlag round_robin_trace(false, "round_robin");
|
|
110
112
|
TraceFlag secure_endpoint_trace(false, "secure_endpoint");
|
|
111
113
|
TraceFlag server_channel_trace(false, "server_channel");
|
|
114
|
+
TraceFlag server_config_selector_interceptor_trace(
|
|
115
|
+
false, "server_config_selector_interceptor");
|
|
112
116
|
TraceFlag stateful_session_filter_trace(false, "stateful_session_filter");
|
|
113
117
|
TraceFlag subchannel_trace(false, "subchannel");
|
|
114
118
|
TraceFlag subchannel_call_trace(false, "subchannel_call");
|
|
@@ -151,6 +155,7 @@ const absl::flat_hash_map<std::string, TraceFlag*>& GetAllTraceFlags() {
|
|
|
151
155
|
{"client_channel_call", &client_channel_call_trace},
|
|
152
156
|
{"client_channel_lb_call", &client_channel_lb_call_trace},
|
|
153
157
|
{"client_idle_filter", &client_idle_filter_trace},
|
|
158
|
+
{"composite_filter", &composite_filter_trace},
|
|
154
159
|
{"compression", &compression_trace},
|
|
155
160
|
{"connectivity_state", &connectivity_state_trace},
|
|
156
161
|
{"dns_resolver", &dns_resolver_trace},
|
|
@@ -162,6 +167,7 @@ const absl::flat_hash_map<std::string, TraceFlag*>& GetAllTraceFlags() {
|
|
|
162
167
|
{"event_engine_endpoint", &event_engine_endpoint_trace},
|
|
163
168
|
{"event_engine_endpoint_data", &event_engine_endpoint_data_trace},
|
|
164
169
|
{"event_engine_poller", &event_engine_poller_trace},
|
|
170
|
+
{"ext_proc_filter", &ext_proc_filter_trace},
|
|
165
171
|
{"fault_injection_filter", &fault_injection_filter_trace},
|
|
166
172
|
{"flowctl", &flowctl_trace},
|
|
167
173
|
{"fork", &fork_trace},
|
|
@@ -192,6 +198,8 @@ const absl::flat_hash_map<std::string, TraceFlag*>& GetAllTraceFlags() {
|
|
|
192
198
|
{"round_robin", &round_robin_trace},
|
|
193
199
|
{"secure_endpoint", &secure_endpoint_trace},
|
|
194
200
|
{"server_channel", &server_channel_trace},
|
|
201
|
+
{"server_config_selector_interceptor",
|
|
202
|
+
&server_config_selector_interceptor_trace},
|
|
195
203
|
{"stateful_session_filter", &stateful_session_filter_trace},
|
|
196
204
|
{"subchannel", &subchannel_trace},
|
|
197
205
|
{"subchannel_call", &subchannel_call_trace},
|
|
@@ -67,6 +67,7 @@ extern TraceFlag client_channel_trace;
|
|
|
67
67
|
extern TraceFlag client_channel_call_trace;
|
|
68
68
|
extern TraceFlag client_channel_lb_call_trace;
|
|
69
69
|
extern TraceFlag client_idle_filter_trace;
|
|
70
|
+
extern TraceFlag composite_filter_trace;
|
|
70
71
|
extern TraceFlag compression_trace;
|
|
71
72
|
extern TraceFlag connectivity_state_trace;
|
|
72
73
|
extern TraceFlag dns_resolver_trace;
|
|
@@ -77,6 +78,7 @@ extern TraceFlag event_engine_dns_trace;
|
|
|
77
78
|
extern TraceFlag event_engine_endpoint_trace;
|
|
78
79
|
extern TraceFlag event_engine_endpoint_data_trace;
|
|
79
80
|
extern TraceFlag event_engine_poller_trace;
|
|
81
|
+
extern TraceFlag ext_proc_filter_trace;
|
|
80
82
|
extern TraceFlag fault_injection_filter_trace;
|
|
81
83
|
extern TraceFlag flowctl_trace;
|
|
82
84
|
extern TraceFlag fork_trace;
|
|
@@ -107,6 +109,7 @@ extern TraceFlag rls_lb_trace;
|
|
|
107
109
|
extern TraceFlag round_robin_trace;
|
|
108
110
|
extern TraceFlag secure_endpoint_trace;
|
|
109
111
|
extern TraceFlag server_channel_trace;
|
|
112
|
+
extern TraceFlag server_config_selector_interceptor_trace;
|
|
110
113
|
extern TraceFlag stateful_session_filter_trace;
|
|
111
114
|
extern TraceFlag subchannel_trace;
|
|
112
115
|
extern TraceFlag subchannel_call_trace;
|
|
@@ -60,11 +60,13 @@
|
|
|
60
60
|
#include "src/core/lib/event_engine/grpc_polled_fd.h"
|
|
61
61
|
#include "src/core/lib/event_engine/time_util.h"
|
|
62
62
|
#include "src/core/lib/iomgr/resolved_address.h"
|
|
63
|
+
#include "src/core/util/address_sorting_init.h"
|
|
63
64
|
#include "src/core/util/debug_location.h"
|
|
64
65
|
#include "src/core/util/grpc_check.h"
|
|
65
66
|
#include "src/core/util/host_port.h"
|
|
66
67
|
#include "src/core/util/orphanable.h"
|
|
67
68
|
#include "src/core/util/ref_counted_ptr.h"
|
|
69
|
+
#include "absl/base/call_once.h"
|
|
68
70
|
#include "absl/functional/any_invocable.h"
|
|
69
71
|
#include "absl/log/log.h"
|
|
70
72
|
#include "absl/strings/match.h"
|
|
@@ -79,8 +81,58 @@
|
|
|
79
81
|
|
|
80
82
|
namespace grpc_event_engine::experimental {
|
|
81
83
|
|
|
84
|
+
std::vector<EventEngine::ResolvedAddress> SortAddresses(
|
|
85
|
+
const std::vector<EventEngine::ResolvedAddress>& addresses) {
|
|
86
|
+
address_sorting_sortable* sortables = static_cast<address_sorting_sortable*>(
|
|
87
|
+
gpr_zalloc(sizeof(address_sorting_sortable) * addresses.size()));
|
|
88
|
+
for (size_t i = 0; i < addresses.size(); i++) {
|
|
89
|
+
sortables[i].user_data =
|
|
90
|
+
const_cast<EventEngine::ResolvedAddress*>(&addresses[i]);
|
|
91
|
+
memcpy(&sortables[i].dest_addr.addr, addresses[i].address(),
|
|
92
|
+
addresses[i].size());
|
|
93
|
+
sortables[i].dest_addr.len = addresses[i].size();
|
|
94
|
+
}
|
|
95
|
+
address_sorting_rfc_6724_sort(sortables, addresses.size());
|
|
96
|
+
std::vector<EventEngine::ResolvedAddress> sorted_addresses;
|
|
97
|
+
sorted_addresses.reserve(addresses.size());
|
|
98
|
+
for (size_t i = 0; i < addresses.size(); ++i) {
|
|
99
|
+
sorted_addresses.emplace_back(
|
|
100
|
+
*static_cast<EventEngine::ResolvedAddress*>(sortables[i].user_data));
|
|
101
|
+
}
|
|
102
|
+
gpr_free(sortables);
|
|
103
|
+
return sorted_addresses;
|
|
104
|
+
}
|
|
105
|
+
|
|
82
106
|
namespace {
|
|
83
107
|
|
|
108
|
+
absl::Status AresInit() {
|
|
109
|
+
if (ShouldUseAresDnsResolver()) {
|
|
110
|
+
// ares_library_init and ares_library_cleanup are currently no-op except
|
|
111
|
+
// under Windows. Calling them may cause race conditions when other parts of
|
|
112
|
+
// the binary calls these functions concurrently.
|
|
113
|
+
#ifdef GPR_WINDOWS
|
|
114
|
+
int status = ares_library_init(ARES_LIB_INIT_ALL);
|
|
115
|
+
if (status != ARES_SUCCESS) {
|
|
116
|
+
return GRPC_ERROR_CREATE(
|
|
117
|
+
absl::StrCat("ares_library_init failed: ", ares_strerror(status)));
|
|
118
|
+
}
|
|
119
|
+
#endif // GPR_WINDOWS
|
|
120
|
+
}
|
|
121
|
+
return absl::OkStatus();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
absl::once_flag init_flag;
|
|
125
|
+
|
|
126
|
+
void AresOnceInit() {
|
|
127
|
+
grpc_core::AddressSortingInitOnce();
|
|
128
|
+
absl::call_once(init_flag, []() {
|
|
129
|
+
auto status = AresInit();
|
|
130
|
+
if (!status.ok()) {
|
|
131
|
+
VLOG(2) << "AresInit failed: " << status.message();
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
84
136
|
// A hard limit on the number of records (A/AAAA or SRV) we may get from a
|
|
85
137
|
// single response. This is to be defensive to prevent a bad DNS response from
|
|
86
138
|
// OOMing the process.
|
|
@@ -151,28 +203,6 @@ absl::Status SetRequestDNSServer(absl::string_view dns_server,
|
|
|
151
203
|
return absl::OkStatus();
|
|
152
204
|
}
|
|
153
205
|
|
|
154
|
-
std::vector<EventEngine::ResolvedAddress> SortAddresses(
|
|
155
|
-
const std::vector<EventEngine::ResolvedAddress>& addresses) {
|
|
156
|
-
address_sorting_sortable* sortables = static_cast<address_sorting_sortable*>(
|
|
157
|
-
gpr_zalloc(sizeof(address_sorting_sortable) * addresses.size()));
|
|
158
|
-
for (size_t i = 0; i < addresses.size(); i++) {
|
|
159
|
-
sortables[i].user_data =
|
|
160
|
-
const_cast<EventEngine::ResolvedAddress*>(&addresses[i]);
|
|
161
|
-
memcpy(&sortables[i].dest_addr.addr, addresses[i].address(),
|
|
162
|
-
addresses[i].size());
|
|
163
|
-
sortables[i].dest_addr.len = addresses[i].size();
|
|
164
|
-
}
|
|
165
|
-
address_sorting_rfc_6724_sort(sortables, addresses.size());
|
|
166
|
-
std::vector<EventEngine::ResolvedAddress> sorted_addresses;
|
|
167
|
-
sorted_addresses.reserve(addresses.size());
|
|
168
|
-
for (size_t i = 0; i < addresses.size(); ++i) {
|
|
169
|
-
sorted_addresses.emplace_back(
|
|
170
|
-
*static_cast<EventEngine::ResolvedAddress*>(sortables[i].user_data));
|
|
171
|
-
}
|
|
172
|
-
gpr_free(sortables);
|
|
173
|
-
return sorted_addresses;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
206
|
struct QueryArg {
|
|
177
207
|
QueryArg(AresResolver* ar, int id, absl::string_view name)
|
|
178
208
|
: ares_resolver(ar), callback_map_id(id), query_name(name) {}
|
|
@@ -253,6 +283,7 @@ AresResolver::CreateAresResolver(
|
|
|
253
283
|
std::unique_ptr<GrpcPolledFdFactory> polled_fd_factory,
|
|
254
284
|
std::shared_ptr<EventEngine> event_engine) {
|
|
255
285
|
ares_channel channel;
|
|
286
|
+
AresOnceInit();
|
|
256
287
|
absl::Status status =
|
|
257
288
|
InitAresChannel(dns_server, *polled_fd_factory, &channel);
|
|
258
289
|
if (!status.ok()) {
|
|
@@ -276,6 +307,7 @@ AresResolver::AresResolver(
|
|
|
276
307
|
#endif // GRPC_ENABLE_FORK_SUPPORT
|
|
277
308
|
event_engine_(std::move(event_engine)) {
|
|
278
309
|
(void)dns_server; // Used whether or not compiled with fork support
|
|
310
|
+
AresOnceInit();
|
|
279
311
|
polled_fd_factory_->Initialize(&mutex_, event_engine_.get());
|
|
280
312
|
}
|
|
281
313
|
|
|
@@ -951,36 +983,8 @@ bool ShouldUseAresDnsResolver() {
|
|
|
951
983
|
// defined(GRPC_WINDOWS_SOCKET_ARES_EV_DRIVER)
|
|
952
984
|
}
|
|
953
985
|
|
|
954
|
-
absl::Status AresInit() {
|
|
955
|
-
if (ShouldUseAresDnsResolver()) {
|
|
956
|
-
// ares_library_init and ares_library_cleanup are currently no-op except
|
|
957
|
-
// under Windows. Calling them may cause race conditions when other parts of
|
|
958
|
-
// the binary calls these functions concurrently.
|
|
959
|
-
#ifdef GPR_WINDOWS
|
|
960
|
-
int status = ares_library_init(ARES_LIB_INIT_ALL);
|
|
961
|
-
if (status != ARES_SUCCESS) {
|
|
962
|
-
return GRPC_ERROR_CREATE(
|
|
963
|
-
absl::StrCat("ares_library_init failed: ", ares_strerror(status)));
|
|
964
|
-
}
|
|
965
|
-
#endif // GPR_WINDOWS
|
|
966
|
-
}
|
|
967
|
-
return absl::OkStatus();
|
|
968
|
-
}
|
|
969
|
-
void AresShutdown() {
|
|
970
|
-
if (ShouldUseAresDnsResolver()) {
|
|
971
|
-
// ares_library_init and ares_library_cleanup are currently no-op except
|
|
972
|
-
// under Windows. Calling them may cause race conditions when other parts of
|
|
973
|
-
// the binary calls these functions concurrently.
|
|
974
|
-
#ifdef GPR_WINDOWS
|
|
975
|
-
ares_library_cleanup();
|
|
976
|
-
#endif // GPR_WINDOWS
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
|
|
980
986
|
#else // GRPC_ARES == 1
|
|
981
987
|
|
|
982
988
|
bool ShouldUseAresDnsResolver() { return false; }
|
|
983
|
-
absl::Status AresInit() { return absl::OkStatus(); }
|
|
984
|
-
void AresShutdown() {}
|
|
985
989
|
|
|
986
990
|
#endif // GRPC_ARES == 1
|
|
@@ -41,6 +41,9 @@
|
|
|
41
41
|
|
|
42
42
|
namespace grpc_event_engine::experimental {
|
|
43
43
|
|
|
44
|
+
std::vector<EventEngine::ResolvedAddress> SortAddresses(
|
|
45
|
+
const std::vector<EventEngine::ResolvedAddress>& addresses);
|
|
46
|
+
|
|
44
47
|
class AresResolver : public RefCountedDNSResolverInterface {
|
|
45
48
|
public:
|
|
46
49
|
#ifdef GRPC_ENABLE_FORK_SUPPORT
|
|
@@ -182,7 +185,5 @@ extern bool g_event_engine_grpc_ares_test_only_force_tcp;
|
|
|
182
185
|
#endif // GRPC_ARES == 1
|
|
183
186
|
|
|
184
187
|
bool ShouldUseAresDnsResolver();
|
|
185
|
-
absl::Status AresInit();
|
|
186
|
-
void AresShutdown();
|
|
187
188
|
|
|
188
189
|
#endif // GRPC_SRC_CORE_LIB_EVENT_ENGINE_ARES_RESOLVER_H
|
|
@@ -226,9 +226,9 @@ void Epoll1EventHandle::OrphanHandle(PosixEngineClosure* on_done,
|
|
|
226
226
|
// shutdown() syscall on that fd)
|
|
227
227
|
void Epoll1EventHandle::HandleShutdownInternal(absl::Status why,
|
|
228
228
|
bool releasing_fd) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
if (!absl::IsCancelled(why)) {
|
|
230
|
+
why = absl::UnavailableError(why.message());
|
|
231
|
+
}
|
|
232
232
|
if (read_closure_.SetShutdown(why)) {
|
|
233
233
|
if (releasing_fd) {
|
|
234
234
|
auto result = poller_->posix_interface().EpollCtlDel(
|
|
@@ -263,11 +263,7 @@ void PollEventHandle::OrphanHandle(PosixEngineClosure* on_done,
|
|
|
263
263
|
// Perform shutdown operations if not already done so.
|
|
264
264
|
if (!is_shutdown_) {
|
|
265
265
|
is_shutdown_ = true;
|
|
266
|
-
shutdown_error_ =
|
|
267
|
-
absl::Status(absl::StatusCode::kInternal, "FD Orphaned");
|
|
268
|
-
grpc_core::StatusSetInt(&shutdown_error_,
|
|
269
|
-
grpc_core::StatusIntProperty::kRpcStatus,
|
|
270
|
-
GRPC_STATUS_UNAVAILABLE);
|
|
266
|
+
shutdown_error_ = absl::UnavailableError("FD Orphaned");
|
|
271
267
|
SetReadyLocked(&read_closure_);
|
|
272
268
|
SetReadyLocked(&write_closure_);
|
|
273
269
|
}
|
|
@@ -341,11 +337,9 @@ void PollEventHandle::ShutdownHandle(absl::Status why) {
|
|
|
341
337
|
// only shutdown once
|
|
342
338
|
if (!is_shutdown_) {
|
|
343
339
|
is_shutdown_ = true;
|
|
344
|
-
shutdown_error_ =
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
absl::IsCancelled(shutdown_error_) ? GRPC_STATUS_CANCELLED
|
|
348
|
-
: GRPC_STATUS_UNAVAILABLE);
|
|
340
|
+
shutdown_error_ = absl::IsCancelled(why)
|
|
341
|
+
? std::move(why)
|
|
342
|
+
: absl::UnavailableError(why.message());
|
|
349
343
|
SetReadyLocked(&read_closure_);
|
|
350
344
|
SetReadyLocked(&write_closure_);
|
|
351
345
|
}
|