diff --git a/CHANGES b/CHANGES index 594763bf98..a6aebc2d2b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2541. [bug] Conditionally update dispatch manager statistics. + [RT #19247] + 2540. [func] Add a nibble mode to $GENERATE. [RT #18872] 2539. [security] Update the interaction between recursion, allow-query, diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 7b32a71d98..e620fe5df3 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dispatch.c,v 1.160 2009/01/27 22:29:59 jinmei Exp $ */ +/* $Id: dispatch.c,v 1.161 2009/01/31 00:10:24 marka Exp $ */ /*! \file */ @@ -354,6 +354,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, dns_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); @@ -1263,8 +1269,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; } @@ -1272,7 +1277,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; } @@ -2986,8 +2991,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); } } @@ -3011,8 +3016,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 {