From: Nick Mathewson Date: Fri, 5 Feb 2010 06:16:23 +0000 (-0500) Subject: Remove the 'flags' argument from evdns_base_set_option() X-Git-Tag: release-2.0.4-alpha~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1dd7e6dc3aeff29f9de44678d2aeea3bb82e4f24;p=libevent Remove the 'flags' argument from evdns_base_set_option() The 'flags' argument made sense when passed to evdns_(base_)?parse_resolv_conf when it said which parts of the resolv.conf file to obey. But for evdns_set_option(), it was really silly, since you wouldn't be calling evdns_set_option() unless you actually wanted to set the option. Its meaning was basically, "set this to DNS_OPTIONS_ALL unless you want a funny surprise." evdns_base_set_option was new in 2.0.1-alpha, so we aren't committed to keeping it source-compatible. --- diff --git a/evdns.c b/evdns.c index 8b22eba2..d18d64c9 100644 --- a/evdns.c +++ b/evdns.c @@ -3236,11 +3236,11 @@ evdns_base_set_max_requests_inflight(struct evdns_base *base, int maxinflight) /* exported function */ int evdns_base_set_option(struct evdns_base *base, - const char *option, const char *val, int flags) + const char *option, const char *val) { int res; EVDNS_LOCK(base); - res = evdns_base_set_option_impl(base, option, val, flags); + res = evdns_base_set_option_impl(base, option, val, DNS_OPTIONS_ALL); EVDNS_UNLOCK(base); return res; } @@ -3341,7 +3341,7 @@ evdns_set_option(const char *option, const char *val, int flags) { if (!current_base) current_base = evdns_base_new(NULL, 0); - return evdns_base_set_option(current_base, option, val, flags); + return evdns_base_set_option(current_base, option, val); } static void @@ -3378,7 +3378,7 @@ resolv_conf_parse_line(struct evdns_base *base, char *const start, int flags) { const char *option; while ((option = NEXT_TOKEN)) { const char *val = strchr(option, ':'); - evdns_base_set_option(base, option, val ? val+1 : "", flags); + evdns_base_set_option_impl(base, option, val ? val+1 : "", flags); } } #undef NEXT_TOKEN diff --git a/include/event2/dns.h b/include/event2/dns.h index fb3bb681..392d6459 100644 --- a/include/event2/dns.h +++ b/include/event2/dns.h @@ -410,10 +410,9 @@ void evdns_cancel_request(struct evdns_base *base, struct evdns_request *req); @param base the evdns_base to which to apply this operation @param option the name of the configuration option to be modified @param val the value to be set - @param flags either 0 | DNS_OPTION_SEARCH | DNS_OPTION_MISC @return 0 if successful, or -1 if an error occurred */ -int evdns_base_set_option(struct evdns_base *base, const char *option, const char *val, int flags); +int evdns_base_set_option(struct evdns_base *base, const char *option, const char *val); /** diff --git a/include/event2/dns_compat.h b/include/event2/dns_compat.h index d9d2a255..6f33e81e 100644 --- a/include/event2/dns_compat.h +++ b/include/event2/dns_compat.h @@ -247,7 +247,7 @@ int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callb @param option the name of the configuration option to be modified @param val the value to be set - @param flags either 0 | DNS_OPTION_SEARCH | DNS_OPTION_MISC + @param flags Ignored. @return 0 if successful, or -1 if an error occurred */ int evdns_set_option(const char *option, const char *val, int flags); diff --git a/test/regress_dns.c b/test/regress_dns.c index 14308799..9a8d4735 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -584,9 +584,9 @@ dns_retry_test(void *arg) dns = evdns_base_new(base, 0); tt_assert(!evdns_base_nameserver_ip_add(dns, "127.0.0.1:53900")); - tt_assert(! evdns_base_set_option(dns, "timeout", "0.3", DNS_OPTIONS_ALL)); - tt_assert(! evdns_base_set_option(dns, "max-timeouts:", "10", DNS_OPTIONS_ALL)); - tt_assert(! evdns_base_set_option(dns, "initial-probe-timeout", "0.5", DNS_OPTIONS_ALL)); + tt_assert(! evdns_base_set_option(dns, "timeout", "0.3")); + tt_assert(! evdns_base_set_option(dns, "max-timeouts:", "10")); + tt_assert(! evdns_base_set_option(dns, "initial-probe-timeout", "0.5")); evdns_base_resolve_ipv4(dns, "host.example.com", 0, generic_dns_callback, &r1); @@ -605,8 +605,8 @@ dns_retry_test(void *arg) /* Now try again, but this time have the server get treated as * failed, so we can send it a test probe. */ drop_count = 4; - tt_assert(! evdns_base_set_option(dns, "max-timeouts:", "3", DNS_OPTIONS_ALL)); - tt_assert(! evdns_base_set_option(dns, "attempts:", "4", DNS_OPTIONS_ALL)); + tt_assert(! evdns_base_set_option(dns, "max-timeouts:", "3")); + tt_assert(! evdns_base_set_option(dns, "attempts:", "4")); memset(&r1, 0, sizeof(r1)); evdns_base_resolve_ipv4(dns, "host.example.com", 0, @@ -672,9 +672,9 @@ dns_reissue_test(void *arg) dns = evdns_base_new(base, 0); tt_assert(!evdns_base_nameserver_ip_add(dns, "127.0.0.1:53900")); - tt_assert(! evdns_base_set_option(dns, "timeout:", "0.3", DNS_OPTIONS_ALL)); - tt_assert(! evdns_base_set_option(dns, "max-timeouts:", "2", DNS_OPTIONS_ALL)); - tt_assert(! evdns_base_set_option(dns, "attempts:", "5", DNS_OPTIONS_ALL)); + tt_assert(! evdns_base_set_option(dns, "timeout:", "0.3")); + tt_assert(! evdns_base_set_option(dns, "max-timeouts:", "2")); + tt_assert(! evdns_base_set_option(dns, "attempts:", "5")); memset(&r1, 0, sizeof(r1)); evdns_base_resolve_ipv4(dns, "foof.example.com", 0, @@ -733,8 +733,8 @@ dns_inflight_test(void *arg) dns = evdns_base_new(base, 0); tt_assert(!evdns_base_nameserver_ip_add(dns, "127.0.0.1:53900")); - tt_assert(! evdns_base_set_option(dns, "max-inflight:", "3", DNS_OPTIONS_ALL)); - tt_assert(! evdns_base_set_option(dns, "randomize-case:", "0", DNS_OPTIONS_ALL)); + tt_assert(! evdns_base_set_option(dns, "max-inflight:", "3")); + tt_assert(! evdns_base_set_option(dns, "randomize-case:", "0")); for(i=0;i<20;++i) evdns_base_resolve_ipv4(dns, "foof.example.com", 0, generic_dns_callback, &r[i]);