]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Cache zones once we've looked them up, so that we don't do a bazillion
authorTed Lemon <source@isc.org>
Thu, 12 Oct 2000 09:04:24 +0000 (09:04 +0000)
committerTed Lemon <source@isc.org>
Thu, 12 Oct 2000 09:04:24 +0000 (09:04 +0000)
  queries for each update.

minires/res_findzonecut.c

index 48800d1cf6e37d0ea621385d306a2fc444ba4e5a..aae8b23654844135ddbc30cbec5db9bc7a568b9f 100644 (file)
@@ -1,5 +1,5 @@
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_findzonecut.c,v 1.9 2000/07/17 20:51:11 mellon Exp $";
+static const char rcsid[] = "$Id: res_findzonecut.c,v 1.10 2000/10/12 09:04:24 mellon Exp $";
 #endif /* not lint */
 
 /*
@@ -175,6 +175,9 @@ res_findzonecut(res_state statp, const char *dname, ns_class class, int opts,
        if ((rcode = get_glue(statp, class, &nsrrs)) == ns_r_noerror)
                n = satisfy(statp, mname, &nsrrs, addrs, naddrs);
 
+       /* If we found the zone, cache it. */
+       if (n > 0)
+               cache_found_zone (class, zname, addrs, n);
  done:
        DPRINTF(("FINISH n=%d (%s)", n, (n < 0) ? strerror(errno) : "OK"));
        free_nsrrset(&nsrrs);
@@ -262,7 +265,7 @@ get_soa(res_state statp, const char *dname, ns_class class,
                /* Is there an SOA? */
                rcode = do_query(statp, dname, class, ns_t_soa,
                                 resp, &msg, &n);
-               if (rcode != ns_r_noerror) {
+               if (n < 0) {
                        DPRINTF(("get_soa: do_query('%s', %s) failed (%d)",
                                 dname, p_class(class), n));
                        return rcode;