aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/resolver/dns/native
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2016-11-18 01:06:57 -0800
committerGravatar Yuchen Zeng <zyc@google.com>2016-11-18 01:17:10 -0800
commit9e4c8eb8e84123d275bc72f048c96cb1f8ce5acc (patch)
tree3b846436bf39d952977c3367003a96a28499ee02 /src/core/ext/resolver/dns/native
parent224870ec5ee836a07bb301713973fb536db0040d (diff)
Address review comments
Diffstat (limited to 'src/core/ext/resolver/dns/native')
-rw-r--r--src/core/ext/resolver/dns/native/dns_resolver.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c
index 7cbd6ce95c..a3b4d5b9af 100644
--- a/src/core/ext/resolver/dns/native/dns_resolver.c
+++ b/src/core/ext/resolver/dns/native/dns_resolver.c
@@ -310,6 +310,15 @@ void grpc_resolver_dns_native_init(void) {
if (resolver != NULL && gpr_stricmp(resolver, "native") == 0) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
grpc_register_resolver_type(dns_resolver_factory_create());
+ } else {
+ grpc_resolver_factory *existing_factory =
+ grpc_resolver_factory_lookup("dns");
+ if (existing_factory == NULL) {
+ gpr_log(GPR_DEBUG, "Using native dns resolver");
+ grpc_register_resolver_type(dns_resolver_factory_create());
+ } else {
+ grpc_resolver_factory_unref(existing_factory);
+ }
}
gpr_free(resolver);
}