|
|
|
@ -95,7 +95,7 @@ namespace { |
|
|
|
|
class AresClientChannelDNSResolver : public PollingResolver { |
|
|
|
|
public: |
|
|
|
|
AresClientChannelDNSResolver(ResolverArgs args, |
|
|
|
|
const ChannelArgs& channel_args); |
|
|
|
|
Duration min_time_between_resolutions); |
|
|
|
|
|
|
|
|
|
OrphanablePtr<Orphanable> StartRequest() override; |
|
|
|
|
|
|
|
|
@ -205,14 +205,8 @@ class AresClientChannelDNSResolver : public PollingResolver { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
AresClientChannelDNSResolver::AresClientChannelDNSResolver( |
|
|
|
|
ResolverArgs args, const ChannelArgs& channel_args) |
|
|
|
|
: PollingResolver( |
|
|
|
|
std::move(args), channel_args, |
|
|
|
|
std::max(Duration::Zero(), |
|
|
|
|
channel_args |
|
|
|
|
.GetDurationFromIntMillis( |
|
|
|
|
GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS) |
|
|
|
|
.value_or(Duration::Seconds(30))), |
|
|
|
|
ResolverArgs args, Duration min_time_between_resolutions) |
|
|
|
|
: PollingResolver(std::move(args), min_time_between_resolutions, |
|
|
|
|
BackOff::Options() |
|
|
|
|
.set_initial_backoff(Duration::Milliseconds( |
|
|
|
|
GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS * 1000)) |
|
|
|
@ -222,12 +216,15 @@ AresClientChannelDNSResolver::AresClientChannelDNSResolver( |
|
|
|
|
GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)), |
|
|
|
|
&grpc_trace_cares_resolver), |
|
|
|
|
request_service_config_( |
|
|
|
|
!channel_args.GetBool(GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION) |
|
|
|
|
!channel_args() |
|
|
|
|
.GetBool(GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION) |
|
|
|
|
.value_or(true)), |
|
|
|
|
enable_srv_queries_(channel_args.GetBool(GRPC_ARG_DNS_ENABLE_SRV_QUERIES) |
|
|
|
|
enable_srv_queries_(channel_args() |
|
|
|
|
.GetBool(GRPC_ARG_DNS_ENABLE_SRV_QUERIES) |
|
|
|
|
.value_or(false)), |
|
|
|
|
query_timeout_ms_( |
|
|
|
|
std::max(0, channel_args.GetInt(GRPC_ARG_DNS_ARES_QUERY_TIMEOUT_MS) |
|
|
|
|
std::max(0, channel_args() |
|
|
|
|
.GetInt(GRPC_ARG_DNS_ARES_QUERY_TIMEOUT_MS) |
|
|
|
|
.value_or(GRPC_DNS_ARES_DEFAULT_QUERY_TIMEOUT_MS))) {} |
|
|
|
|
|
|
|
|
|
AresClientChannelDNSResolver::~AresClientChannelDNSResolver() { |
|
|
|
@ -460,9 +457,13 @@ class AresClientChannelDNSResolverFactory : public ResolverFactory { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override { |
|
|
|
|
ChannelArgs channel_args = args.args; |
|
|
|
|
return MakeOrphanable<AresClientChannelDNSResolver>(std::move(args), |
|
|
|
|
channel_args); |
|
|
|
|
Duration min_time_between_resolutions = std::max( |
|
|
|
|
Duration::Zero(), args.args |
|
|
|
|
.GetDurationFromIntMillis( |
|
|
|
|
GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS) |
|
|
|
|
.value_or(Duration::Seconds(30))); |
|
|
|
|
return MakeOrphanable<AresClientChannelDNSResolver>( |
|
|
|
|
std::move(args), min_time_between_resolutions); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|