]> granicus.if.org Git - libevent/commitdiff
Remove the 'flags' argument from evdns_base_set_option()
authorNick Mathewson <nickm@torproject.org>
Fri, 5 Feb 2010 06:16:23 +0000 (01:16 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 5 Feb 2010 18:55:12 +0000 (13:55 -0500)
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.

evdns.c
include/event2/dns.h
include/event2/dns_compat.h
test/regress_dns.c

diff --git a/evdns.c b/evdns.c
index 8b22eba206d1e515007ddd25f7311d4041e5b122..d18d64c9efb590a56f278703d6e480fc79484cb3 100644 (file)
--- 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
index fb3bb681669d6d800ef27edc55849a1de4554041..392d64596c763d0d7d878a188d4c9f8cf27ae0f3 100644 (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);
 
 
 /**
index d9d2a255c32021e1fef4ff24344bc96f0ace72ab..6f33e81ea69e6c7552e6b3ccc8a94a9f488750ea 100644 (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);
index 1430879993b6cb252565986cb3892e291aa893de..9a8d473522e2e928ce79c3417192cc9f8fee9ab5 100644 (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]);