From a5189eefa5c17654ebeab77ed1ff8746bcc9d99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Sun, 13 Oct 2019 16:33:22 +0200 Subject: [PATCH] lib/dns/resolver.c: Call dns_adb_endudpfetch() only for UDP queries The dns_adb_beginudpfetch() is called only for UDP queries, but the dns_adb_endudpfetch() is called for all queries, including TCP. This messages the quota counting in adb.c. --- lib/dns/resolver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 70bfa2232a..a1fca4701d 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -1278,7 +1278,10 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, dns_adb_adjustsrtt(fctx->adb, query->addrinfo, rtt, factor); } - dns_adb_endudpfetch(fctx->adb, query->addrinfo); + if ((query->options & DNS_FETCHOPT_TCP) == 0) { + /* Inform the ADB that we're ending a UDP fetch */ + dns_adb_endudpfetch(fctx->adb, query->addrinfo); + } /* * Age RTTs of servers not tried. @@ -2136,7 +2139,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, if (dns_adbentry_overquota(addrinfo->entry)) goto cleanup_dispatch; - /* Inform the ADB that we're starting a fetch */ + /* Inform the ADB that we're starting a UDP fetch */ dns_adb_beginudpfetch(fctx->adb, addrinfo); result = resquery_send(query);