diff --git a/CHANGES b/CHANGES index 855a1cd563..bccc50ecc5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2541. [bug] Conditionally update dispatch manager statistics. + [RT #19247] + 2539. [security] Update the interaction between recursion, allow-query, allow-query-cache and allow-recursion. [RT #19198] diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index d376340369..f1557ec2cb 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dispatch.c,v 1.137.128.23 2009/01/29 22:41:44 jinmei Exp $ */ +/* $Id: dispatch.c,v 1.137.128.24 2009/01/31 00:44:43 marka Exp $ */ /*! \file */ @@ -333,6 +333,12 @@ mgr_log(dns_dispatchmgr_t *mgr, int level, const char *fmt, ...) { level, "dispatchmgr %p: %s", mgr, msgbuf); } +static inline void +inc_stats(dns_dispatchmgr_t *mgr, isc_statscounter_t counter) { + if (mgr->stats != NULL) + isc_stats_increment(mgr->stats, counter); +} + static void dispatch_log(dns_dispatch_t *disp, int level, const char *fmt, ...) ISC_FORMAT_PRINTF(3, 4); @@ -1164,8 +1170,7 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { bucket, (resp == NULL ? "not found" : "found")); if (resp == NULL) { - isc_stats_increment(mgr->stats, - dns_resstatscounter_mismatch); + inc_stats(mgr, dns_resstatscounter_mismatch); free_buffer(disp, ev->region.base, ev->region.length); goto unlock; } @@ -1173,7 +1178,7 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { &resp->host)) { dispatch_log(disp, LVL(90), "response to an exclusive socket doesn't match"); - isc_stats_increment(mgr->stats, dns_resstatscounter_mismatch); + inc_stats(mgr, dns_resstatscounter_mismatch); free_buffer(disp, ev->region.base, ev->region.length); goto unlock; } @@ -2857,8 +2862,8 @@ dns_dispatch_addresponse2(dns_dispatch_t *disp, isc_sockaddr_t *dest, oldestresp->item_out = ISC_TRUE; isc_task_send(oldestresp->task, ISC_EVENT_PTR(&rev)); - isc_stats_increment(disp->mgr->stats, - dns_resstatscounter_dispabort); + inc_stats(disp->mgr, + dns_resstatscounter_dispabort); } } @@ -2882,8 +2887,7 @@ dns_dispatch_addresponse2(dns_dispatch_t *disp, isc_sockaddr_t *dest, if (result != ISC_R_SUCCESS) { UNLOCK(&qid->lock); UNLOCK(&disp->lock); - isc_stats_increment(disp->mgr->stats, - dns_resstatscounter_dispsockfail); + inc_stats(disp->mgr, dns_resstatscounter_dispsockfail); return (result); } } else {