grpc 1.9.1 → 1.10.0.pre1
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 +2654 -953
- data/etc/roots.pem +282 -683
- data/include/grpc/compression.h +9 -26
- data/include/grpc/grpc.h +10 -24
- data/include/grpc/grpc_security.h +7 -1
- data/include/grpc/impl/codegen/compression_types.h +5 -62
- data/include/grpc/impl/codegen/grpc_types.h +10 -6
- data/include/grpc/module.modulemap +1 -10
- data/include/grpc/support/alloc.h +3 -2
- data/include/grpc/support/log.h +1 -2
- data/{src/core/lib/gpr/thd_internal.h → include/grpc/support/thd_id.h} +23 -9
- data/src/boringssl/err_data.c +550 -496
- data/src/core/ext/census/grpc_context.cc +2 -1
- data/src/core/ext/filters/client_channel/backup_poller.cc +5 -4
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +7 -7
- data/src/core/ext/filters/client_channel/client_channel.cc +162 -172
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +4 -2
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +10 -10
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +18 -14
- data/src/core/ext/filters/client_channel/http_proxy.cc +3 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +21 -105
- data/src/core/ext/filters/client_channel/lb_policy.h +166 -170
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +41 -36
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1452 -1459
- 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 +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +7 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +27 -27
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +279 -304
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +358 -330
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +30 -41
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +7 -14
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +8 -21
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +23 -27
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +58 -33
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +25 -12
- data/src/core/ext/filters/client_channel/parse_address.cc +10 -8
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver.cc +6 -52
- data/src/core/ext/filters/client_channel/resolver.h +98 -55
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +266 -237
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +5 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +31 -27
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +244 -207
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +161 -148
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +47 -31
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +126 -126
- data/src/core/ext/filters/client_channel/resolver_factory.h +33 -32
- data/src/core/ext/filters/client_channel/resolver_registry.cc +110 -90
- data/src/core/ext/filters/client_channel/resolver_registry.h +49 -36
- data/src/core/ext/filters/client_channel/retry_throttle.cc +29 -22
- data/src/core/ext/filters/client_channel/subchannel.cc +173 -173
- data/src/core/ext/filters/client_channel/subchannel.h +38 -45
- data/src/core/ext/filters/client_channel/subchannel_index.cc +44 -40
- data/src/core/ext/filters/client_channel/uri_parser.cc +3 -3
- data/src/core/ext/filters/deadline/deadline_filter.cc +27 -18
- data/src/core/ext/filters/http/client/http_client_filter.cc +26 -23
- data/src/core/ext/filters/http/http_filters_plugin.cc +3 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +78 -110
- data/src/core/ext/filters/http/server/http_server_filter.cc +29 -26
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +9 -11
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +2 -1
- data/src/core/ext/filters/max_age/max_age_filter.cc +14 -14
- data/src/core/ext/filters/message_size/message_size_filter.cc +20 -18
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +4 -4
- data/src/core/ext/filters/workarounds/workaround_utils.cc +4 -4
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +10 -10
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +4 -4
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +11 -12
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +16 -13
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +36 -9
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +3 -0
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +17 -14
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +139 -145
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +16 -14
- data/src/core/ext/transport/chttp2/transport/flow_control.h +8 -7
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +35 -33
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +27 -25
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +12 -12
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +16 -15
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +19 -19
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +11 -11
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +23 -22
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +35 -35
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +1 -1
- data/src/core/ext/transport/chttp2/transport/parsing.cc +35 -39
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +8 -7
- data/src/core/ext/transport/chttp2/transport/varint.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/writing.cc +18 -18
- data/src/core/ext/transport/inproc/inproc_transport.cc +43 -23
- data/src/core/lib/{gpr → avl}/avl.cc +61 -57
- data/{include/grpc/support → src/core/lib/avl}/avl.h +25 -35
- data/src/core/lib/backoff/backoff.cc +6 -5
- data/src/core/lib/channel/channel_args.cc +23 -109
- data/src/core/lib/channel/channel_args.h +5 -31
- data/src/core/lib/channel/channel_stack.cc +11 -8
- data/src/core/lib/channel/channel_stack_builder.cc +10 -7
- data/src/core/lib/channel/connected_channel.cc +18 -17
- data/src/core/lib/channel/handshaker.cc +8 -8
- data/src/core/lib/channel/handshaker_registry.cc +3 -2
- data/src/core/lib/compression/algorithm_metadata.h +13 -6
- data/src/core/lib/compression/compression.cc +72 -183
- data/src/core/lib/compression/compression_internal.cc +274 -0
- data/src/core/lib/compression/compression_internal.h +86 -0
- data/src/core/lib/compression/message_compress.cc +15 -15
- data/src/core/lib/compression/message_compress.h +4 -3
- data/src/core/lib/compression/stream_compression_gzip.cc +8 -8
- data/src/core/lib/compression/stream_compression_identity.cc +1 -1
- data/src/core/lib/debug/stats.cc +10 -8
- data/src/core/lib/debug/stats_data.cc +2 -1
- data/src/core/lib/debug/trace.cc +3 -3
- data/src/core/lib/gpr/alloc.cc +7 -11
- data/src/core/lib/gpr/arena.cc +34 -12
- data/src/core/lib/gpr/atm.cc +2 -1
- data/src/core/lib/gpr/cpu_linux.cc +3 -3
- data/src/core/lib/gpr/cpu_posix.cc +2 -1
- data/src/core/lib/gpr/env.h +1 -1
- data/src/core/lib/gpr/env_linux.cc +1 -1
- data/src/core/lib/gpr/env_windows.cc +4 -4
- data/src/core/lib/gpr/fork.cc +16 -2
- data/src/core/lib/gpr/host_port.cc +5 -4
- data/{include/grpc/support → src/core/lib/gpr}/host_port.h +5 -13
- data/src/core/lib/gpr/log.cc +5 -4
- data/src/core/lib/gpr/log_linux.cc +1 -1
- data/src/core/lib/gpr/mpscq.cc +1 -0
- data/src/core/lib/gpr/murmur_hash.cc +4 -4
- data/src/core/lib/gpr/string.cc +19 -16
- data/src/core/lib/gpr/string_posix.cc +3 -3
- data/src/core/lib/gpr/sync_posix.cc +5 -9
- data/src/core/lib/gpr/thd.cc +3 -3
- data/{include/grpc/support → src/core/lib/gpr}/thd.h +20 -28
- data/src/core/lib/gpr/thd_posix.cc +6 -4
- data/src/core/lib/gpr/thd_windows.cc +3 -1
- data/src/core/lib/gpr/time.cc +6 -4
- data/src/core/lib/gpr/time_posix.cc +2 -2
- data/{include/grpc/support → src/core/lib/gpr}/tls.h +6 -6
- data/{include/grpc/support → src/core/lib/gpr}/tls_gcc.h +3 -3
- data/{include/grpc/support → src/core/lib/gpr}/tls_msvc.h +3 -3
- data/src/core/lib/gpr/tls_pthread.cc +1 -1
- data/{include/grpc/support → src/core/lib/gpr}/tls_pthread.h +3 -3
- data/{include/grpc/support → src/core/lib/gpr}/useful.h +3 -3
- data/src/core/lib/{gpr++ → gprpp}/abstract.h +3 -3
- data/src/core/lib/{gpr++ → gprpp}/atomic.h +5 -5
- data/src/core/lib/{gpr++ → gprpp}/atomic_with_atm.h +3 -3
- data/src/core/lib/{gpr++ → gprpp}/atomic_with_std.h +3 -3
- data/src/core/lib/{gpr++ → gprpp}/debug_location.h +3 -3
- data/src/core/lib/{gpr++ → gprpp}/inlined_vector.h +44 -22
- data/src/core/lib/{gpr++ → gprpp}/manual_constructor.h +2 -2
- data/src/core/lib/{gpr++ → gprpp}/memory.h +14 -5
- data/src/core/lib/{gpr++ → gprpp}/orphanable.h +39 -14
- data/src/core/lib/{gpr++ → gprpp}/ref_counted.h +42 -10
- data/src/core/lib/{gpr++ → gprpp}/ref_counted_ptr.h +18 -8
- data/src/core/lib/http/format_request.cc +3 -3
- data/src/core/lib/http/httpcli.cc +6 -7
- data/src/core/lib/http/httpcli_security_connector.cc +10 -10
- data/src/core/lib/http/parser.cc +16 -12
- data/src/core/lib/iomgr/call_combiner.cc +12 -13
- data/src/core/lib/iomgr/closure.h +4 -6
- data/src/core/lib/iomgr/combiner.cc +10 -21
- data/src/core/lib/iomgr/error.cc +50 -55
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +41 -52
- data/src/core/lib/iomgr/ev_epollex_linux.cc +80 -28
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +23 -30
- data/src/core/lib/iomgr/ev_poll_posix.cc +52 -46
- data/src/core/lib/iomgr/ev_posix.cc +47 -6
- data/src/core/lib/iomgr/exec_ctx.cc +10 -10
- data/src/core/lib/iomgr/exec_ctx.h +1 -1
- data/src/core/lib/iomgr/executor.cc +16 -13
- data/src/core/lib/iomgr/fork_posix.cc +1 -3
- data/src/core/lib/iomgr/gethostname_host_name_max.cc +1 -1
- data/src/core/lib/iomgr/iocp_windows.cc +1 -2
- data/src/core/lib/iomgr/iomgr.cc +2 -2
- data/src/core/lib/iomgr/iomgr_uv.cc +2 -0
- data/src/core/lib/iomgr/iomgr_uv.h +1 -1
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +5 -4
- data/src/core/lib/iomgr/load_file.cc +3 -3
- data/src/core/lib/iomgr/pollset_windows.cc +1 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -9
- data/src/core/lib/iomgr/resolve_address_uv.cc +2 -2
- data/src/core/lib/iomgr/resolve_address_windows.cc +3 -2
- data/src/core/lib/iomgr/resource_quota.cc +36 -34
- data/src/core/lib/iomgr/sockaddr_utils.cc +39 -23
- data/src/core/lib/iomgr/socket_factory_posix.cc +5 -5
- data/src/core/lib/iomgr/socket_mutator.cc +7 -7
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +7 -4
- data/src/core/lib/iomgr/socket_utils_linux.cc +3 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +7 -6
- data/src/core/lib/iomgr/tcp_client_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_posix.cc +47 -55
- data/src/core/lib/iomgr/tcp_server_posix.cc +12 -10
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +7 -5
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +4 -3
- data/src/core/lib/iomgr/tcp_windows.cc +1 -1
- data/src/core/lib/iomgr/timer_generic.cc +16 -14
- data/src/core/lib/iomgr/timer_heap.cc +8 -7
- data/src/core/lib/iomgr/timer_manager.cc +4 -3
- data/src/core/lib/iomgr/udp_server.cc +24 -16
- data/src/core/lib/iomgr/unix_sockets_posix.cc +15 -10
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +6 -5
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +1 -2
- data/src/core/lib/json/json.cc +1 -1
- data/src/core/lib/json/json_reader.cc +8 -6
- data/src/core/lib/json/json_string.cc +19 -18
- data/src/core/lib/json/json_writer.cc +10 -8
- data/src/core/lib/profiling/basic_timers.cc +1 -1
- data/src/core/lib/profiling/timers.h +3 -20
- data/src/core/lib/security/context/security_context.cc +16 -14
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +17 -14
- data/src/core/lib/security/credentials/credentials.cc +9 -8
- data/src/core/lib/security/credentials/credentials.h +1 -1
- data/src/core/lib/security/credentials/credentials_metadata.cc +2 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +12 -13
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +7 -4
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +5 -3
- data/src/core/lib/security/credentials/jwt/json_token.cc +4 -3
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -7
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +21 -18
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +23 -18
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +11 -7
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +22 -21
- data/src/core/lib/security/{transport → security_connector}/security_connector.cc +46 -43
- data/src/core/lib/security/{transport → security_connector}/security_connector.h +3 -3
- data/src/core/lib/security/transport/client_auth_filter.cc +32 -34
- data/src/core/lib/security/transport/lb_targets_info.cc +7 -5
- data/src/core/lib/security/transport/secure_endpoint.cc +21 -21
- data/src/core/lib/security/transport/security_handshaker.cc +19 -18
- data/src/core/lib/security/transport/security_handshaker.h +1 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +21 -21
- data/src/core/lib/slice/b64.cc +19 -16
- data/src/core/lib/slice/percent_encoding.cc +5 -5
- data/src/core/lib/slice/slice.cc +35 -33
- data/src/core/lib/slice/slice_buffer.cc +16 -14
- data/src/core/lib/slice/slice_hash_table.cc +3 -2
- data/src/core/lib/slice/slice_intern.cc +21 -25
- data/src/core/lib/slice/slice_string_helpers.cc +45 -9
- data/src/core/lib/slice/slice_string_helpers.h +6 -0
- data/src/core/lib/surface/byte_buffer.cc +2 -2
- data/src/core/lib/surface/byte_buffer_reader.cc +6 -3
- data/src/core/lib/surface/call.cc +171 -260
- data/src/core/lib/surface/call_test_only.h +1 -13
- data/src/core/lib/surface/channel.cc +20 -43
- data/src/core/lib/surface/channel_init.cc +7 -7
- data/src/core/lib/surface/channel_ping.cc +2 -2
- data/src/core/lib/surface/completion_queue.cc +69 -75
- data/src/core/lib/surface/init.cc +4 -5
- data/src/core/lib/surface/init_secure.cc +1 -1
- data/src/core/lib/surface/lame_client.cc +1 -1
- data/src/core/lib/surface/server.cc +64 -59
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +6 -5
- data/src/core/lib/transport/byte_stream.cc +23 -14
- data/src/core/lib/transport/byte_stream.h +1 -1
- data/src/core/lib/transport/connectivity_state.cc +9 -13
- data/src/core/lib/transport/error_utils.cc +10 -7
- data/src/core/lib/transport/metadata.cc +27 -26
- data/src/core/lib/transport/metadata.h +1 -1
- data/src/core/lib/transport/pid_controller.cc +2 -1
- data/src/core/lib/transport/service_config.cc +5 -5
- data/src/core/lib/transport/static_metadata.cc +225 -222
- data/src/core/lib/transport/static_metadata.h +77 -76
- data/src/core/lib/transport/timeout_encoding.cc +3 -2
- data/src/core/lib/transport/transport.cc +6 -5
- data/src/core/lib/transport/transport_op_string.cc +0 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -4
- data/src/core/tsi/alts_transport_security.cc +61 -0
- data/src/core/tsi/{gts_transport_security.h → alts_transport_security.h} +16 -8
- data/src/core/tsi/fake_transport_security.cc +59 -43
- data/src/core/tsi/ssl_transport_security.cc +122 -107
- data/src/core/tsi/transport_security.cc +3 -3
- data/src/core/tsi/transport_security_adapter.cc +16 -10
- data/src/ruby/bin/apis/pubsub_demo.rb +1 -1
- data/src/ruby/ext/grpc/rb_channel.c +3 -4
- data/src/ruby/ext/grpc/rb_compression_options.c +13 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -76
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +8 -120
- data/src/ruby/ext/grpc/rb_server.c +52 -28
- data/src/ruby/lib/grpc/generic/rpc_server.rb +7 -4
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/test/client.rb +1 -1
- data/src/ruby/pb/test/server.rb +1 -1
- data/src/ruby/spec/client_server_spec.rb +4 -2
- data/src/ruby/spec/generic/active_call_spec.rb +2 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +32 -8
- data/src/ruby/spec/server_spec.rb +26 -7
- data/third_party/boringssl/crypto/asn1/a_bitstr.c +7 -2
- data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +15 -0
- data/third_party/boringssl/crypto/asn1/a_gentm.c +1 -1
- data/third_party/boringssl/crypto/asn1/a_print.c +0 -28
- data/third_party/boringssl/crypto/asn1/a_strnid.c +3 -0
- data/third_party/boringssl/crypto/asn1/a_time.c +17 -9
- data/third_party/boringssl/crypto/asn1/a_utctm.c +1 -1
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +5 -49
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +1 -1
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +9 -9
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +0 -6
- data/third_party/boringssl/crypto/asn1/time_support.c +5 -5
- data/third_party/boringssl/crypto/base64/base64.c +65 -43
- data/third_party/boringssl/crypto/bio/bio.c +134 -110
- data/third_party/boringssl/crypto/bio/bio_mem.c +9 -9
- data/third_party/boringssl/crypto/bio/connect.c +17 -17
- data/third_party/boringssl/crypto/bio/fd.c +2 -1
- data/third_party/boringssl/crypto/bio/file.c +14 -14
- data/third_party/boringssl/crypto/bio/hexdump.c +15 -16
- data/third_party/boringssl/crypto/bio/internal.h +14 -14
- data/third_party/boringssl/crypto/bio/pair.c +45 -45
- data/third_party/boringssl/crypto/bio/printf.c +6 -10
- data/third_party/boringssl/crypto/{bn → bn_extra}/bn_asn1.c +9 -9
- data/third_party/boringssl/crypto/{bn → bn_extra}/convert.c +18 -223
- data/third_party/boringssl/crypto/buf/buf.c +20 -44
- data/third_party/boringssl/crypto/bytestring/ber.c +35 -35
- data/third_party/boringssl/crypto/bytestring/cbb.c +24 -24
- data/third_party/boringssl/crypto/bytestring/cbs.c +33 -37
- data/third_party/boringssl/crypto/bytestring/internal.h +38 -38
- data/third_party/boringssl/crypto/chacha/chacha.c +7 -7
- data/third_party/boringssl/crypto/{asn1/t_bitst.c → cipher_extra/cipher_extra.c} +49 -38
- data/third_party/boringssl/crypto/{cipher → cipher_extra}/derive_key.c +0 -2
- data/third_party/boringssl/crypto/cipher_extra/e_aesctrhmac.c +281 -0
- data/third_party/boringssl/crypto/cipher_extra/e_aesgcmsiv.c +867 -0
- data/third_party/boringssl/crypto/cipher_extra/e_chacha20poly1305.c +326 -0
- data/third_party/boringssl/crypto/{cipher → cipher_extra}/e_null.c +0 -1
- data/third_party/boringssl/crypto/{cipher → cipher_extra}/e_rc2.c +22 -10
- data/third_party/boringssl/crypto/{cipher → cipher_extra}/e_rc4.c +0 -0
- data/third_party/boringssl/crypto/{cipher → cipher_extra}/e_ssl3.c +120 -64
- data/third_party/boringssl/crypto/{cipher → cipher_extra}/e_tls.c +220 -141
- data/third_party/boringssl/crypto/{asn1/x_bignum.c → cipher_extra/internal.h} +61 -86
- data/third_party/boringssl/crypto/cipher_extra/tls_cbc.c +482 -0
- data/third_party/boringssl/crypto/cmac/cmac.c +20 -20
- data/third_party/boringssl/crypto/conf/conf.c +32 -20
- data/third_party/boringssl/crypto/conf/internal.h +3 -3
- data/third_party/boringssl/crypto/cpu-aarch64-linux.c +5 -5
- data/third_party/boringssl/crypto/cpu-arm-linux.c +44 -41
- data/third_party/boringssl/crypto/cpu-intel.c +68 -43
- data/third_party/boringssl/crypto/cpu-ppc64le.c +5 -7
- data/third_party/boringssl/crypto/crypto.c +54 -32
- data/third_party/boringssl/crypto/curve25519/curve25519.c +269 -269
- data/third_party/boringssl/crypto/curve25519/internal.h +28 -8
- data/third_party/boringssl/crypto/curve25519/spake25519.c +180 -106
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +9 -9
- data/third_party/boringssl/crypto/dh/check.c +33 -34
- data/third_party/boringssl/crypto/dh/dh.c +72 -36
- data/third_party/boringssl/crypto/dh/dh_asn1.c +1 -1
- data/third_party/boringssl/crypto/dh/params.c +1 -161
- data/third_party/boringssl/crypto/digest_extra/digest_extra.c +240 -0
- data/third_party/boringssl/crypto/dsa/dsa.c +127 -87
- data/third_party/boringssl/crypto/dsa/dsa_asn1.c +1 -1
- data/third_party/boringssl/crypto/{ec → ec_extra}/ec_asn1.c +83 -70
- data/third_party/boringssl/crypto/ecdh/ecdh.c +1 -1
- data/third_party/boringssl/crypto/{ecdsa → ecdsa_extra}/ecdsa_asn1.c +86 -31
- data/third_party/boringssl/crypto/engine/engine.c +6 -6
- data/third_party/boringssl/crypto/err/err.c +197 -106
- data/third_party/boringssl/crypto/err/internal.h +58 -0
- data/third_party/boringssl/crypto/evp/digestsign.c +86 -14
- data/third_party/boringssl/crypto/evp/evp.c +6 -11
- data/third_party/boringssl/crypto/evp/evp_asn1.c +17 -17
- data/third_party/boringssl/crypto/evp/evp_ctx.c +15 -11
- data/third_party/boringssl/crypto/evp/internal.h +66 -51
- data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +11 -11
- data/third_party/boringssl/crypto/evp/p_ec.c +10 -8
- data/third_party/boringssl/crypto/evp/p_ec_asn1.c +11 -12
- data/third_party/boringssl/crypto/evp/p_ed25519.c +71 -0
- data/third_party/boringssl/crypto/evp/p_ed25519_asn1.c +190 -0
- data/third_party/boringssl/crypto/evp/p_rsa.c +50 -95
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +28 -18
- data/third_party/boringssl/crypto/evp/pbkdf.c +49 -56
- data/third_party/boringssl/crypto/evp/print.c +5 -36
- data/third_party/boringssl/crypto/evp/scrypt.c +209 -0
- data/third_party/boringssl/crypto/ex_data.c +15 -45
- data/third_party/boringssl/crypto/fipsmodule/aes/internal.h +100 -0
- data/third_party/boringssl/crypto/fipsmodule/bcm.c +679 -0
- data/third_party/boringssl/crypto/{bn → fipsmodule/bn}/internal.h +40 -27
- data/third_party/boringssl/crypto/{bn → fipsmodule/bn}/rsaz_exp.h +0 -0
- data/third_party/boringssl/crypto/{cipher → fipsmodule/cipher}/internal.h +34 -67
- data/third_party/boringssl/crypto/fipsmodule/delocate.h +88 -0
- data/third_party/boringssl/crypto/{des → fipsmodule/des}/internal.h +18 -4
- data/third_party/boringssl/crypto/{digest → fipsmodule/digest}/internal.h +18 -18
- data/third_party/boringssl/crypto/{digest → fipsmodule/digest}/md32_common.h +58 -64
- data/third_party/boringssl/crypto/{ec → fipsmodule/ec}/internal.h +58 -52
- data/third_party/boringssl/crypto/{ec → fipsmodule/ec}/p256-x86_64-table.h +11 -11
- data/third_party/boringssl/crypto/{ec → fipsmodule/ec}/p256-x86_64.h +32 -32
- data/third_party/boringssl/crypto/{rand/internal.h → fipsmodule/is_fips.c} +10 -15
- data/third_party/boringssl/crypto/{modes → fipsmodule/modes}/internal.h +112 -119
- data/third_party/boringssl/crypto/fipsmodule/rand/internal.h +92 -0
- data/third_party/boringssl/crypto/{rsa → fipsmodule/rsa}/internal.h +36 -49
- data/third_party/boringssl/crypto/hkdf/hkdf.c +6 -6
- data/third_party/boringssl/crypto/internal.h +301 -233
- data/third_party/boringssl/crypto/lhash/lhash.c +26 -45
- data/third_party/boringssl/crypto/mem.c +76 -33
- data/third_party/boringssl/crypto/obj/obj.c +44 -28
- data/third_party/boringssl/crypto/obj/obj_dat.h +102 -34
- data/third_party/boringssl/crypto/obj/obj_xref.c +6 -6
- data/third_party/boringssl/crypto/pem/pem_info.c +3 -5
- data/third_party/boringssl/crypto/pem/pem_lib.c +1 -6
- data/third_party/boringssl/crypto/pem/pem_pk8.c +1 -0
- data/third_party/boringssl/crypto/pem/pem_pkey.c +1 -1
- data/third_party/boringssl/crypto/pem/pem_xaux.c +0 -2
- data/third_party/boringssl/crypto/pkcs7/internal.h +49 -0
- data/third_party/boringssl/crypto/pkcs7/pkcs7.c +166 -0
- data/third_party/boringssl/crypto/{x509/pkcs7.c → pkcs7/pkcs7_x509.c} +27 -147
- data/third_party/boringssl/crypto/pkcs8/internal.h +34 -16
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +120 -39
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +144 -857
- data/third_party/boringssl/crypto/pkcs8/pkcs8_x509.c +789 -0
- data/third_party/boringssl/crypto/poly1305/internal.h +4 -3
- data/third_party/boringssl/crypto/poly1305/poly1305.c +14 -14
- data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +11 -11
- data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +41 -41
- data/third_party/boringssl/crypto/pool/internal.h +2 -2
- data/third_party/boringssl/crypto/pool/pool.c +15 -15
- data/third_party/boringssl/crypto/{rand → rand_extra}/deterministic.c +7 -7
- data/third_party/boringssl/crypto/rand_extra/forkunsafe.c +46 -0
- data/third_party/boringssl/crypto/{rand → rand_extra}/fuchsia.c +7 -7
- data/third_party/boringssl/crypto/rand_extra/rand_extra.c +70 -0
- data/third_party/boringssl/crypto/{rand → rand_extra}/windows.c +5 -5
- data/third_party/boringssl/crypto/refcount_c11.c +2 -2
- data/third_party/boringssl/crypto/refcount_lock.c +1 -1
- data/third_party/boringssl/crypto/{rsa → rsa_extra}/rsa_asn1.c +12 -120
- data/third_party/boringssl/crypto/stack/stack.c +13 -13
- data/third_party/boringssl/crypto/thread_none.c +1 -1
- data/third_party/boringssl/crypto/thread_pthread.c +1 -1
- data/third_party/boringssl/crypto/thread_win.c +40 -40
- data/third_party/boringssl/crypto/x509/a_sign.c +5 -12
- data/third_party/boringssl/crypto/x509/a_verify.c +6 -18
- data/third_party/boringssl/crypto/x509/algorithm.c +22 -6
- data/third_party/boringssl/crypto/x509/asn1_gen.c +30 -7
- data/third_party/boringssl/crypto/x509/by_dir.c +2 -2
- data/third_party/boringssl/crypto/x509/by_file.c +2 -2
- data/third_party/boringssl/crypto/x509/rsa_pss.c +5 -5
- data/third_party/boringssl/crypto/x509/t_x509.c +2 -1
- data/third_party/boringssl/crypto/x509/x509_def.c +5 -0
- data/third_party/boringssl/crypto/x509/x509_lu.c +35 -4
- data/third_party/boringssl/crypto/x509/x509_set.c +10 -0
- data/third_party/boringssl/crypto/x509/x509_vfy.c +20 -17
- data/third_party/boringssl/crypto/x509/x_name.c +13 -16
- data/third_party/boringssl/crypto/x509/x_x509.c +3 -3
- data/third_party/boringssl/crypto/x509/x_x509a.c +0 -7
- data/third_party/boringssl/crypto/x509v3/ext_dat.h +8 -0
- data/third_party/boringssl/crypto/x509v3/pcy_int.h +2 -2
- data/third_party/boringssl/crypto/x509v3/pcy_lib.c +0 -9
- data/third_party/boringssl/crypto/x509v3/pcy_node.c +1 -1
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +25 -15
- data/third_party/boringssl/crypto/x509v3/v3_alt.c +21 -11
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +9 -3
- data/third_party/boringssl/crypto/x509v3/v3_info.c +22 -14
- data/third_party/boringssl/crypto/x509v3/v3_ncons.c +27 -11
- data/third_party/boringssl/crypto/x509v3/v3_pci.c +0 -33
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +4 -4
- data/third_party/boringssl/include/openssl/aead.h +280 -191
- data/third_party/boringssl/include/openssl/aes.h +50 -50
- data/third_party/boringssl/include/openssl/arm_arch.h +12 -12
- data/third_party/boringssl/include/openssl/asn1.h +14 -77
- data/third_party/boringssl/include/openssl/asn1t.h +11 -15
- data/third_party/boringssl/include/openssl/base.h +78 -51
- data/third_party/boringssl/include/openssl/base64.h +68 -68
- data/third_party/boringssl/include/openssl/bio.h +472 -406
- data/third_party/boringssl/include/openssl/blowfish.h +1 -1
- data/third_party/boringssl/include/openssl/bn.h +454 -435
- data/third_party/boringssl/include/openssl/buf.h +27 -27
- data/third_party/boringssl/include/openssl/bytestring.h +282 -267
- data/third_party/boringssl/include/openssl/cast.h +2 -2
- data/third_party/boringssl/include/openssl/chacha.h +5 -5
- data/third_party/boringssl/include/openssl/cipher.h +209 -200
- data/third_party/boringssl/include/openssl/cmac.h +27 -27
- data/third_party/boringssl/include/openssl/conf.h +49 -46
- data/third_party/boringssl/include/openssl/cpu.h +60 -45
- data/third_party/boringssl/include/openssl/crypto.h +59 -35
- data/third_party/boringssl/include/openssl/curve25519.h +97 -92
- data/third_party/boringssl/include/openssl/des.h +25 -25
- data/third_party/boringssl/include/openssl/dh.h +98 -97
- data/third_party/boringssl/include/openssl/digest.h +143 -114
- data/third_party/boringssl/include/openssl/dsa.h +217 -202
- data/third_party/boringssl/include/openssl/ec.h +132 -131
- data/third_party/boringssl/include/openssl/ec_key.h +132 -128
- data/third_party/boringssl/include/openssl/ecdh.h +9 -9
- data/third_party/boringssl/include/openssl/ecdsa.h +66 -66
- data/third_party/boringssl/include/openssl/engine.h +38 -38
- data/third_party/boringssl/include/openssl/err.h +189 -219
- data/third_party/boringssl/include/openssl/evp.h +473 -397
- data/third_party/boringssl/include/openssl/ex_data.h +46 -56
- data/third_party/boringssl/include/openssl/hkdf.h +17 -17
- data/third_party/boringssl/include/openssl/hmac.h +55 -43
- data/third_party/boringssl/include/openssl/is_boringssl.h +16 -0
- data/third_party/boringssl/include/openssl/lhash.h +67 -67
- data/third_party/boringssl/include/openssl/lhash_macros.h +4 -4
- data/third_party/boringssl/include/openssl/md4.h +14 -14
- data/third_party/boringssl/include/openssl/md5.h +14 -14
- data/third_party/boringssl/include/openssl/mem.h +39 -33
- data/third_party/boringssl/include/openssl/nid.h +43 -0
- data/third_party/boringssl/include/openssl/obj.h +93 -87
- data/third_party/boringssl/include/openssl/opensslconf.h +8 -1
- data/third_party/boringssl/include/openssl/pem.h +2 -122
- data/third_party/boringssl/include/openssl/pkcs7.h +68 -2
- data/third_party/boringssl/include/openssl/pkcs8.h +81 -66
- data/third_party/boringssl/include/openssl/poly1305.h +11 -11
- data/third_party/boringssl/include/openssl/pool.h +29 -25
- data/third_party/boringssl/include/openssl/rand.h +48 -45
- data/third_party/boringssl/include/openssl/rc4.h +9 -9
- data/third_party/boringssl/include/openssl/ripemd.h +13 -13
- data/third_party/boringssl/include/openssl/rsa.h +371 -340
- data/third_party/boringssl/include/openssl/sha.h +71 -71
- data/third_party/boringssl/include/openssl/span.h +191 -0
- data/third_party/boringssl/include/openssl/ssl.h +2639 -2519
- data/third_party/boringssl/include/openssl/ssl3.h +39 -122
- data/third_party/boringssl/include/openssl/stack.h +355 -164
- data/third_party/boringssl/include/openssl/thread.h +43 -43
- data/third_party/boringssl/include/openssl/tls1.h +60 -63
- data/third_party/boringssl/include/openssl/type_check.h +10 -14
- data/third_party/boringssl/include/openssl/x509.h +41 -116
- data/third_party/boringssl/include/openssl/x509_vfy.h +17 -25
- data/third_party/boringssl/include/openssl/x509v3.h +27 -21
- data/third_party/boringssl/ssl/{bio_ssl.c → bio_ssl.cc} +9 -5
- data/third_party/boringssl/ssl/{custom_extensions.c → custom_extensions.cc} +19 -12
- data/third_party/boringssl/ssl/{d1_both.c → d1_both.cc} +224 -193
- data/third_party/boringssl/ssl/{d1_lib.c → d1_lib.cc} +86 -79
- data/third_party/boringssl/ssl/{d1_pkt.c → d1_pkt.cc} +55 -87
- data/third_party/boringssl/ssl/{d1_srtp.c → d1_srtp.cc} +12 -16
- data/third_party/boringssl/ssl/{dtls_method.c → dtls_method.cc} +33 -50
- data/third_party/boringssl/ssl/{dtls_record.c → dtls_record.cc} +76 -64
- data/third_party/boringssl/ssl/handshake.cc +547 -0
- data/third_party/boringssl/ssl/handshake_client.cc +1828 -0
- data/third_party/boringssl/ssl/handshake_server.cc +1672 -0
- data/third_party/boringssl/ssl/internal.h +2027 -1280
- data/third_party/boringssl/ssl/s3_both.cc +603 -0
- data/third_party/boringssl/ssl/{s3_lib.c → s3_lib.cc} +22 -10
- data/third_party/boringssl/ssl/{s3_pkt.c → s3_pkt.cc} +171 -75
- data/third_party/boringssl/ssl/ssl_aead_ctx.cc +415 -0
- data/third_party/boringssl/ssl/{ssl_asn1.c → ssl_asn1.cc} +257 -261
- data/third_party/boringssl/ssl/{ssl_buffer.c → ssl_buffer.cc} +81 -97
- data/third_party/boringssl/ssl/{ssl_cert.c → ssl_cert.cc} +304 -414
- data/third_party/boringssl/ssl/{ssl_cipher.c → ssl_cipher.cc} +427 -505
- data/third_party/boringssl/ssl/{ssl_file.c → ssl_file.cc} +24 -16
- data/third_party/boringssl/ssl/ssl_key_share.cc +245 -0
- data/third_party/boringssl/ssl/{ssl_lib.c → ssl_lib.cc} +665 -828
- data/third_party/boringssl/ssl/ssl_privkey.cc +518 -0
- data/third_party/boringssl/ssl/{ssl_session.c → ssl_session.cc} +596 -471
- data/third_party/boringssl/ssl/{ssl_stat.c → ssl_stat.cc} +5 -224
- data/third_party/boringssl/ssl/{ssl_transcript.c → ssl_transcript.cc} +117 -140
- data/third_party/boringssl/ssl/ssl_versions.cc +439 -0
- data/third_party/boringssl/ssl/{ssl_x509.c → ssl_x509.cc} +751 -267
- data/third_party/boringssl/ssl/{t1_enc.c → t1_enc.cc} +120 -161
- data/third_party/boringssl/ssl/{t1_lib.c → t1_lib.cc} +859 -966
- data/third_party/boringssl/ssl/{tls13_both.c → tls13_both.cc} +202 -284
- data/third_party/boringssl/ssl/tls13_client.cc +842 -0
- data/third_party/boringssl/ssl/{tls13_enc.c → tls13_enc.cc} +108 -90
- data/third_party/boringssl/ssl/tls13_server.cc +967 -0
- data/third_party/boringssl/ssl/{tls_method.c → tls_method.cc} +94 -73
- data/third_party/boringssl/ssl/tls_record.cc +675 -0
- metadata +117 -168
- data/include/grpc/support/cmdline.h +0 -88
- data/include/grpc/support/subprocess.h +0 -44
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -29
- data/src/core/ext/filters/client_channel/resolver_factory.cc +0 -40
- data/src/core/lib/gpr/cmdline.cc +0 -330
- data/src/core/lib/gpr/subprocess_posix.cc +0 -99
- data/src/core/lib/gpr/subprocess_windows.cc +0 -126
- data/src/core/lib/surface/alarm.cc +0 -137
- data/src/core/lib/surface/alarm_internal.h +0 -40
- data/src/core/tsi/gts_transport_security.cc +0 -40
- data/third_party/boringssl/crypto/aes/aes.c +0 -1142
- data/third_party/boringssl/crypto/aes/internal.h +0 -87
- data/third_party/boringssl/crypto/aes/key_wrap.c +0 -138
- data/third_party/boringssl/crypto/aes/mode_wrappers.c +0 -112
- data/third_party/boringssl/crypto/asn1/x_long.c +0 -200
- data/third_party/boringssl/crypto/bn/add.c +0 -377
- data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +0 -532
- data/third_party/boringssl/crypto/bn/bn.c +0 -365
- data/third_party/boringssl/crypto/bn/cmp.c +0 -239
- data/third_party/boringssl/crypto/bn/ctx.c +0 -313
- data/third_party/boringssl/crypto/bn/div.c +0 -728
- data/third_party/boringssl/crypto/bn/exponentiation.c +0 -1240
- data/third_party/boringssl/crypto/bn/gcd.c +0 -635
- data/third_party/boringssl/crypto/bn/generic.c +0 -707
- data/third_party/boringssl/crypto/bn/kronecker.c +0 -176
- data/third_party/boringssl/crypto/bn/montgomery.c +0 -409
- data/third_party/boringssl/crypto/bn/montgomery_inv.c +0 -207
- data/third_party/boringssl/crypto/bn/mul.c +0 -871
- data/third_party/boringssl/crypto/bn/prime.c +0 -861
- data/third_party/boringssl/crypto/bn/random.c +0 -343
- data/third_party/boringssl/crypto/bn/rsaz_exp.c +0 -254
- data/third_party/boringssl/crypto/bn/shift.c +0 -307
- data/third_party/boringssl/crypto/bn/sqrt.c +0 -506
- data/third_party/boringssl/crypto/cipher/aead.c +0 -156
- data/third_party/boringssl/crypto/cipher/cipher.c +0 -657
- data/third_party/boringssl/crypto/cipher/e_aes.c +0 -1771
- data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +0 -276
- data/third_party/boringssl/crypto/cipher/e_des.c +0 -205
- data/third_party/boringssl/crypto/cipher/tls_cbc.c +0 -482
- data/third_party/boringssl/crypto/des/des.c +0 -771
- data/third_party/boringssl/crypto/digest/digest.c +0 -251
- data/third_party/boringssl/crypto/digest/digests.c +0 -358
- data/third_party/boringssl/crypto/ec/ec.c +0 -847
- data/third_party/boringssl/crypto/ec/ec_key.c +0 -479
- data/third_party/boringssl/crypto/ec/ec_montgomery.c +0 -303
- data/third_party/boringssl/crypto/ec/oct.c +0 -416
- data/third_party/boringssl/crypto/ec/p224-64.c +0 -1143
- data/third_party/boringssl/crypto/ec/p256-64.c +0 -1701
- data/third_party/boringssl/crypto/ec/p256-x86_64.c +0 -561
- data/third_party/boringssl/crypto/ec/simple.c +0 -1118
- data/third_party/boringssl/crypto/ec/util-64.c +0 -109
- data/third_party/boringssl/crypto/ec/wnaf.c +0 -458
- data/third_party/boringssl/crypto/ecdsa/ecdsa.c +0 -479
- data/third_party/boringssl/crypto/hmac/hmac.c +0 -215
- data/third_party/boringssl/crypto/md4/md4.c +0 -236
- data/third_party/boringssl/crypto/md5/md5.c +0 -285
- data/third_party/boringssl/crypto/modes/cbc.c +0 -212
- data/third_party/boringssl/crypto/modes/cfb.c +0 -230
- data/third_party/boringssl/crypto/modes/ctr.c +0 -219
- data/third_party/boringssl/crypto/modes/gcm.c +0 -1071
- data/third_party/boringssl/crypto/modes/ofb.c +0 -95
- data/third_party/boringssl/crypto/modes/polyval.c +0 -94
- data/third_party/boringssl/crypto/pkcs8/p8_pkey.c +0 -85
- data/third_party/boringssl/crypto/rand/rand.c +0 -244
- data/third_party/boringssl/crypto/rand/urandom.c +0 -335
- data/third_party/boringssl/crypto/rsa/blinding.c +0 -265
- data/third_party/boringssl/crypto/rsa/padding.c +0 -708
- data/third_party/boringssl/crypto/rsa/rsa.c +0 -830
- data/third_party/boringssl/crypto/rsa/rsa_impl.c +0 -1100
- data/third_party/boringssl/crypto/sha/sha1-altivec.c +0 -346
- data/third_party/boringssl/crypto/sha/sha1.c +0 -355
- data/third_party/boringssl/crypto/sha/sha256.c +0 -329
- data/third_party/boringssl/crypto/sha/sha512.c +0 -609
- data/third_party/boringssl/crypto/x509/x509type.c +0 -126
- data/third_party/boringssl/include/openssl/stack_macros.h +0 -3987
- data/third_party/boringssl/ssl/handshake_client.c +0 -1883
- data/third_party/boringssl/ssl/handshake_server.c +0 -1950
- data/third_party/boringssl/ssl/s3_both.c +0 -895
- data/third_party/boringssl/ssl/ssl_aead_ctx.c +0 -335
- data/third_party/boringssl/ssl/ssl_ecdh.c +0 -465
- data/third_party/boringssl/ssl/ssl_privkey.c +0 -683
- data/third_party/boringssl/ssl/ssl_privkey_cc.cc +0 -76
- data/third_party/boringssl/ssl/tls13_client.c +0 -712
- data/third_party/boringssl/ssl/tls13_server.c +0 -680
- data/third_party/boringssl/ssl/tls_record.c +0 -556
@@ -20,21 +20,34 @@
|
|
20
20
|
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H
|
21
21
|
|
22
22
|
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
|
23
|
+
#include "src/core/lib/gprpp/memory.h"
|
24
|
+
#include "src/core/lib/gprpp/orphanable.h"
|
23
25
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
24
26
|
|
25
|
-
|
26
|
-
* returned when no name is provided in a lookup */
|
27
|
-
void grpc_lb_policy_registry_init(void);
|
28
|
-
void grpc_lb_policy_registry_shutdown(void);
|
27
|
+
namespace grpc_core {
|
29
28
|
|
30
|
-
|
31
|
-
|
29
|
+
class LoadBalancingPolicyRegistry {
|
30
|
+
public:
|
31
|
+
/// Methods used to create and populate the LoadBalancingPolicyRegistry.
|
32
|
+
/// NOT THREAD SAFE -- to be used only during global gRPC
|
33
|
+
/// initialization and shutdown.
|
34
|
+
class Builder {
|
35
|
+
public:
|
36
|
+
/// Global initialization and shutdown hooks.
|
37
|
+
static void InitRegistry();
|
38
|
+
static void ShutdownRegistry();
|
32
39
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
40
|
+
/// Registers an LB policy factory. The factory will be used to create an
|
41
|
+
/// LB policy whose name matches that of the factory.
|
42
|
+
static void RegisterLoadBalancingPolicyFactory(
|
43
|
+
UniquePtr<LoadBalancingPolicyFactory> factory);
|
44
|
+
};
|
45
|
+
|
46
|
+
/// Creates an LB policy of the type specified by \a name.
|
47
|
+
static OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
|
48
|
+
const char* name, const LoadBalancingPolicy::Args& args);
|
49
|
+
};
|
50
|
+
|
51
|
+
} // namespace grpc_core
|
39
52
|
|
40
53
|
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H */
|
@@ -26,9 +26,10 @@
|
|
26
26
|
#endif
|
27
27
|
|
28
28
|
#include <grpc/support/alloc.h>
|
29
|
-
#include <grpc/support/host_port.h>
|
30
29
|
#include <grpc/support/log.h>
|
31
30
|
#include <grpc/support/string_util.h>
|
31
|
+
|
32
|
+
#include "src/core/lib/gpr/host_port.h"
|
32
33
|
#include "src/core/lib/gpr/string.h"
|
33
34
|
|
34
35
|
#ifdef GRPC_HAVE_UNIX_SOCKET
|
@@ -39,7 +40,8 @@ bool grpc_parse_unix(const grpc_uri* uri,
|
|
39
40
|
gpr_log(GPR_ERROR, "Expected 'unix' scheme, got '%s'", uri->scheme);
|
40
41
|
return false;
|
41
42
|
}
|
42
|
-
struct sockaddr_un* un =
|
43
|
+
struct sockaddr_un* un =
|
44
|
+
reinterpret_cast<struct sockaddr_un*>(resolved_addr->addr);
|
43
45
|
const size_t maxlen = sizeof(un->sun_path);
|
44
46
|
const size_t path_len = strnlen(uri->path, maxlen);
|
45
47
|
if (path_len == maxlen) return false;
|
@@ -68,7 +70,7 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
|
|
68
70
|
// Parse IP address.
|
69
71
|
memset(addr, 0, sizeof(*addr));
|
70
72
|
addr->len = sizeof(struct sockaddr_in);
|
71
|
-
struct sockaddr_in* in =
|
73
|
+
struct sockaddr_in* in = reinterpret_cast<struct sockaddr_in*>(addr->addr);
|
72
74
|
in->sin_family = AF_INET;
|
73
75
|
if (inet_pton(AF_INET, host, &in->sin_addr) == 0) {
|
74
76
|
if (log_errors) gpr_log(GPR_ERROR, "invalid ipv4 address: '%s'", host);
|
@@ -84,7 +86,7 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
|
|
84
86
|
if (log_errors) gpr_log(GPR_ERROR, "invalid ipv4 port: '%s'", port);
|
85
87
|
goto done;
|
86
88
|
}
|
87
|
-
in->sin_port = htons((
|
89
|
+
in->sin_port = htons(static_cast<uint16_t>(port_num));
|
88
90
|
success = true;
|
89
91
|
done:
|
90
92
|
gpr_free(host);
|
@@ -114,14 +116,14 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
|
|
114
116
|
// Parse IP address.
|
115
117
|
memset(addr, 0, sizeof(*addr));
|
116
118
|
addr->len = sizeof(struct sockaddr_in6);
|
117
|
-
struct sockaddr_in6* in6 =
|
119
|
+
struct sockaddr_in6* in6 = reinterpret_cast<struct sockaddr_in6*>(addr->addr);
|
118
120
|
in6->sin6_family = AF_INET6;
|
119
121
|
// Handle the RFC6874 syntax for IPv6 zone identifiers.
|
120
|
-
char* host_end = (
|
122
|
+
char* host_end = static_cast<char*>(gpr_memrchr(host, '%', strlen(host)));
|
121
123
|
if (host_end != nullptr) {
|
122
124
|
GPR_ASSERT(host_end >= host);
|
123
125
|
char host_without_scope[INET6_ADDRSTRLEN];
|
124
|
-
size_t host_without_scope_len =
|
126
|
+
size_t host_without_scope_len = static_cast<size_t>(host_end - host);
|
125
127
|
uint32_t sin6_scope_id = 0;
|
126
128
|
strncpy(host_without_scope, host, host_without_scope_len);
|
127
129
|
host_without_scope[host_without_scope_len] = '\0';
|
@@ -153,7 +155,7 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
|
|
153
155
|
if (log_errors) gpr_log(GPR_ERROR, "invalid ipv6 port: '%s'", port);
|
154
156
|
goto done;
|
155
157
|
}
|
156
|
-
in6->sin6_port = htons((
|
158
|
+
in6->sin6_port = htons(static_cast<uint16_t>(port_num));
|
157
159
|
success = true;
|
158
160
|
done:
|
159
161
|
gpr_free(host);
|
@@ -34,8 +34,8 @@ typedef struct {
|
|
34
34
|
static void grpc_proxy_mapper_list_register(grpc_proxy_mapper_list* list,
|
35
35
|
bool at_start,
|
36
36
|
grpc_proxy_mapper* mapper) {
|
37
|
-
list->list = (
|
38
|
-
list->list, (list->num_mappers + 1) * sizeof(grpc_proxy_mapper*));
|
37
|
+
list->list = static_cast<grpc_proxy_mapper**>(gpr_realloc(
|
38
|
+
list->list, (list->num_mappers + 1) * sizeof(grpc_proxy_mapper*)));
|
39
39
|
if (at_start) {
|
40
40
|
memmove(list->list + 1, list->list,
|
41
41
|
sizeof(grpc_proxy_mapper*) * list->num_mappers);
|
@@ -22,58 +22,12 @@
|
|
22
22
|
grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount(false,
|
23
23
|
"resolver_refcount");
|
24
24
|
|
25
|
-
|
26
|
-
const grpc_resolver_vtable* vtable,
|
27
|
-
grpc_combiner* combiner) {
|
28
|
-
resolver->vtable = vtable;
|
29
|
-
resolver->combiner = GRPC_COMBINER_REF(combiner, "resolver");
|
30
|
-
gpr_ref_init(&resolver->refs, 1);
|
31
|
-
}
|
25
|
+
namespace grpc_core {
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
if (grpc_trace_resolver_refcount.enabled()) {
|
37
|
-
gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count);
|
38
|
-
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
39
|
-
"RESOLVER:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", resolver,
|
40
|
-
old_refs, old_refs + 1, reason);
|
41
|
-
}
|
42
|
-
#else
|
43
|
-
void grpc_resolver_ref(grpc_resolver* resolver) {
|
44
|
-
#endif
|
45
|
-
gpr_ref(&resolver->refs);
|
46
|
-
}
|
27
|
+
Resolver::Resolver(grpc_combiner* combiner)
|
28
|
+
: InternallyRefCountedWithTracing(&grpc_trace_resolver_refcount),
|
29
|
+
combiner_(GRPC_COMBINER_REF(combiner, "resolver")) {}
|
47
30
|
|
48
|
-
|
49
|
-
void grpc_resolver_unref(grpc_resolver* resolver, const char* file, int line,
|
50
|
-
const char* reason) {
|
51
|
-
if (grpc_trace_resolver_refcount.enabled()) {
|
52
|
-
gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count);
|
53
|
-
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
54
|
-
"RESOLVER:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", resolver,
|
55
|
-
old_refs, old_refs - 1, reason);
|
56
|
-
}
|
57
|
-
#else
|
58
|
-
void grpc_resolver_unref(grpc_resolver* resolver) {
|
59
|
-
#endif
|
60
|
-
if (gpr_unref(&resolver->refs)) {
|
61
|
-
grpc_combiner* combiner = resolver->combiner;
|
62
|
-
resolver->vtable->destroy(resolver);
|
63
|
-
GRPC_COMBINER_UNREF(combiner, "resolver");
|
64
|
-
}
|
65
|
-
}
|
31
|
+
Resolver::~Resolver() { GRPC_COMBINER_UNREF(combiner_, "resolver"); }
|
66
32
|
|
67
|
-
|
68
|
-
resolver->vtable->shutdown_locked(resolver);
|
69
|
-
}
|
70
|
-
|
71
|
-
void grpc_resolver_channel_saw_error_locked(grpc_resolver* resolver) {
|
72
|
-
resolver->vtable->channel_saw_error_locked(resolver);
|
73
|
-
}
|
74
|
-
|
75
|
-
void grpc_resolver_next_locked(grpc_resolver* resolver,
|
76
|
-
grpc_channel_args** result,
|
77
|
-
grpc_closure* on_complete) {
|
78
|
-
resolver->vtable->next_locked(resolver, result, on_complete);
|
79
|
-
}
|
33
|
+
} // namespace grpc_core
|
@@ -19,67 +19,110 @@
|
|
19
19
|
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H
|
20
20
|
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H
|
21
21
|
|
22
|
-
#include
|
23
|
-
#include "src/core/lib/iomgr/iomgr.h"
|
22
|
+
#include <grpc/impl/codegen/grpc_types.h>
|
24
23
|
|
25
|
-
|
26
|
-
|
24
|
+
#include "src/core/lib/gprpp/abstract.h"
|
25
|
+
#include "src/core/lib/gprpp/orphanable.h"
|
26
|
+
#include "src/core/lib/iomgr/combiner.h"
|
27
|
+
#include "src/core/lib/iomgr/iomgr.h"
|
27
28
|
|
28
29
|
extern grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount;
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
namespace grpc_core {
|
32
|
+
|
33
|
+
/// Interface for name resolution.
|
34
|
+
///
|
35
|
+
/// This interface is designed to support both push-based and pull-based
|
36
|
+
/// mechanisms. A push-based mechanism is one where the resolver will
|
37
|
+
/// subscribe to updates for a given name, and the name service will
|
38
|
+
/// proactively send new data to the resolver whenever the data associated
|
39
|
+
/// with the name changes. A pull-based mechanism is one where the resolver
|
40
|
+
/// needs to query the name service again to get updated information (e.g.,
|
41
|
+
/// DNS).
|
42
|
+
///
|
43
|
+
/// Note: All methods with a "Locked" suffix must be called from the
|
44
|
+
/// combiner passed to the constructor.
|
45
|
+
class Resolver : public InternallyRefCountedWithTracing<Resolver> {
|
46
|
+
public:
|
47
|
+
// Not copyable nor movable.
|
48
|
+
Resolver(const Resolver&) = delete;
|
49
|
+
Resolver& operator=(const Resolver&) = delete;
|
50
|
+
|
51
|
+
/// Requests a callback when a new result becomes available.
|
52
|
+
/// When the new result is available, sets \a *result to the new result
|
53
|
+
/// and schedules \a on_complete for execution.
|
54
|
+
/// If resolution is fatally broken, sets \a *result to nullptr and
|
55
|
+
/// schedules \a on_complete with an error.
|
56
|
+
///
|
57
|
+
/// Note that the client channel will almost always have a request
|
58
|
+
/// to \a NextLocked() pending. When it gets the callback, it will
|
59
|
+
/// process the new result and then immediately make another call to
|
60
|
+
/// \a NextLocked(). This allows push-based resolvers to provide new
|
61
|
+
/// data as soon as it becomes available.
|
62
|
+
virtual void NextLocked(grpc_channel_args** result,
|
63
|
+
grpc_closure* on_complete) GRPC_ABSTRACT;
|
64
|
+
|
65
|
+
/// Asks the resolver to obtain an updated resolver result, if
|
66
|
+
/// applicable.
|
67
|
+
///
|
68
|
+
/// This is useful for pull-based implementations to decide when to
|
69
|
+
/// re-resolve. However, the implementation is not required to
|
70
|
+
/// re-resolve immediately upon receiving this call; it may instead
|
71
|
+
/// elect to delay based on some configured minimum time between
|
72
|
+
/// queries, to avoid hammering the name service with queries.
|
73
|
+
///
|
74
|
+
/// For push-based implementations, this may be a no-op.
|
75
|
+
///
|
76
|
+
/// If this causes new data to become available, then the currently
|
77
|
+
/// pending call to \a NextLocked() will return the new result.
|
78
|
+
///
|
79
|
+
/// Note: Currently, all resolvers are required to return a new result
|
80
|
+
/// shortly after this method is called. For pull-based mechanisms, if
|
81
|
+
/// the implementation decides to delay querying the name service, it
|
82
|
+
/// should immediately return a new copy of the previously returned
|
83
|
+
/// result (and it can then return the updated data later, when it
|
84
|
+
/// actually does query the name service). For push-based mechanisms,
|
85
|
+
/// the implementation should immediately return a new copy of the
|
86
|
+
/// last-seen result.
|
87
|
+
/// TODO(roth): Remove this requirement once we fix pick_first to not
|
88
|
+
/// throw away unselected subchannels.
|
89
|
+
virtual void RequestReresolutionLocked() GRPC_ABSTRACT;
|
90
|
+
|
91
|
+
void Orphan() override {
|
92
|
+
// Invoke ShutdownAndUnrefLocked() inside of the combiner.
|
93
|
+
GRPC_CLOSURE_SCHED(
|
94
|
+
GRPC_CLOSURE_CREATE(&Resolver::ShutdownAndUnrefLocked, this,
|
95
|
+
grpc_combiner_scheduler(combiner_)),
|
96
|
+
GRPC_ERROR_NONE);
|
97
|
+
}
|
98
|
+
|
99
|
+
GRPC_ABSTRACT_BASE_CLASS
|
100
|
+
|
101
|
+
protected:
|
102
|
+
/// Does NOT take ownership of the reference to \a combiner.
|
103
|
+
// TODO(roth): Once we have a C++-like interface for combiners, this
|
104
|
+
// API should change to take a RefCountedPtr<>, so that we always take
|
105
|
+
// ownership of a new ref.
|
106
|
+
explicit Resolver(grpc_combiner* combiner);
|
107
|
+
|
108
|
+
virtual ~Resolver();
|
109
|
+
|
110
|
+
/// Shuts down the resolver. If there is a pending call to
|
111
|
+
/// NextLocked(), the callback will be scheduled with an error.
|
112
|
+
virtual void ShutdownLocked() GRPC_ABSTRACT;
|
113
|
+
|
114
|
+
grpc_combiner* combiner() const { return combiner_; }
|
115
|
+
|
116
|
+
private:
|
117
|
+
static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored) {
|
118
|
+
Resolver* resolver = static_cast<Resolver*>(arg);
|
119
|
+
resolver->ShutdownLocked();
|
120
|
+
resolver->Unref();
|
121
|
+
}
|
36
122
|
|
37
|
-
|
38
|
-
void (*destroy)(grpc_resolver* resolver);
|
39
|
-
void (*shutdown_locked)(grpc_resolver* resolver);
|
40
|
-
void (*channel_saw_error_locked)(grpc_resolver* resolver);
|
41
|
-
void (*next_locked)(grpc_resolver* resolver, grpc_channel_args** result,
|
42
|
-
grpc_closure* on_complete);
|
123
|
+
grpc_combiner* combiner_;
|
43
124
|
};
|
44
125
|
|
45
|
-
|
46
|
-
#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p), __FILE__, __LINE__, (r))
|
47
|
-
#define GRPC_RESOLVER_UNREF(p, r) \
|
48
|
-
grpc_resolver_unref((p), __FILE__, __LINE__, (r))
|
49
|
-
void grpc_resolver_ref(grpc_resolver* policy, const char* file, int line,
|
50
|
-
const char* reason);
|
51
|
-
void grpc_resolver_unref(grpc_resolver* policy, const char* file, int line,
|
52
|
-
const char* reason);
|
53
|
-
#else
|
54
|
-
#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p))
|
55
|
-
#define GRPC_RESOLVER_UNREF(p, r) grpc_resolver_unref((p))
|
56
|
-
void grpc_resolver_ref(grpc_resolver* policy);
|
57
|
-
void grpc_resolver_unref(grpc_resolver* policy);
|
58
|
-
#endif
|
59
|
-
|
60
|
-
void grpc_resolver_init(grpc_resolver* resolver,
|
61
|
-
const grpc_resolver_vtable* vtable,
|
62
|
-
grpc_combiner* combiner);
|
63
|
-
|
64
|
-
void grpc_resolver_shutdown_locked(grpc_resolver* resolver);
|
65
|
-
|
66
|
-
/** Notification that the channel has seen an error on some address.
|
67
|
-
Can be used as a hint that re-resolution is desirable soon.
|
68
|
-
|
69
|
-
Must be called from the combiner passed as a resolver_arg at construction
|
70
|
-
time.*/
|
71
|
-
void grpc_resolver_channel_saw_error_locked(grpc_resolver* resolver);
|
72
|
-
|
73
|
-
/** Get the next result from the resolver. Expected to set \a *result with
|
74
|
-
new channel args and then schedule \a on_complete for execution.
|
75
|
-
|
76
|
-
If resolution is fatally broken, set \a *result to NULL and
|
77
|
-
schedule \a on_complete.
|
78
|
-
|
79
|
-
Must be called from the combiner passed as a resolver_arg at construction
|
80
|
-
time.*/
|
81
|
-
void grpc_resolver_next_locked(grpc_resolver* resolver,
|
82
|
-
grpc_channel_args** result,
|
83
|
-
grpc_closure* on_complete);
|
126
|
+
} // namespace grpc_core
|
84
127
|
|
85
128
|
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H */
|
@@ -25,7 +25,6 @@
|
|
25
25
|
#include <unistd.h>
|
26
26
|
|
27
27
|
#include <grpc/support/alloc.h>
|
28
|
-
#include <grpc/support/host_port.h>
|
29
28
|
#include <grpc/support/string_util.h>
|
30
29
|
|
31
30
|
#include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
|
@@ -34,9 +33,10 @@
|
|
34
33
|
#include "src/core/ext/filters/client_channel/resolver_registry.h"
|
35
34
|
#include "src/core/lib/backoff/backoff.h"
|
36
35
|
#include "src/core/lib/channel/channel_args.h"
|
37
|
-
#include "src/core/lib/gpr++/manual_constructor.h"
|
38
36
|
#include "src/core/lib/gpr/env.h"
|
37
|
+
#include "src/core/lib/gpr/host_port.h"
|
39
38
|
#include "src/core/lib/gpr/string.h"
|
39
|
+
#include "src/core/lib/gprpp/manual_constructor.h"
|
40
40
|
#include "src/core/lib/iomgr/combiner.h"
|
41
41
|
#include "src/core/lib/iomgr/gethostname.h"
|
42
42
|
#include "src/core/lib/iomgr/resolve_address.h"
|
@@ -49,105 +49,168 @@
|
|
49
49
|
#define GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS 120
|
50
50
|
#define GRPC_DNS_RECONNECT_JITTER 0.2
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
grpc_channel_args
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
52
|
+
namespace grpc_core {
|
53
|
+
|
54
|
+
namespace {
|
55
|
+
|
56
|
+
const char kDefaultPort[] = "https";
|
57
|
+
|
58
|
+
class AresDnsResolver : public Resolver {
|
59
|
+
public:
|
60
|
+
explicit AresDnsResolver(const ResolverArgs& args);
|
61
|
+
|
62
|
+
void NextLocked(grpc_channel_args** result,
|
63
|
+
grpc_closure* on_complete) override;
|
64
|
+
|
65
|
+
void RequestReresolutionLocked() override;
|
66
|
+
|
67
|
+
void ShutdownLocked() override;
|
68
|
+
|
69
|
+
private:
|
70
|
+
virtual ~AresDnsResolver();
|
71
|
+
|
72
|
+
void MaybeStartResolvingLocked();
|
73
|
+
void StartResolvingLocked();
|
74
|
+
void MaybeFinishNextLocked();
|
75
|
+
|
76
|
+
static void OnNextResolutionLocked(void* arg, grpc_error* error);
|
77
|
+
static void OnResolvedLocked(void* arg, grpc_error* error);
|
78
|
+
|
79
|
+
/// DNS server to use (if not system default)
|
80
|
+
char* dns_server_;
|
81
|
+
/// name to resolve (usually the same as target_name)
|
82
|
+
char* name_to_resolve_;
|
83
|
+
/// channel args
|
84
|
+
grpc_channel_args* channel_args_;
|
85
|
+
/// whether to request the service config
|
86
|
+
bool request_service_config_;
|
87
|
+
/// pollset_set to drive the name resolution process
|
88
|
+
grpc_pollset_set* interested_parties_;
|
89
|
+
/// closures used by the combiner
|
90
|
+
grpc_closure on_next_resolution_;
|
91
|
+
grpc_closure on_resolved_;
|
92
|
+
/// are we currently resolving?
|
93
|
+
bool resolving_ = false;
|
94
|
+
/// the pending resolving request
|
95
|
+
grpc_ares_request* pending_request_ = nullptr;
|
96
|
+
/// which version of the result have we published?
|
97
|
+
int published_version_ = 0;
|
98
|
+
/// which version of the result is current?
|
99
|
+
int resolved_version_ = 0;
|
100
|
+
/// pending next completion, or NULL
|
101
|
+
grpc_closure* next_completion_ = nullptr;
|
102
|
+
/// target result address for next completion
|
103
|
+
grpc_channel_args** target_result_ = nullptr;
|
104
|
+
/// current (fully resolved) result
|
105
|
+
grpc_channel_args* resolved_result_ = nullptr;
|
106
|
+
/// next resolution timer
|
107
|
+
bool have_next_resolution_timer_ = false;
|
108
|
+
grpc_timer next_resolution_timer_;
|
109
|
+
/// min interval between DNS requests
|
110
|
+
grpc_millis min_time_between_resolutions_;
|
111
|
+
/// timestamp of last DNS request
|
112
|
+
grpc_millis last_resolution_timestamp_ = -1;
|
113
|
+
/// retry backoff state
|
114
|
+
BackOff backoff_;
|
115
|
+
/// currently resolving addresses
|
116
|
+
grpc_lb_addresses* lb_addresses_ = nullptr;
|
117
|
+
/// currently resolving service config
|
118
|
+
char* service_config_json_ = nullptr;
|
119
|
+
};
|
120
|
+
|
121
|
+
AresDnsResolver::AresDnsResolver(const ResolverArgs& args)
|
122
|
+
: Resolver(args.combiner),
|
123
|
+
backoff_(
|
124
|
+
BackOff::Options()
|
125
|
+
.set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS *
|
126
|
+
1000)
|
127
|
+
.set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
|
128
|
+
.set_jitter(GRPC_DNS_RECONNECT_JITTER)
|
129
|
+
.set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
|
130
|
+
// Get name to resolve from URI path.
|
131
|
+
const char* path = args.uri->path;
|
132
|
+
if (path[0] == '/') ++path;
|
133
|
+
name_to_resolve_ = gpr_strdup(path);
|
134
|
+
// Get DNS server from URI authority.
|
135
|
+
if (0 != strcmp(args.uri->authority, "")) {
|
136
|
+
dns_server_ = gpr_strdup(args.uri->authority);
|
119
137
|
}
|
120
|
-
|
121
|
-
|
138
|
+
channel_args_ = grpc_channel_args_copy(args.args);
|
139
|
+
const grpc_arg* arg = grpc_channel_args_find(
|
140
|
+
channel_args_, GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION);
|
141
|
+
request_service_config_ = !grpc_channel_arg_get_integer(
|
142
|
+
arg, (grpc_integer_options){false, false, true});
|
143
|
+
arg = grpc_channel_args_find(channel_args_,
|
144
|
+
GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
|
145
|
+
min_time_between_resolutions_ =
|
146
|
+
grpc_channel_arg_get_integer(arg, {1000, 0, INT_MAX});
|
147
|
+
interested_parties_ = grpc_pollset_set_create();
|
148
|
+
if (args.pollset_set != nullptr) {
|
149
|
+
grpc_pollset_set_add_pollset_set(interested_parties_, args.pollset_set);
|
150
|
+
}
|
151
|
+
GRPC_CLOSURE_INIT(&on_next_resolution_, OnNextResolutionLocked, this,
|
152
|
+
grpc_combiner_scheduler(combiner()));
|
153
|
+
GRPC_CLOSURE_INIT(&on_resolved_, OnResolvedLocked, this,
|
154
|
+
grpc_combiner_scheduler(combiner()));
|
155
|
+
}
|
156
|
+
|
157
|
+
AresDnsResolver::~AresDnsResolver() {
|
158
|
+
gpr_log(GPR_DEBUG, "destroying AresDnsResolver");
|
159
|
+
if (resolved_result_ != nullptr) {
|
160
|
+
grpc_channel_args_destroy(resolved_result_);
|
122
161
|
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
162
|
+
grpc_pollset_set_destroy(interested_parties_);
|
163
|
+
gpr_free(dns_server_);
|
164
|
+
gpr_free(name_to_resolve_);
|
165
|
+
grpc_channel_args_destroy(channel_args_);
|
166
|
+
}
|
167
|
+
|
168
|
+
void AresDnsResolver::NextLocked(grpc_channel_args** target_result,
|
169
|
+
grpc_closure* on_complete) {
|
170
|
+
gpr_log(GPR_DEBUG, "AresDnsResolver::NextLocked() is called.");
|
171
|
+
GPR_ASSERT(next_completion_ == nullptr);
|
172
|
+
next_completion_ = on_complete;
|
173
|
+
target_result_ = target_result;
|
174
|
+
if (resolved_version_ == 0 && !resolving_) {
|
175
|
+
MaybeStartResolvingLocked();
|
176
|
+
} else {
|
177
|
+
MaybeFinishNextLocked();
|
128
178
|
}
|
129
179
|
}
|
130
180
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
r->backoff->Reset();
|
135
|
-
dns_ares_start_resolving_locked(r);
|
181
|
+
void AresDnsResolver::RequestReresolutionLocked() {
|
182
|
+
if (!resolving_) {
|
183
|
+
MaybeStartResolvingLocked();
|
136
184
|
}
|
137
185
|
}
|
138
186
|
|
139
|
-
|
140
|
-
|
141
|
-
|
187
|
+
void AresDnsResolver::ShutdownLocked() {
|
188
|
+
if (have_next_resolution_timer_) {
|
189
|
+
grpc_timer_cancel(&next_resolution_timer_);
|
190
|
+
}
|
191
|
+
if (pending_request_ != nullptr) {
|
192
|
+
grpc_cancel_ares_request(pending_request_);
|
193
|
+
}
|
194
|
+
if (next_completion_ != nullptr) {
|
195
|
+
*target_result_ = nullptr;
|
196
|
+
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
197
|
+
"Resolver Shutdown"));
|
198
|
+
next_completion_ = nullptr;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
void AresDnsResolver::OnNextResolutionLocked(void* arg, grpc_error* error) {
|
203
|
+
AresDnsResolver* r = static_cast<AresDnsResolver*>(arg);
|
204
|
+
r->have_next_resolution_timer_ = false;
|
142
205
|
if (error == GRPC_ERROR_NONE) {
|
143
|
-
if (!r->
|
144
|
-
|
206
|
+
if (!r->resolving_) {
|
207
|
+
r->StartResolvingLocked();
|
145
208
|
}
|
146
209
|
}
|
147
|
-
|
210
|
+
r->Unref(DEBUG_LOCATION, "next_resolution_timer");
|
148
211
|
}
|
149
212
|
|
150
|
-
|
213
|
+
bool ValueInJsonArray(grpc_json* array, const char* value) {
|
151
214
|
for (grpc_json* entry = array->child; entry != nullptr; entry = entry->next) {
|
152
215
|
if (entry->type == GRPC_JSON_STRING && strcmp(entry->value, value) == 0) {
|
153
216
|
return true;
|
@@ -156,7 +219,7 @@ static bool value_in_json_array(grpc_json* array, const char* value) {
|
|
156
219
|
return false;
|
157
220
|
}
|
158
221
|
|
159
|
-
|
222
|
+
char* ChooseServiceConfig(char* service_config_choice_json) {
|
160
223
|
grpc_json* choices_json = grpc_json_parse_string(service_config_choice_json);
|
161
224
|
if (choices_json == nullptr || choices_json->type != GRPC_JSON_ARRAY) {
|
162
225
|
gpr_log(GPR_ERROR, "cannot parse service config JSON string");
|
@@ -174,8 +237,7 @@ static char* choose_service_config(char* service_config_choice_json) {
|
|
174
237
|
field = field->next) {
|
175
238
|
// Check client language, if specified.
|
176
239
|
if (strcmp(field->key, "clientLanguage") == 0) {
|
177
|
-
if (field->type != GRPC_JSON_ARRAY ||
|
178
|
-
!value_in_json_array(field, "c++")) {
|
240
|
+
if (field->type != GRPC_JSON_ARRAY || !ValueInJsonArray(field, "c++")) {
|
179
241
|
service_config_json = nullptr;
|
180
242
|
break;
|
181
243
|
}
|
@@ -184,7 +246,7 @@ static char* choose_service_config(char* service_config_choice_json) {
|
|
184
246
|
if (strcmp(field->key, "clientHostname") == 0) {
|
185
247
|
char* hostname = grpc_gethostname();
|
186
248
|
if (hostname == nullptr || field->type != GRPC_JSON_ARRAY ||
|
187
|
-
!
|
249
|
+
!ValueInJsonArray(field, hostname)) {
|
188
250
|
service_config_json = nullptr;
|
189
251
|
break;
|
190
252
|
}
|
@@ -219,24 +281,24 @@ static char* choose_service_config(char* service_config_choice_json) {
|
|
219
281
|
return service_config;
|
220
282
|
}
|
221
283
|
|
222
|
-
|
223
|
-
|
284
|
+
void AresDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) {
|
285
|
+
AresDnsResolver* r = static_cast<AresDnsResolver*>(arg);
|
224
286
|
grpc_channel_args* result = nullptr;
|
225
|
-
GPR_ASSERT(r->
|
226
|
-
r->
|
227
|
-
r->
|
228
|
-
if (r->
|
287
|
+
GPR_ASSERT(r->resolving_);
|
288
|
+
r->resolving_ = false;
|
289
|
+
r->pending_request_ = nullptr;
|
290
|
+
if (r->lb_addresses_ != nullptr) {
|
229
291
|
static const char* args_to_remove[2];
|
230
292
|
size_t num_args_to_remove = 0;
|
231
293
|
grpc_arg new_args[3];
|
232
294
|
size_t num_args_to_add = 0;
|
233
295
|
new_args[num_args_to_add++] =
|
234
|
-
grpc_lb_addresses_create_channel_arg(r->
|
296
|
+
grpc_lb_addresses_create_channel_arg(r->lb_addresses_);
|
235
297
|
grpc_service_config* service_config = nullptr;
|
236
298
|
char* service_config_string = nullptr;
|
237
|
-
if (r->
|
238
|
-
service_config_string =
|
239
|
-
gpr_free(r->
|
299
|
+
if (r->service_config_json_ != nullptr) {
|
300
|
+
service_config_string = ChooseServiceConfig(r->service_config_json_);
|
301
|
+
gpr_free(r->service_config_json_);
|
240
302
|
if (service_config_string != nullptr) {
|
241
303
|
gpr_log(GPR_INFO, "selected service config choice: %s",
|
242
304
|
service_config_string);
|
@@ -250,190 +312,157 @@ static void dns_ares_on_resolved_locked(void* arg, grpc_error* error) {
|
|
250
312
|
if (lb_policy_name != nullptr) {
|
251
313
|
args_to_remove[num_args_to_remove++] = GRPC_ARG_LB_POLICY_NAME;
|
252
314
|
new_args[num_args_to_add++] = grpc_channel_arg_string_create(
|
253
|
-
(char*)GRPC_ARG_LB_POLICY_NAME,
|
315
|
+
(char*)GRPC_ARG_LB_POLICY_NAME,
|
316
|
+
const_cast<char*>(lb_policy_name));
|
254
317
|
}
|
255
318
|
}
|
256
319
|
}
|
257
320
|
}
|
258
321
|
result = grpc_channel_args_copy_and_add_and_remove(
|
259
|
-
r->
|
322
|
+
r->channel_args_, args_to_remove, num_args_to_remove, new_args,
|
260
323
|
num_args_to_add);
|
261
324
|
if (service_config != nullptr) grpc_service_config_destroy(service_config);
|
262
325
|
gpr_free(service_config_string);
|
263
|
-
grpc_lb_addresses_destroy(r->
|
326
|
+
grpc_lb_addresses_destroy(r->lb_addresses_);
|
327
|
+
// Reset backoff state so that we start from the beginning when the
|
328
|
+
// next request gets triggered.
|
329
|
+
r->backoff_.Reset();
|
264
330
|
} else {
|
265
331
|
const char* msg = grpc_error_string(error);
|
266
332
|
gpr_log(GPR_DEBUG, "dns resolution failed: %s", msg);
|
267
|
-
grpc_millis next_try = r->
|
268
|
-
grpc_millis timeout = next_try -
|
333
|
+
grpc_millis next_try = r->backoff_.NextAttemptTime();
|
334
|
+
grpc_millis timeout = next_try - ExecCtx::Get()->Now();
|
269
335
|
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
|
270
336
|
grpc_error_string(error));
|
271
|
-
GPR_ASSERT(!r->
|
272
|
-
r->
|
273
|
-
|
337
|
+
GPR_ASSERT(!r->have_next_resolution_timer_);
|
338
|
+
r->have_next_resolution_timer_ = true;
|
339
|
+
// TODO(roth): We currently deal with this ref manually. Once the
|
340
|
+
// new closure API is done, find a way to track this ref with the timer
|
341
|
+
// callback as part of the type system.
|
342
|
+
RefCountedPtr<Resolver> self = r->Ref(DEBUG_LOCATION, "retry-timer");
|
343
|
+
self.release();
|
274
344
|
if (timeout > 0) {
|
275
345
|
gpr_log(GPR_DEBUG, "retrying in %" PRIdPTR " milliseconds", timeout);
|
276
346
|
} else {
|
277
347
|
gpr_log(GPR_DEBUG, "retrying immediately");
|
278
348
|
}
|
279
|
-
grpc_timer_init(&r->
|
280
|
-
&r->
|
349
|
+
grpc_timer_init(&r->next_resolution_timer_, next_try,
|
350
|
+
&r->on_next_resolution_);
|
281
351
|
}
|
282
|
-
if (r->
|
283
|
-
grpc_channel_args_destroy(r->
|
352
|
+
if (r->resolved_result_ != nullptr) {
|
353
|
+
grpc_channel_args_destroy(r->resolved_result_);
|
284
354
|
}
|
285
|
-
r->
|
286
|
-
r->
|
287
|
-
|
288
|
-
|
355
|
+
r->resolved_result_ = result;
|
356
|
+
++r->resolved_version_;
|
357
|
+
r->MaybeFinishNextLocked();
|
358
|
+
r->Unref(DEBUG_LOCATION, "dns-resolving");
|
289
359
|
}
|
290
360
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
361
|
+
void AresDnsResolver::MaybeStartResolvingLocked() {
|
362
|
+
if (last_resolution_timestamp_ >= 0) {
|
363
|
+
const grpc_millis earliest_next_resolution =
|
364
|
+
last_resolution_timestamp_ + min_time_between_resolutions_;
|
365
|
+
const grpc_millis ms_until_next_resolution =
|
366
|
+
earliest_next_resolution - grpc_core::ExecCtx::Get()->Now();
|
367
|
+
if (ms_until_next_resolution > 0) {
|
368
|
+
const grpc_millis last_resolution_ago =
|
369
|
+
grpc_core::ExecCtx::Get()->Now() - last_resolution_timestamp_;
|
370
|
+
gpr_log(GPR_DEBUG,
|
371
|
+
"In cooldown from last resolution (from %" PRIdPTR
|
372
|
+
" ms ago). Will resolve again in %" PRIdPTR " ms",
|
373
|
+
last_resolution_ago, ms_until_next_resolution);
|
374
|
+
if (!have_next_resolution_timer_) {
|
375
|
+
have_next_resolution_timer_ = true;
|
376
|
+
// TODO(roth): We currently deal with this ref manually. Once the
|
377
|
+
// new closure API is done, find a way to track this ref with the timer
|
378
|
+
// callback as part of the type system.
|
379
|
+
RefCountedPtr<Resolver> self =
|
380
|
+
Ref(DEBUG_LOCATION, "next_resolution_timer_cooldown");
|
381
|
+
self.release();
|
382
|
+
grpc_timer_init(&next_resolution_timer_, ms_until_next_resolution,
|
383
|
+
&on_next_resolution_);
|
384
|
+
}
|
385
|
+
// TODO(dgq): remove the following two lines once Pick First stops
|
386
|
+
// discarding subchannels after selecting.
|
387
|
+
++resolved_version_;
|
388
|
+
MaybeFinishNextLocked();
|
389
|
+
return;
|
390
|
+
}
|
304
391
|
}
|
392
|
+
StartResolvingLocked();
|
305
393
|
}
|
306
394
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
395
|
+
void AresDnsResolver::StartResolvingLocked() {
|
396
|
+
// TODO(roth): We currently deal with this ref manually. Once the
|
397
|
+
// new closure API is done, find a way to track this ref with the timer
|
398
|
+
// callback as part of the type system.
|
399
|
+
RefCountedPtr<Resolver> self = Ref(DEBUG_LOCATION, "dns-resolving");
|
400
|
+
self.release();
|
401
|
+
GPR_ASSERT(!resolving_);
|
402
|
+
resolving_ = true;
|
403
|
+
lb_addresses_ = nullptr;
|
404
|
+
service_config_json_ = nullptr;
|
405
|
+
pending_request_ = grpc_dns_lookup_ares(
|
406
|
+
dns_server_, name_to_resolve_, kDefaultPort, interested_parties_,
|
407
|
+
&on_resolved_, &lb_addresses_, true /* check_grpclb */,
|
408
|
+
request_service_config_ ? &service_config_json_ : nullptr);
|
409
|
+
last_resolution_timestamp_ = grpc_core::ExecCtx::Get()->Now();
|
318
410
|
}
|
319
411
|
|
320
|
-
|
321
|
-
if (
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
r->published_version = r->resolved_version;
|
412
|
+
void AresDnsResolver::MaybeFinishNextLocked() {
|
413
|
+
if (next_completion_ != nullptr && resolved_version_ != published_version_) {
|
414
|
+
*target_result_ = resolved_result_ == nullptr
|
415
|
+
? nullptr
|
416
|
+
: grpc_channel_args_copy(resolved_result_);
|
417
|
+
gpr_log(GPR_DEBUG, "AresDnsResolver::MaybeFinishNextLocked()");
|
418
|
+
GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
|
419
|
+
next_completion_ = nullptr;
|
420
|
+
published_version_ = resolved_version_;
|
330
421
|
}
|
331
422
|
}
|
332
423
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
if (r->resolved_result != nullptr) {
|
337
|
-
grpc_channel_args_destroy(r->resolved_result);
|
338
|
-
}
|
339
|
-
grpc_pollset_set_destroy(r->interested_parties);
|
340
|
-
gpr_free(r->dns_server);
|
341
|
-
gpr_free(r->name_to_resolve);
|
342
|
-
gpr_free(r->default_port);
|
343
|
-
grpc_channel_args_destroy(r->channel_args);
|
344
|
-
gpr_free(r);
|
345
|
-
}
|
424
|
+
//
|
425
|
+
// Factory
|
426
|
+
//
|
346
427
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
/* Create resolver. */
|
353
|
-
ares_dns_resolver* r =
|
354
|
-
(ares_dns_resolver*)gpr_zalloc(sizeof(ares_dns_resolver));
|
355
|
-
grpc_resolver_init(&r->base, &dns_ares_resolver_vtable, args->combiner);
|
356
|
-
if (0 != strcmp(args->uri->authority, "")) {
|
357
|
-
r->dns_server = gpr_strdup(args->uri->authority);
|
428
|
+
class AresDnsResolverFactory : public ResolverFactory {
|
429
|
+
public:
|
430
|
+
OrphanablePtr<Resolver> CreateResolver(
|
431
|
+
const ResolverArgs& args) const override {
|
432
|
+
return OrphanablePtr<Resolver>(New<AresDnsResolver>(args));
|
358
433
|
}
|
359
|
-
r->name_to_resolve = gpr_strdup(path);
|
360
|
-
r->default_port = gpr_strdup(default_port);
|
361
|
-
r->channel_args = grpc_channel_args_copy(args->args);
|
362
|
-
const grpc_arg* arg = grpc_channel_args_find(
|
363
|
-
r->channel_args, GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION);
|
364
|
-
r->request_service_config = !grpc_channel_arg_get_integer(
|
365
|
-
arg, (grpc_integer_options){false, false, true});
|
366
|
-
r->interested_parties = grpc_pollset_set_create();
|
367
|
-
if (args->pollset_set != nullptr) {
|
368
|
-
grpc_pollset_set_add_pollset_set(r->interested_parties, args->pollset_set);
|
369
|
-
}
|
370
|
-
grpc_core::BackOff::Options backoff_options;
|
371
|
-
backoff_options
|
372
|
-
.set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS * 1000)
|
373
|
-
.set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
|
374
|
-
.set_jitter(GRPC_DNS_RECONNECT_JITTER)
|
375
|
-
.set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000);
|
376
|
-
r->backoff.Init(grpc_core::BackOff(backoff_options));
|
377
|
-
GRPC_CLOSURE_INIT(&r->dns_ares_on_retry_timer_locked,
|
378
|
-
dns_ares_on_retry_timer_locked, r,
|
379
|
-
grpc_combiner_scheduler(r->base.combiner));
|
380
|
-
GRPC_CLOSURE_INIT(&r->dns_ares_on_resolved_locked,
|
381
|
-
dns_ares_on_resolved_locked, r,
|
382
|
-
grpc_combiner_scheduler(r->base.combiner));
|
383
|
-
return &r->base;
|
384
|
-
}
|
385
|
-
|
386
|
-
/*
|
387
|
-
* FACTORY
|
388
|
-
*/
|
389
434
|
|
390
|
-
|
435
|
+
const char* scheme() const override { return "dns"; }
|
436
|
+
};
|
391
437
|
|
392
|
-
|
438
|
+
} // namespace
|
393
439
|
|
394
|
-
|
395
|
-
grpc_resolver_factory* factory, grpc_resolver_args* args) {
|
396
|
-
return dns_ares_create(args, "https");
|
397
|
-
}
|
398
|
-
|
399
|
-
static char* dns_ares_factory_get_default_host_name(
|
400
|
-
grpc_resolver_factory* factory, grpc_uri* uri) {
|
401
|
-
const char* path = uri->path;
|
402
|
-
if (path[0] == '/') ++path;
|
403
|
-
return gpr_strdup(path);
|
404
|
-
}
|
405
|
-
|
406
|
-
static const grpc_resolver_factory_vtable dns_ares_factory_vtable = {
|
407
|
-
dns_ares_factory_ref, dns_ares_factory_unref, dns_factory_create_resolver,
|
408
|
-
dns_ares_factory_get_default_host_name, "dns"};
|
409
|
-
static grpc_resolver_factory dns_resolver_factory = {&dns_ares_factory_vtable};
|
410
|
-
|
411
|
-
static grpc_resolver_factory* dns_ares_resolver_factory_create() {
|
412
|
-
return &dns_resolver_factory;
|
413
|
-
}
|
440
|
+
} // namespace grpc_core
|
414
441
|
|
415
|
-
void grpc_resolver_dns_ares_init(
|
416
|
-
char*
|
442
|
+
void grpc_resolver_dns_ares_init() {
|
443
|
+
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
|
417
444
|
/* TODO(zyc): Turn on c-ares based resolver by default after the address
|
418
445
|
sorter and the CNAME support are added. */
|
419
|
-
if (
|
446
|
+
if (resolver_env != nullptr && gpr_stricmp(resolver_env, "ares") == 0) {
|
420
447
|
grpc_error* error = grpc_ares_init();
|
421
448
|
if (error != GRPC_ERROR_NONE) {
|
422
449
|
GRPC_LOG_IF_ERROR("ares_library_init() failed", error);
|
423
450
|
return;
|
424
451
|
}
|
425
452
|
grpc_resolve_address = grpc_resolve_address_ares;
|
426
|
-
|
453
|
+
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
|
454
|
+
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
|
455
|
+
grpc_core::New<grpc_core::AresDnsResolverFactory>()));
|
427
456
|
}
|
428
|
-
gpr_free(
|
457
|
+
gpr_free(resolver_env);
|
429
458
|
}
|
430
459
|
|
431
|
-
void grpc_resolver_dns_ares_shutdown(
|
432
|
-
char*
|
433
|
-
if (
|
460
|
+
void grpc_resolver_dns_ares_shutdown() {
|
461
|
+
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
|
462
|
+
if (resolver_env != nullptr && gpr_stricmp(resolver_env, "ares") == 0) {
|
434
463
|
grpc_ares_cleanup();
|
435
464
|
}
|
436
|
-
gpr_free(
|
465
|
+
gpr_free(resolver_env);
|
437
466
|
}
|
438
467
|
|
439
468
|
#else /* GRPC_ARES == 1 && !defined(GRPC_UV) */
|