From: Ted Lemon Date: Thu, 12 Oct 2000 09:04:24 +0000 (+0000) Subject: - Cache zones once we've looked them up, so that we don't do a bazillion X-Git-Tag: V3-BETA-2-PATCH-7~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8bc9d318d5c32a299fc6711c74466fbd41307c7;p=thirdparty%2Fdhcp.git - Cache zones once we've looked them up, so that we don't do a bazillion queries for each update. --- diff --git a/minires/res_findzonecut.c b/minires/res_findzonecut.c index 48800d1cf..aae8b2365 100644 --- a/minires/res_findzonecut.c +++ b/minires/res_findzonecut.c @@ -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;