grpc 1.43.1 → 1.44.0.pre2
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 +84 -64
- data/include/grpc/grpc_security.h +10 -0
- data/include/grpc/impl/codegen/compression_types.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/client_channel/backend_metric.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +62 -68
- data/src/core/ext/filters/client_channel/client_channel.h +8 -8
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
- data/src/core/ext/filters/client_channel/config_selector.h +4 -4
- data/src/core/ext/filters/client_channel/dynamic_filters.h +1 -1
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -14
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +6 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +3 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +31 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +43 -29
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +120 -68
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +60 -48
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +62 -61
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +16 -11
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +11 -5
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +19 -15
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +14 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +50 -105
- data/src/core/ext/filters/client_channel/lb_policy.cc +15 -14
- data/src/core/ext/filters/client_channel/lb_policy.h +19 -3
- data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +207 -81
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +22 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +19 -15
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +23 -38
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +118 -207
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +25 -32
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +82 -73
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +10 -10
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +2 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +2 -5
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -5
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +157 -67
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +2 -2
- data/src/core/ext/filters/client_channel/retry_filter.cc +37 -64
- data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -1
- data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +1 -1
- data/src/core/ext/filters/client_channel/subchannel.cc +12 -16
- data/src/core/ext/filters/client_channel/subchannel.h +2 -3
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +37 -48
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +6 -8
- data/src/core/ext/filters/fault_injection/service_config_parser.h +1 -1
- data/src/core/ext/filters/http/client/http_client_filter.cc +51 -122
- data/src/core/ext/filters/http/client_authority_filter.cc +8 -24
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +42 -140
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +5 -25
- data/src/core/ext/filters/http/server/http_server_filter.cc +50 -135
- data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
- data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
- data/src/core/ext/filters/rbac/rbac_filter.cc +157 -0
- data/src/core/ext/filters/rbac/rbac_filter.h +74 -0
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +605 -0
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +70 -0
- data/src/core/ext/filters/server_config_selector/server_config_selector.h +3 -2
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +11 -6
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +1 -1
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +89 -29
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +45 -186
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +341 -279
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +69 -159
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +2 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +19 -32
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +94 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +2 -24
- data/src/core/ext/transport/chttp2/transport/internal.h +0 -33
- data/src/core/ext/transport/chttp2/transport/parsing.cc +0 -6
- data/src/core/ext/transport/chttp2/transport/writing.cc +47 -116
- data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -4
- data/src/core/ext/transport/inproc/inproc_transport.cc +11 -63
- data/src/core/ext/transport/inproc/inproc_transport.h +0 -3
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +61 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +146 -0
- data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +188 -0
- data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.c +154 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.h +95 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.c +58 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.c +44 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.c +153 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.h +100 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.c +75 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.h +55 -0
- data/src/core/ext/xds/upb_utils.h +65 -0
- data/src/core/ext/xds/xds_api.cc +81 -3458
- data/src/core/ext/xds/xds_api.h +56 -611
- data/src/core/ext/xds/xds_bootstrap.cc +189 -125
- data/src/core/ext/xds/xds_bootstrap.h +20 -15
- data/src/core/ext/xds/xds_certificate_provider.h +1 -0
- data/src/core/ext/xds/xds_channel_creds.cc +108 -0
- data/src/core/ext/xds/xds_channel_creds.h +50 -0
- data/src/core/ext/xds/xds_client.cc +584 -994
- data/src/core/ext/xds/xds_client.h +78 -135
- data/src/core/ext/xds/xds_cluster.cc +451 -0
- data/src/core/ext/xds/xds_cluster.h +111 -0
- data/src/core/ext/xds/xds_common_types.cc +388 -0
- data/src/core/ext/xds/xds_common_types.h +110 -0
- data/src/core/ext/xds/xds_endpoint.cc +364 -0
- data/src/core/ext/xds/xds_endpoint.h +135 -0
- data/src/core/ext/xds/xds_http_filters.cc +5 -0
- data/src/core/ext/xds/xds_http_rbac_filter.cc +563 -0
- data/src/core/ext/xds/xds_http_rbac_filter.h +54 -0
- data/src/core/ext/xds/xds_listener.cc +1036 -0
- data/src/core/ext/xds/xds_listener.h +220 -0
- data/src/core/ext/{transport/chttp2/transport/hpack_utils.h → xds/xds_resource_type.cc} +12 -9
- data/src/core/ext/xds/xds_resource_type.h +98 -0
- data/src/core/ext/xds/xds_resource_type_impl.h +87 -0
- data/src/core/ext/xds/xds_route_config.cc +993 -0
- data/src/core/ext/xds/xds_route_config.h +215 -0
- data/src/core/ext/xds/xds_routing.cc +11 -8
- data/src/core/ext/xds/xds_routing.h +8 -5
- data/src/core/ext/xds/xds_server_config_fetcher.cc +159 -99
- data/src/core/lib/address_utils/parse_address.cc +20 -0
- data/src/core/lib/address_utils/parse_address.h +5 -0
- data/src/core/lib/address_utils/sockaddr_utils.cc +33 -36
- data/src/core/lib/address_utils/sockaddr_utils.h +1 -16
- data/src/core/lib/backoff/backoff.cc +4 -30
- data/src/core/lib/backoff/backoff.h +3 -3
- data/src/core/lib/channel/channel_args.cc +0 -1
- data/src/core/lib/channel/channel_stack.cc +8 -0
- data/src/core/lib/channel/channel_stack.h +1 -1
- data/src/core/lib/channel/channel_stack_builder.cc +5 -9
- data/src/core/lib/channel/channel_stack_builder.h +4 -7
- data/src/core/lib/channel/channelz.cc +1 -0
- data/src/core/lib/compression/compression.cc +19 -111
- data/src/core/lib/compression/compression_internal.cc +142 -202
- data/src/core/lib/compression/compression_internal.h +64 -69
- data/src/core/lib/compression/message_compress.cc +11 -11
- data/src/core/lib/compression/message_compress.h +2 -2
- data/src/core/lib/gpr/useful.h +4 -0
- data/src/core/lib/gprpp/bitset.h +7 -0
- data/src/core/lib/gprpp/chunked_vector.h +45 -3
- data/src/core/lib/gprpp/status_helper.cc +20 -28
- data/src/core/lib/gprpp/status_helper.h +6 -19
- data/src/core/lib/gprpp/table.h +11 -0
- data/src/core/lib/http/httpcli.cc +37 -46
- data/src/core/lib/http/httpcli.h +3 -15
- data/src/core/lib/iomgr/call_combiner.cc +15 -4
- data/src/core/lib/iomgr/closure.h +29 -9
- data/src/core/lib/iomgr/combiner.cc +25 -3
- data/src/core/lib/iomgr/error.cc +2 -0
- data/src/core/lib/iomgr/error.h +3 -0
- data/src/core/lib/iomgr/event_engine/iomgr.cc +3 -2
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +6 -0
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +2 -0
- data/src/core/lib/iomgr/event_engine/resolver.cc +66 -48
- data/src/core/lib/iomgr/event_engine/resolver.h +56 -0
- data/src/core/lib/iomgr/exec_ctx.cc +22 -9
- data/src/core/lib/iomgr/executor.cc +10 -1
- data/src/core/lib/iomgr/fork_posix.cc +3 -2
- data/src/core/lib/iomgr/iomgr_custom.cc +4 -1
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -2
- data/src/core/lib/iomgr/iomgr_windows.cc +2 -2
- data/src/core/lib/iomgr/port.h +2 -2
- data/src/core/lib/iomgr/resolve_address.cc +5 -24
- data/src/core/lib/iomgr/resolve_address.h +47 -44
- data/src/core/lib/iomgr/resolve_address_custom.cc +131 -109
- data/src/core/lib/iomgr/resolve_address_custom.h +101 -19
- data/src/core/lib/iomgr/resolve_address_impl.h +59 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +82 -66
- data/src/core/lib/iomgr/resolve_address_posix.h +47 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +93 -74
- data/src/core/lib/iomgr/resolve_address_windows.h +47 -0
- data/src/core/lib/iomgr/resolved_address.h +39 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +1 -0
- data/src/core/lib/iomgr/unix_sockets_posix.cc +22 -34
- data/src/core/lib/iomgr/unix_sockets_posix.h +4 -7
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +6 -15
- data/src/core/lib/matchers/matchers.cc +1 -1
- data/src/core/lib/promise/activity.h +49 -20
- data/src/core/lib/promise/detail/status.h +5 -0
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.cc +17 -25
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.h +43 -44
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_factory.h +10 -5
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.cc +3 -2
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.h +4 -5
- data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.cc +1 -1
- data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.h +4 -4
- data/src/core/lib/resource_quota/api.h +0 -1
- data/src/core/lib/{gprpp → resource_quota}/arena.cc +16 -13
- data/src/core/lib/{gprpp → resource_quota}/arena.h +24 -13
- data/src/core/lib/security/authorization/evaluate_args.cc +30 -15
- data/src/core/lib/security/authorization/evaluate_args.h +1 -0
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +60 -0
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +62 -0
- data/src/core/lib/security/authorization/matchers.cc +227 -0
- data/src/core/lib/security/authorization/matchers.h +211 -0
- data/src/core/lib/security/authorization/rbac_policy.cc +442 -0
- data/src/core/lib/security/authorization/rbac_policy.h +170 -0
- data/src/core/lib/security/context/security_context.cc +4 -2
- data/src/core/lib/security/context/security_context.h +1 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +5 -5
- data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -3
- data/src/core/lib/security/credentials/credentials.h +10 -20
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +6 -9
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +7 -9
- data/src/core/lib/security/credentials/external/external_account_credentials.h +2 -7
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +2 -3
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -4
- data/src/core/lib/security/credentials/fake/fake_credentials.h +8 -7
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -5
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +16 -19
- data/src/core/lib/security/credentials/iam/iam_credentials.h +6 -5
- data/src/core/lib/security/credentials/jwt/json_token.cc +4 -6
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +16 -28
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +8 -8
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +6 -13
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +44 -57
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +13 -15
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -7
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +5 -4
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -10
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +6 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +7 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.h +1 -1
- data/src/core/lib/security/security_connector/security_connector.cc +0 -4
- data/src/core/lib/security/security_connector/security_connector.h +5 -1
- data/src/core/lib/security/security_connector/ssl_utils.cc +14 -24
- data/src/core/lib/security/security_connector/ssl_utils.h +5 -14
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -3
- data/src/core/lib/security/transport/auth_filters.h +7 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +53 -33
- data/src/core/lib/security/transport/server_auth_filter.cc +40 -35
- data/src/core/{ext → lib}/service_config/service_config.cc +2 -2
- data/src/core/{ext → lib}/service_config/service_config.h +4 -4
- data/src/core/{ext → lib}/service_config/service_config_call_data.h +5 -5
- data/src/core/{ext → lib}/service_config/service_config_parser.cc +1 -1
- data/src/core/{ext → lib}/service_config/service_config_parser.h +3 -3
- data/src/core/lib/slice/slice.cc +3 -1
- data/src/core/lib/slice/slice.h +43 -13
- data/src/core/lib/slice/slice_intern.cc +3 -101
- data/src/core/lib/slice/slice_internal.h +1 -2
- data/src/core/lib/slice/slice_refcount.h +4 -13
- data/src/core/lib/slice/slice_refcount_base.h +0 -16
- data/src/core/lib/surface/call.cc +140 -382
- data/src/core/lib/surface/call.h +4 -4
- data/src/core/lib/surface/channel.cc +42 -44
- data/src/core/lib/surface/channel.h +4 -4
- data/src/core/lib/surface/init.cc +0 -2
- data/src/core/lib/surface/lame_client.cc +0 -1
- data/src/core/lib/surface/server.cc +12 -29
- data/src/core/lib/surface/server.h +2 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/error_utils.h +14 -0
- data/src/core/lib/transport/metadata_batch.h +799 -717
- data/src/core/lib/transport/parsed_metadata.cc +2 -0
- data/src/core/lib/transport/parsed_metadata.h +95 -92
- data/src/core/lib/transport/timeout_encoding.cc +200 -66
- data/src/core/lib/transport/timeout_encoding.h +40 -10
- data/src/core/lib/transport/transport.h +1 -1
- data/src/core/lib/transport/transport_op_string.cc +6 -39
- data/src/core/lib/uri/uri_parser.cc +223 -53
- data/src/core/lib/uri/uri_parser.h +36 -23
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -5
- data/src/core/tsi/ssl_transport_security.cc +53 -13
- data/src/core/tsi/ssl_transport_security.h +18 -6
- data/src/ruby/ext/grpc/extconf.rb +10 -3
- 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/src/proto/grpc/testing/test_pb.rb +2 -1
- data/third_party/abseil-cpp/absl/base/internal/fast_type_id.h +48 -0
- data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +200 -0
- data/third_party/abseil-cpp/absl/random/beta_distribution.h +427 -0
- data/third_party/abseil-cpp/absl/random/discrete_distribution.cc +98 -0
- data/third_party/abseil-cpp/absl/random/discrete_distribution.h +247 -0
- data/third_party/abseil-cpp/absl/random/distributions.h +452 -0
- data/third_party/abseil-cpp/absl/random/exponential_distribution.h +165 -0
- data/third_party/abseil-cpp/absl/random/gaussian_distribution.cc +104 -0
- data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +275 -0
- data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +92 -0
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +268 -0
- data/third_party/abseil-cpp/absl/random/internal/fastmath.h +57 -0
- data/third_party/abseil-cpp/absl/random/internal/generate_real.h +144 -0
- data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +245 -0
- data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +150 -0
- data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +308 -0
- data/third_party/abseil-cpp/absl/random/internal/platform.h +171 -0
- data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +253 -0
- data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +131 -0
- data/third_party/abseil-cpp/absl/random/internal/randen.cc +91 -0
- data/third_party/abseil-cpp/absl/random/internal/randen.h +102 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +221 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.h +33 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +239 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +526 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h +50 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc +462 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_slow.cc +471 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_slow.h +40 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_traits.h +88 -0
- data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +167 -0
- data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +267 -0
- data/third_party/abseil-cpp/absl/random/internal/seed_material.h +104 -0
- data/third_party/abseil-cpp/absl/random/internal/traits.h +101 -0
- data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +244 -0
- data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +111 -0
- data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +257 -0
- data/third_party/abseil-cpp/absl/random/poisson_distribution.h +258 -0
- data/third_party/abseil-cpp/absl/random/random.h +189 -0
- data/third_party/abseil-cpp/absl/random/seed_gen_exception.cc +46 -0
- data/third_party/abseil-cpp/absl/random/seed_gen_exception.h +55 -0
- data/third_party/abseil-cpp/absl/random/seed_sequences.cc +29 -0
- data/third_party/abseil-cpp/absl/random/seed_sequences.h +110 -0
- data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +275 -0
- data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +202 -0
- data/third_party/abseil-cpp/absl/random/zipf_distribution.h +271 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +13 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +21 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +12 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -2
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +29 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +0 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +8 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +13 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +10 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +9 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +6 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +23 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +4 -0
- data/third_party/xxhash/xxhash.h +607 -352
- metadata +149 -77
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +0 -107
- data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +0 -46
- data/src/core/ext/transport/chttp2/transport/popularity_count.h +0 -60
- data/src/core/lib/compression/algorithm_metadata.h +0 -62
- data/src/core/lib/compression/compression_args.cc +0 -140
- data/src/core/lib/compression/compression_args.h +0 -58
- data/src/core/lib/compression/stream_compression.cc +0 -81
- data/src/core/lib/compression/stream_compression.h +0 -117
- data/src/core/lib/compression/stream_compression_gzip.cc +0 -231
- data/src/core/lib/compression/stream_compression_gzip.h +0 -28
- data/src/core/lib/compression/stream_compression_identity.cc +0 -91
- data/src/core/lib/compression/stream_compression_identity.h +0 -29
- data/src/core/lib/security/credentials/credentials_metadata.cc +0 -61
- data/src/core/lib/slice/static_slice.cc +0 -377
- data/src/core/lib/slice/static_slice.h +0 -300
- data/src/core/lib/transport/metadata.cc +0 -714
- data/src/core/lib/transport/metadata.h +0 -449
- data/src/core/lib/transport/metadata_batch.cc +0 -99
- data/src/core/lib/transport/static_metadata.cc +0 -1032
- data/src/core/lib/transport/static_metadata.h +0 -322
- data/src/core/lib/transport/status_metadata.cc +0 -63
- data/src/core/lib/transport/status_metadata.h +0 -48
@@ -23,11 +23,11 @@
|
|
23
23
|
|
24
24
|
#include <ares.h>
|
25
25
|
|
26
|
-
#include "src/core/ext/filters/client_channel/server_address.h"
|
27
26
|
#include "src/core/lib/iomgr/iomgr.h"
|
28
27
|
#include "src/core/lib/iomgr/polling_entity.h"
|
29
28
|
#include "src/core/lib/iomgr/resolve_address.h"
|
30
29
|
#include "src/core/lib/iomgr/work_serializer.h"
|
30
|
+
#include "src/core/lib/resolver/server_address.h"
|
31
31
|
|
32
32
|
#define GRPC_DNS_ARES_DEFAULT_QUERY_TIMEOUT_MS 120000
|
33
33
|
|
@@ -45,54 +45,51 @@ extern grpc_core::TraceFlag grpc_trace_cares_resolver;
|
|
45
45
|
typedef struct grpc_ares_ev_driver grpc_ares_ev_driver;
|
46
46
|
|
47
47
|
struct grpc_ares_request {
|
48
|
+
/** synchronizes access to this request, and also to associated
|
49
|
+
* ev_driver and fd_node objects */
|
50
|
+
grpc_core::Mutex mu;
|
48
51
|
/** indicates the DNS server to use, if specified */
|
49
|
-
struct ares_addr_port_node dns_server_addr;
|
52
|
+
struct ares_addr_port_node dns_server_addr ABSL_GUARDED_BY(mu);
|
50
53
|
/** following members are set in grpc_resolve_address_ares_impl */
|
51
54
|
/** closure to call when the request completes */
|
52
|
-
grpc_closure* on_done = nullptr;
|
55
|
+
grpc_closure* on_done ABSL_GUARDED_BY(mu) = nullptr;
|
53
56
|
/** the pointer to receive the resolved addresses */
|
54
|
-
std::unique_ptr<grpc_core::ServerAddressList>* addresses_out
|
57
|
+
std::unique_ptr<grpc_core::ServerAddressList>* addresses_out
|
58
|
+
ABSL_GUARDED_BY(mu);
|
55
59
|
/** the pointer to receive the resolved balancer addresses */
|
56
|
-
std::unique_ptr<grpc_core::ServerAddressList>* balancer_addresses_out
|
60
|
+
std::unique_ptr<grpc_core::ServerAddressList>* balancer_addresses_out
|
61
|
+
ABSL_GUARDED_BY(mu);
|
57
62
|
/** the pointer to receive the service config in JSON */
|
58
|
-
char** service_config_json_out = nullptr;
|
63
|
+
char** service_config_json_out ABSL_GUARDED_BY(mu) = nullptr;
|
59
64
|
/** the evernt driver used by this request */
|
60
|
-
grpc_ares_ev_driver* ev_driver = nullptr;
|
65
|
+
grpc_ares_ev_driver* ev_driver ABSL_GUARDED_BY(mu) = nullptr;
|
61
66
|
/** number of ongoing queries */
|
62
|
-
size_t pending_queries = 0;
|
67
|
+
size_t pending_queries ABSL_GUARDED_BY(mu) = 0;
|
63
68
|
/** the errors explaining query failures, appended to in query callbacks */
|
64
|
-
grpc_error_handle error = GRPC_ERROR_NONE;
|
69
|
+
grpc_error_handle error ABSL_GUARDED_BY(mu) = GRPC_ERROR_NONE;
|
65
70
|
};
|
66
71
|
|
67
|
-
/* Asynchronously resolve \a name. Use \a default_port if a port isn't
|
68
|
-
designated in \a name, otherwise use the port in \a name. grpc_ares_init()
|
69
|
-
must be called at least once before this function. \a on_done may be
|
70
|
-
called directly in this function without being scheduled with \a exec_ctx,
|
71
|
-
so it must not try to acquire locks that are being held by the caller. */
|
72
|
-
extern void (*grpc_resolve_address_ares)(const char* name,
|
73
|
-
const char* default_port,
|
74
|
-
grpc_pollset_set* interested_parties,
|
75
|
-
grpc_closure* on_done,
|
76
|
-
grpc_resolved_addresses** addresses);
|
77
|
-
|
78
72
|
/* Asynchronously resolve \a name. It will try to resolve grpclb SRV records in
|
79
73
|
addition to the normal address records. For normal address records, it uses
|
80
74
|
\a default_port if a port isn't designated in \a name, otherwise it uses the
|
81
75
|
port in \a name. grpc_ares_init() must be called at least once before this
|
82
|
-
function.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
76
|
+
function. The returned grpc_ares_request object is owned by the caller and it
|
77
|
+
is safe to free after on_done is called back.
|
78
|
+
|
79
|
+
Note on synchronization: \a as on_done might be called from another thread
|
80
|
+
~immediately, access to the grpc_ares_request* return value must be
|
81
|
+
synchronized by the caller. TODO(apolcyn): we should remove this requirement
|
82
|
+
by changing this API to use two phase initialization - one API to create
|
83
|
+
the grpc_ares_request* and another to start the async work. */
|
84
|
+
extern grpc_ares_request* (*grpc_dns_lookup_ares)(
|
87
85
|
const char* dns_server, const char* name, const char* default_port,
|
88
86
|
grpc_pollset_set* interested_parties, grpc_closure* on_done,
|
89
87
|
std::unique_ptr<grpc_core::ServerAddressList>* addresses,
|
90
88
|
std::unique_ptr<grpc_core::ServerAddressList>* balancer_addresses,
|
91
|
-
char** service_config_json, int query_timeout_ms
|
92
|
-
std::shared_ptr<grpc_core::WorkSerializer> work_serializer);
|
89
|
+
char** service_config_json, int query_timeout_ms);
|
93
90
|
|
94
91
|
/* Cancel the pending grpc_ares_request \a request */
|
95
|
-
extern void (*
|
92
|
+
extern void (*grpc_cancel_ares_request)(grpc_ares_request* request);
|
96
93
|
|
97
94
|
/* Initialize gRPC ares wrapper. Must be called at least once before
|
98
95
|
grpc_resolve_address_ares(). */
|
@@ -103,10 +100,6 @@ grpc_error_handle grpc_ares_init(void);
|
|
103
100
|
it has been called the same number of times as grpc_ares_init(). */
|
104
101
|
void grpc_ares_cleanup(void);
|
105
102
|
|
106
|
-
/** Schedules the desired callback for request completion
|
107
|
-
* and destroys the grpc_ares_request */
|
108
|
-
void grpc_ares_complete_request_locked(grpc_ares_request* request);
|
109
|
-
|
110
103
|
/* Indicates whether or not AAAA queries should be attempted. */
|
111
104
|
/* E.g., return false if ipv6 is known to not be available. */
|
112
105
|
bool grpc_ares_query_ipv6();
|
@@ -24,10 +24,10 @@
|
|
24
24
|
#include <grpc/support/string_util.h>
|
25
25
|
|
26
26
|
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
|
27
|
-
#include "src/core/ext/filters/client_channel/server_address.h"
|
28
27
|
#include "src/core/lib/address_utils/parse_address.h"
|
29
28
|
#include "src/core/lib/gpr/string.h"
|
30
29
|
#include "src/core/lib/iomgr/socket_windows.h"
|
30
|
+
#include "src/core/lib/resolver/server_address.h"
|
31
31
|
|
32
32
|
bool grpc_ares_query_ipv6() { return grpc_ipv6_loopback_available(); }
|
33
33
|
|
@@ -1,20 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
*
|
17
|
-
*/
|
1
|
+
//
|
2
|
+
// Copyright 2015 gRPC authors.
|
3
|
+
//
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
// you may not use this file except in compliance with the License.
|
6
|
+
// You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
// See the License for the specific language governing permissions and
|
14
|
+
// limitations under the License.
|
15
|
+
//
|
18
16
|
|
19
17
|
#include <grpc/support/port_platform.h>
|
20
18
|
|
@@ -23,6 +21,7 @@
|
|
23
21
|
#include <climits>
|
24
22
|
#include <cstring>
|
25
23
|
|
24
|
+
#include "absl/functional/bind_front.h"
|
26
25
|
#include "absl/strings/str_cat.h"
|
27
26
|
|
28
27
|
#include <grpc/support/alloc.h>
|
@@ -30,8 +29,6 @@
|
|
30
29
|
#include <grpc/support/time.h>
|
31
30
|
|
32
31
|
#include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
|
33
|
-
#include "src/core/ext/filters/client_channel/resolver_registry.h"
|
34
|
-
#include "src/core/ext/filters/client_channel/server_address.h"
|
35
32
|
#include "src/core/lib/backoff/backoff.h"
|
36
33
|
#include "src/core/lib/channel/channel_args.h"
|
37
34
|
#include "src/core/lib/gpr/string.h"
|
@@ -39,6 +36,8 @@
|
|
39
36
|
#include "src/core/lib/iomgr/resolve_address.h"
|
40
37
|
#include "src/core/lib/iomgr/timer.h"
|
41
38
|
#include "src/core/lib/iomgr/work_serializer.h"
|
39
|
+
#include "src/core/lib/resolver/resolver_registry.h"
|
40
|
+
#include "src/core/lib/resolver/server_address.h"
|
42
41
|
|
43
42
|
#define GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS 1
|
44
43
|
#define GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER 1.6
|
@@ -49,9 +48,9 @@ namespace grpc_core {
|
|
49
48
|
|
50
49
|
namespace {
|
51
50
|
|
52
|
-
class
|
51
|
+
class NativeClientChannelDNSResolver : public Resolver {
|
53
52
|
public:
|
54
|
-
explicit
|
53
|
+
explicit NativeClientChannelDNSResolver(ResolverArgs args);
|
55
54
|
|
56
55
|
void StartLocked() override;
|
57
56
|
|
@@ -62,15 +61,17 @@ class NativeDnsResolver : public Resolver {
|
|
62
61
|
void ShutdownLocked() override;
|
63
62
|
|
64
63
|
private:
|
65
|
-
~
|
64
|
+
~NativeClientChannelDNSResolver() override;
|
66
65
|
|
67
66
|
void MaybeStartResolvingLocked();
|
68
67
|
void StartResolvingLocked();
|
69
68
|
|
70
69
|
static void OnNextResolution(void* arg, grpc_error_handle error);
|
71
70
|
void OnNextResolutionLocked(grpc_error_handle error);
|
72
|
-
|
73
|
-
|
71
|
+
void OnResolved(
|
72
|
+
absl::StatusOr<std::vector<grpc_resolved_address>> addresses_or);
|
73
|
+
void OnResolvedLocked(
|
74
|
+
absl::StatusOr<std::vector<grpc_resolved_address>> addresses_or);
|
74
75
|
|
75
76
|
/// name to resolve
|
76
77
|
std::string name_to_resolve_;
|
@@ -84,7 +85,6 @@ class NativeDnsResolver : public Resolver {
|
|
84
85
|
bool shutdown_ = false;
|
85
86
|
/// are we currently resolving?
|
86
87
|
bool resolving_ = false;
|
87
|
-
grpc_closure on_resolved_;
|
88
88
|
/// next resolution timer
|
89
89
|
bool have_next_resolution_timer_ = false;
|
90
90
|
grpc_timer next_resolution_timer_;
|
@@ -95,11 +95,12 @@ class NativeDnsResolver : public Resolver {
|
|
95
95
|
grpc_millis last_resolution_timestamp_ = -1;
|
96
96
|
/// retry backoff state
|
97
97
|
BackOff backoff_;
|
98
|
-
///
|
99
|
-
|
98
|
+
/// tracks pending resolutions
|
99
|
+
OrphanablePtr<DNSResolver::Request> dns_request_;
|
100
100
|
};
|
101
101
|
|
102
|
-
|
102
|
+
NativeClientChannelDNSResolver::NativeClientChannelDNSResolver(
|
103
|
+
ResolverArgs args)
|
103
104
|
: name_to_resolve_(absl::StripPrefix(args.uri.path(), "/")),
|
104
105
|
channel_args_(grpc_channel_args_copy(args.args)),
|
105
106
|
work_serializer_(std::move(args.work_serializer)),
|
@@ -120,41 +121,47 @@ NativeDnsResolver::NativeDnsResolver(ResolverArgs args)
|
|
120
121
|
}
|
121
122
|
}
|
122
123
|
|
123
|
-
|
124
|
+
NativeClientChannelDNSResolver::~NativeClientChannelDNSResolver() {
|
124
125
|
grpc_channel_args_destroy(channel_args_);
|
125
126
|
grpc_pollset_set_destroy(interested_parties_);
|
126
127
|
}
|
127
128
|
|
128
|
-
void
|
129
|
+
void NativeClientChannelDNSResolver::StartLocked() {
|
130
|
+
MaybeStartResolvingLocked();
|
131
|
+
}
|
129
132
|
|
130
|
-
void
|
133
|
+
void NativeClientChannelDNSResolver::RequestReresolutionLocked() {
|
131
134
|
if (!resolving_) {
|
132
135
|
MaybeStartResolvingLocked();
|
133
136
|
}
|
134
137
|
}
|
135
138
|
|
136
|
-
void
|
139
|
+
void NativeClientChannelDNSResolver::ResetBackoffLocked() {
|
137
140
|
if (have_next_resolution_timer_) {
|
138
141
|
grpc_timer_cancel(&next_resolution_timer_);
|
139
142
|
}
|
140
143
|
backoff_.Reset();
|
141
144
|
}
|
142
145
|
|
143
|
-
void
|
146
|
+
void NativeClientChannelDNSResolver::ShutdownLocked() {
|
144
147
|
shutdown_ = true;
|
145
148
|
if (have_next_resolution_timer_) {
|
146
149
|
grpc_timer_cancel(&next_resolution_timer_);
|
147
150
|
}
|
151
|
+
dns_request_.reset();
|
148
152
|
}
|
149
153
|
|
150
|
-
void
|
151
|
-
|
154
|
+
void NativeClientChannelDNSResolver::OnNextResolution(void* arg,
|
155
|
+
grpc_error_handle error) {
|
156
|
+
NativeClientChannelDNSResolver* r =
|
157
|
+
static_cast<NativeClientChannelDNSResolver*>(arg);
|
152
158
|
(void)GRPC_ERROR_REF(error); // ref owned by lambda
|
153
159
|
r->work_serializer_->Run([r, error]() { r->OnNextResolutionLocked(error); },
|
154
160
|
DEBUG_LOCATION);
|
155
161
|
}
|
156
162
|
|
157
|
-
void
|
163
|
+
void NativeClientChannelDNSResolver::OnNextResolutionLocked(
|
164
|
+
grpc_error_handle error) {
|
158
165
|
have_next_resolution_timer_ = false;
|
159
166
|
if (error == GRPC_ERROR_NONE && !resolving_) {
|
160
167
|
StartResolvingLocked();
|
@@ -163,44 +170,46 @@ void NativeDnsResolver::OnNextResolutionLocked(grpc_error_handle error) {
|
|
163
170
|
GRPC_ERROR_UNREF(error);
|
164
171
|
}
|
165
172
|
|
166
|
-
void
|
167
|
-
|
168
|
-
(
|
169
|
-
|
170
|
-
|
173
|
+
void NativeClientChannelDNSResolver::OnResolved(
|
174
|
+
absl::StatusOr<std::vector<grpc_resolved_address>> addresses_or) {
|
175
|
+
work_serializer_->Run(
|
176
|
+
[this, addresses_or]() mutable {
|
177
|
+
OnResolvedLocked(std::move(addresses_or));
|
178
|
+
},
|
179
|
+
DEBUG_LOCATION);
|
171
180
|
}
|
172
181
|
|
173
|
-
void
|
182
|
+
void NativeClientChannelDNSResolver::OnResolvedLocked(
|
183
|
+
absl::StatusOr<std::vector<grpc_resolved_address>> addresses_or) {
|
174
184
|
GPR_ASSERT(resolving_);
|
175
185
|
resolving_ = false;
|
186
|
+
dns_request_.reset();
|
176
187
|
if (shutdown_) {
|
177
188
|
Unref(DEBUG_LOCATION, "dns-resolving");
|
178
|
-
GRPC_ERROR_UNREF(error);
|
179
189
|
return;
|
180
190
|
}
|
181
|
-
if (
|
182
|
-
|
183
|
-
for (
|
184
|
-
|
185
|
-
addresses_->addrs[i].len,
|
186
|
-
nullptr /* args */);
|
191
|
+
if (addresses_or.ok()) {
|
192
|
+
ServerAddressList addresses;
|
193
|
+
for (auto& addr : *addresses_or) {
|
194
|
+
addresses.emplace_back(addr, nullptr /* args */);
|
187
195
|
}
|
188
|
-
|
196
|
+
Result result;
|
197
|
+
result.addresses = std::move(addresses);
|
189
198
|
result.args = grpc_channel_args_copy(channel_args_);
|
190
|
-
result_handler_->
|
199
|
+
result_handler_->ReportResult(std::move(result));
|
191
200
|
// Reset backoff state so that we start from the beginning when the
|
192
201
|
// next request gets triggered.
|
193
202
|
backoff_.Reset();
|
194
203
|
} else {
|
204
|
+
std::string error_message = addresses_or.status().ToString();
|
195
205
|
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
|
196
|
-
|
206
|
+
error_message.c_str());
|
197
207
|
// Return transient error.
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
|
208
|
+
Result result;
|
209
|
+
result.addresses = absl::UnavailableError(absl::StrCat(
|
210
|
+
"DNS resolution failed for ", name_to_resolve_, ": ", error_message));
|
211
|
+
result.args = grpc_channel_args_copy(channel_args_);
|
212
|
+
result_handler_->ReportResult(std::move(result));
|
204
213
|
// Set up for retry.
|
205
214
|
// InvalidateNow to avoid getting stuck re-initializing this timer
|
206
215
|
// in a loop while draining the currently-held WorkSerializer.
|
@@ -219,15 +228,15 @@ void NativeDnsResolver::OnResolvedLocked(grpc_error_handle error) {
|
|
219
228
|
} else {
|
220
229
|
gpr_log(GPR_DEBUG, "retrying immediately");
|
221
230
|
}
|
222
|
-
GRPC_CLOSURE_INIT(&on_next_resolution_,
|
223
|
-
this,
|
231
|
+
GRPC_CLOSURE_INIT(&on_next_resolution_,
|
232
|
+
NativeClientChannelDNSResolver::OnNextResolution, this,
|
233
|
+
grpc_schedule_on_exec_ctx);
|
224
234
|
grpc_timer_init(&next_resolution_timer_, next_try, &on_next_resolution_);
|
225
235
|
}
|
226
236
|
Unref(DEBUG_LOCATION, "dns-resolving");
|
227
|
-
GRPC_ERROR_UNREF(error);
|
228
237
|
}
|
229
238
|
|
230
|
-
void
|
239
|
+
void NativeClientChannelDNSResolver::MaybeStartResolvingLocked() {
|
231
240
|
// If there is an existing timer, the time it fires is the earliest time we
|
232
241
|
// can start the next resolution.
|
233
242
|
if (have_next_resolution_timer_) return;
|
@@ -253,7 +262,7 @@ void NativeDnsResolver::MaybeStartResolvingLocked() {
|
|
253
262
|
// callback as part of the type system.
|
254
263
|
Ref(DEBUG_LOCATION, "next_resolution_timer_cooldown").release();
|
255
264
|
GRPC_CLOSURE_INIT(&on_next_resolution_,
|
256
|
-
|
265
|
+
NativeClientChannelDNSResolver::OnNextResolution, this,
|
257
266
|
grpc_schedule_on_exec_ctx);
|
258
267
|
grpc_timer_init(&next_resolution_timer_,
|
259
268
|
ExecCtx::Get()->Now() + ms_until_next_resolution,
|
@@ -264,7 +273,7 @@ void NativeDnsResolver::MaybeStartResolvingLocked() {
|
|
264
273
|
StartResolvingLocked();
|
265
274
|
}
|
266
275
|
|
267
|
-
void
|
276
|
+
void NativeClientChannelDNSResolver::StartResolvingLocked() {
|
268
277
|
gpr_log(GPR_DEBUG, "Start resolving.");
|
269
278
|
// TODO(roth): We currently deal with this ref manually. Once the
|
270
279
|
// new closure API is done, find a way to track this ref with the timer
|
@@ -272,11 +281,10 @@ void NativeDnsResolver::StartResolvingLocked() {
|
|
272
281
|
Ref(DEBUG_LOCATION, "dns-resolving").release();
|
273
282
|
GPR_ASSERT(!resolving_);
|
274
283
|
resolving_ = true;
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
interested_parties_, &on_resolved_, &addresses_);
|
284
|
+
dns_request_ = GetDNSResolver()->ResolveName(
|
285
|
+
name_to_resolve_, kDefaultSecurePort, interested_parties_,
|
286
|
+
absl::bind_front(&NativeClientChannelDNSResolver::OnResolved, this));
|
287
|
+
dns_request_->Start();
|
280
288
|
last_resolution_timestamp_ = ExecCtx::Get()->Now();
|
281
289
|
}
|
282
290
|
|
@@ -284,7 +292,7 @@ void NativeDnsResolver::StartResolvingLocked() {
|
|
284
292
|
// Factory
|
285
293
|
//
|
286
294
|
|
287
|
-
class
|
295
|
+
class NativeClientChannelDNSResolverFactory : public ResolverFactory {
|
288
296
|
public:
|
289
297
|
bool IsValidUri(const URI& uri) const override {
|
290
298
|
if (GPR_UNLIKELY(!uri.authority().empty())) {
|
@@ -300,7 +308,7 @@ class NativeDnsResolverFactory : public ResolverFactory {
|
|
300
308
|
|
301
309
|
OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
|
302
310
|
if (!IsValidUri(args.uri)) return nullptr;
|
303
|
-
return MakeOrphanable<
|
311
|
+
return MakeOrphanable<NativeClientChannelDNSResolver>(std::move(args));
|
304
312
|
}
|
305
313
|
|
306
314
|
const char* scheme() const override { return "dns"; }
|
@@ -316,7 +324,7 @@ void grpc_resolver_dns_native_init() {
|
|
316
324
|
if (gpr_stricmp(resolver.get(), "native") == 0) {
|
317
325
|
gpr_log(GPR_DEBUG, "Using native dns resolver");
|
318
326
|
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
|
319
|
-
absl::make_unique<grpc_core::
|
327
|
+
absl::make_unique<grpc_core::NativeClientChannelDNSResolverFactory>());
|
320
328
|
} else {
|
321
329
|
grpc_core::ResolverRegistry::Builder::InitRegistry();
|
322
330
|
grpc_core::ResolverFactory* existing_factory =
|
@@ -324,7 +332,8 @@ void grpc_resolver_dns_native_init() {
|
|
324
332
|
if (existing_factory == nullptr) {
|
325
333
|
gpr_log(GPR_DEBUG, "Using native dns resolver");
|
326
334
|
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
|
327
|
-
absl::make_unique<
|
335
|
+
absl::make_unique<
|
336
|
+
grpc_core::NativeClientChannelDNSResolverFactory>());
|
328
337
|
}
|
329
338
|
}
|
330
339
|
}
|
@@ -30,8 +30,6 @@
|
|
30
30
|
#include <grpc/support/alloc.h>
|
31
31
|
#include <grpc/support/string_util.h>
|
32
32
|
|
33
|
-
#include "src/core/ext/filters/client_channel/resolver_registry.h"
|
34
|
-
#include "src/core/ext/filters/client_channel/server_address.h"
|
35
33
|
#include "src/core/lib/address_utils/parse_address.h"
|
36
34
|
#include "src/core/lib/channel/channel_args.h"
|
37
35
|
#include "src/core/lib/gpr/string.h"
|
@@ -40,6 +38,8 @@
|
|
40
38
|
#include "src/core/lib/iomgr/resolve_address.h"
|
41
39
|
#include "src/core/lib/iomgr/unix_sockets_posix.h"
|
42
40
|
#include "src/core/lib/iomgr/work_serializer.h"
|
41
|
+
#include "src/core/lib/resolver/resolver_registry.h"
|
42
|
+
#include "src/core/lib/resolver/server_address.h"
|
43
43
|
#include "src/core/lib/slice/slice_internal.h"
|
44
44
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
45
45
|
|
@@ -142,23 +142,23 @@ void FakeResolver::MaybeSendResultLocked() {
|
|
142
142
|
if (!started_ || shutdown_) return;
|
143
143
|
if (return_failure_) {
|
144
144
|
// TODO(roth): Change resolver result generator to be able to inject
|
145
|
-
// the error to be returned
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
// the error to be returned and to be able to independently set errors
|
146
|
+
// for addresses and service config.
|
147
|
+
Result result;
|
148
|
+
result.addresses = absl::UnavailableError("Resolver transient failure");
|
149
|
+
result.service_config = result.addresses.status();
|
150
|
+
result.args = grpc_channel_args_copy(channel_args_);
|
151
|
+
result_handler_->ReportResult(std::move(result));
|
149
152
|
return_failure_ = false;
|
150
153
|
} else if (has_next_result_) {
|
151
154
|
Result result;
|
152
155
|
result.addresses = std::move(next_result_.addresses);
|
153
156
|
result.service_config = std::move(next_result_.service_config);
|
154
|
-
// TODO(roth): Use std::move() once grpc_error is converted to C++.
|
155
|
-
result.service_config_error = next_result_.service_config_error;
|
156
|
-
next_result_.service_config_error = GRPC_ERROR_NONE;
|
157
157
|
// When both next_results_ and channel_args_ contain an arg with the same
|
158
158
|
// name, only the one in next_results_ will be kept since next_results_ is
|
159
159
|
// before channel_args_.
|
160
160
|
result.args = grpc_channel_args_union(next_result_.args, channel_args_);
|
161
|
-
result_handler_->
|
161
|
+
result_handler_->ReportResult(std::move(result));
|
162
162
|
has_next_result_ = false;
|
163
163
|
}
|
164
164
|
}
|
@@ -19,10 +19,11 @@
|
|
19
19
|
|
20
20
|
#include <grpc/support/port_platform.h>
|
21
21
|
|
22
|
-
#include "src/core/ext/filters/client_channel/resolver.h"
|
23
22
|
#include "src/core/lib/channel/channel_args.h"
|
24
23
|
#include "src/core/lib/gprpp/ref_counted.h"
|
24
|
+
#include "src/core/lib/gprpp/sync.h"
|
25
25
|
#include "src/core/lib/iomgr/error.h"
|
26
|
+
#include "src/core/lib/resolver/resolver.h"
|
26
27
|
|
27
28
|
#define GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR \
|
28
29
|
"grpc.fake_resolver.response_generator"
|
@@ -18,12 +18,12 @@
|
|
18
18
|
|
19
19
|
#include <random>
|
20
20
|
|
21
|
-
#include "src/core/ext/filters/client_channel/resolver_registry.h"
|
22
21
|
#include "src/core/ext/xds/xds_client.h"
|
23
22
|
#include "src/core/lib/gpr/env.h"
|
24
23
|
#include "src/core/lib/gpr/string.h"
|
25
24
|
#include "src/core/lib/http/httpcli.h"
|
26
25
|
#include "src/core/lib/iomgr/polling_entity.h"
|
26
|
+
#include "src/core/lib/resolver/resolver_registry.h"
|
27
27
|
#include "src/core/lib/security/credentials/alts/check_gcp_environment.h"
|
28
28
|
|
29
29
|
namespace grpc_core {
|
@@ -61,7 +61,6 @@ class GoogleCloud2ProdResolver : public Resolver {
|
|
61
61
|
grpc_error_handle error) = 0;
|
62
62
|
|
63
63
|
RefCountedPtr<GoogleCloud2ProdResolver> resolver_;
|
64
|
-
grpc_httpcli_context context_;
|
65
64
|
grpc_httpcli_response response_;
|
66
65
|
grpc_closure on_done_;
|
67
66
|
std::atomic<bool> on_done_called_{false};
|
@@ -115,7 +114,6 @@ GoogleCloud2ProdResolver::MetadataQuery::MetadataQuery(
|
|
115
114
|
RefCountedPtr<GoogleCloud2ProdResolver> resolver, const char* path,
|
116
115
|
grpc_polling_entity* pollent)
|
117
116
|
: resolver_(std::move(resolver)) {
|
118
|
-
grpc_httpcli_context_init(&context_);
|
119
117
|
// Start HTTP request.
|
120
118
|
GRPC_CLOSURE_INIT(&on_done_, OnHttpRequestDone, this, nullptr);
|
121
119
|
Ref().release(); // Ref held by callback.
|
@@ -128,13 +126,12 @@ GoogleCloud2ProdResolver::MetadataQuery::MetadataQuery(
|
|
128
126
|
request.http.hdr_count = 1;
|
129
127
|
request.http.hdrs = &header;
|
130
128
|
// TODO(ctiller): share the quota from whomever instantiates this!
|
131
|
-
grpc_httpcli_get(
|
129
|
+
grpc_httpcli_get(pollent, ResourceQuota::Default(), &request,
|
132
130
|
ExecCtx::Get()->Now() + 10000, // 10s timeout
|
133
131
|
&on_done_, &response_);
|
134
132
|
}
|
135
133
|
|
136
134
|
GoogleCloud2ProdResolver::MetadataQuery::~MetadataQuery() {
|
137
|
-
grpc_httpcli_context_destroy(&context_);
|
138
135
|
grpc_http_response_destroy(&response_);
|
139
136
|
}
|
140
137
|
|
@@ -28,13 +28,13 @@
|
|
28
28
|
#include <grpc/support/alloc.h>
|
29
29
|
#include <grpc/support/string_util.h>
|
30
30
|
|
31
|
-
#include "src/core/ext/filters/client_channel/resolver_registry.h"
|
32
|
-
#include "src/core/ext/filters/client_channel/server_address.h"
|
33
31
|
#include "src/core/lib/address_utils/parse_address.h"
|
34
32
|
#include "src/core/lib/channel/channel_args.h"
|
35
33
|
#include "src/core/lib/gpr/string.h"
|
36
34
|
#include "src/core/lib/iomgr/resolve_address.h"
|
37
35
|
#include "src/core/lib/iomgr/unix_sockets_posix.h"
|
36
|
+
#include "src/core/lib/resolver/resolver_registry.h"
|
37
|
+
#include "src/core/lib/resolver/server_address.h"
|
38
38
|
#include "src/core/lib/slice/slice_internal.h"
|
39
39
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
40
40
|
|
@@ -73,7 +73,7 @@ void SockaddrResolver::StartLocked() {
|
|
73
73
|
// TODO(roth): Use std::move() once channel args is converted to C++.
|
74
74
|
result.args = channel_args_;
|
75
75
|
channel_args_ = nullptr;
|
76
|
-
result_handler_->
|
76
|
+
result_handler_->ReportResult(std::move(result));
|
77
77
|
}
|
78
78
|
|
79
79
|
//
|
@@ -91,9 +91,9 @@ bool ParseUri(const URI& uri,
|
|
91
91
|
// Construct addresses.
|
92
92
|
bool errors_found = false;
|
93
93
|
for (absl::string_view ith_path : absl::StrSplit(uri.path(), ',')) {
|
94
|
-
|
94
|
+
auto ith_uri = URI::Create(uri.scheme(), "", std::string(ith_path), {}, "");
|
95
95
|
grpc_resolved_address addr;
|
96
|
-
if (!parse(ith_uri, &addr)) {
|
96
|
+
if (!ith_uri.ok() || !parse(*ith_uri, &addr)) {
|
97
97
|
errors_found = true;
|
98
98
|
break;
|
99
99
|
}
|