]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4438. [func] Use LIFO rather than FIFO when processing startup
authorMark Andrews <marka@isc.org>
Fri, 12 Aug 2016 01:33:48 +0000 (11:33 +1000)
committerMark Andrews <marka@isc.org>
Fri, 12 Aug 2016 01:33:48 +0000 (11:33 +1000)
                        notify and refresh queries. [RT #42825]

CHANGES
lib/dns/zone.c
lib/isc/include/isc/ratelimiter.h
lib/isc/ratelimiter.c

diff --git a/CHANGES b/CHANGES
index bafd2e405ec69d5d7166efb76e93794bd4d7f8d1..c177a44dd57efd3daaf891030b5aaf0a59866a0e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4438.  [func]          Use LIFO rather than FIFO when processing startup
+                       notify and refresh queries. [RT #42825]
+
 4437.  [func]          Minimal-responses now has two additional modes
                        no-auth and no-auth-recursive which suppress
                        adding the NS records to the authority section
index a12a1eb599a4023a9a0ea90113c79ff93f1a2334..d59e719eeff723b83d4e54688635eccc9d7e9dfe 100644 (file)
@@ -15567,6 +15567,8 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
        setrl(zmgr->startupnotifyrl, &zmgr->startupnotifyrate, 20);
        setrl(zmgr->refreshrl, &zmgr->serialqueryrate, 20);
        setrl(zmgr->startuprefreshrl, &zmgr->startupserialqueryrate, 20);
+       isc_ratelimiter_setpushpop(zmgr->startupnotifyrl, ISC_TRUE);
+       isc_ratelimiter_setpushpop(zmgr->startuprefreshrl, ISC_TRUE);
 
        zmgr->iolimit = 1;
        zmgr->ioactive = 0;
index c44a367fb812d289134a74118c01dacec31af3fc..9cc4111142a8f222552d94a58d98afb87768bd0c 100644 (file)
@@ -58,6 +58,13 @@ isc_ratelimiter_setpertic(isc_ratelimiter_t *rl, isc_uint32_t perint);
  * If 'perint' is zero it is treated as 1.
  */
 
+void
+isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, isc_boolean_t pushpop);
+/*%<
+ * Set / clear the ratelimiter to from push pop mode rather
+ * first in - first out mode (default).
+ */
+
 isc_result_t
 isc_ratelimiter_enqueue(isc_ratelimiter_t *rl, isc_task_t *task,
                        isc_event_t **eventp);
index 8327f484c09cd93f8bfc5ca1c0aa7f571c6f62f3..f78b93018fa677be0fec4b573289260df6a285c1 100644 (file)
@@ -34,6 +34,7 @@ struct isc_ratelimiter {
        isc_timer_t *           timer;
        isc_interval_t          interval;
        isc_uint32_t            pertic;
+       isc_boolean_t           pushpop;
        isc_ratelimiter_state_t state;
        isc_event_t             shutdownevent;
        ISC_LIST(isc_event_t)   pending;
@@ -64,6 +65,7 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr,
        isc_interval_set(&rl->interval, 0, 0);
        rl->timer = NULL;
        rl->pertic = 1;
+       rl->pushpop = ISC_FALSE;
        rl->state = isc_ratelimiter_idle;
        ISC_LIST_INIT(rl->pending);
 
@@ -128,6 +130,14 @@ isc_ratelimiter_setpertic(isc_ratelimiter_t *rl, isc_uint32_t pertic) {
        rl->pertic = pertic;
 }
 
+void
+isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, isc_boolean_t pushpop) {
+
+       REQUIRE(rl != NULL);
+
+       rl->pushpop = pushpop;
+}
+
 isc_result_t
 isc_ratelimiter_enqueue(isc_ratelimiter_t *rl, isc_task_t *task,
                        isc_event_t **eventp)
@@ -146,7 +156,10 @@ isc_ratelimiter_enqueue(isc_ratelimiter_t *rl, isc_task_t *task,
            rl->state == isc_ratelimiter_stalled) {
                ev->ev_sender = task;
                *eventp = NULL;
-               ISC_LIST_APPEND(rl->pending, ev, ev_link);
+               if (rl->pushpop)
+                       ISC_LIST_PREPEND(rl->pending, ev, ev_link);
+               else
+                       ISC_LIST_APPEND(rl->pending, ev, ev_link);
        } else if (rl->state == isc_ratelimiter_idle) {
                result = isc_timer_reset(rl->timer, isc_timertype_ticker, NULL,
                                         &rl->interval, ISC_FALSE);