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.
This commit is contained in:
Nick Mathewson 2010-02-05 01:16:23 -05:00
parent 6810bdb101
commit 1dd7e6dc3a
4 changed files with 16 additions and 17 deletions

View File

@ -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

View File

@ -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);
/**

View File

@ -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);

View File

@ -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]);