3405. [bug] Handle time going backwards in acache. [RT #31253]

Squashed commit of the following:

commit fbf4c8fe2644c101bac870360d3f2c159a90f203
Author: Mark Andrews <marka@isc.org>
Date:   Wed Oct 24 14:43:14 2012 +1100

    remove INSIST and handle time going backwards
This commit is contained in:
Mark Andrews
2012-10-25 14:29:52 +11:00
parent fba2f76af0
commit 069ea15204
2 changed files with 13 additions and 4 deletions
+2
View File
@@ -1,3 +1,5 @@
3405. [bug] Handle time going backwards in acache. [RT #31253]
3404. [bug] dnssec-signzone: When re-signing a zone, remove
RRSIG and NSEC records from nodes that used to be
in-zone but are now below a zone cut. [RT #31556]
+11 -4
View File
@@ -27,6 +27,7 @@
#include <isc/random.h>
#include <isc/refcount.h>
#include <isc/rwlock.h>
#include <isc/serial.h>
#include <isc/task.h>
#include <isc/time.h>
#include <isc/timer.h>
@@ -776,10 +777,14 @@ entry_stale(acache_cleaner_t *cleaner, dns_acacheentry_t *entry,
* use and the cleaning interval.
*/
if (cleaner->overmem) {
unsigned int passed =
now32 - entry->lastused; /* <= interval */
unsigned int passed;
isc_uint32_t val;
if (isc_serial_ge(now32, entry->lastused))
passed = now32 - entry->lastused; /* <= interval */
else
passed = 0;
if (passed > interval / 2)
return (ISC_TRUE);
isc_random_get(&val);
@@ -825,8 +830,10 @@ acache_incremental_cleaning_action(isc_task_t *task, isc_event_t *event) {
entry = cleaner->current_entry;
isc_stdtime_convert32(cleaner->last_cleanup_time, &last32);
INSIST(now32 > last32);
interval = now32 - last32;
if (isc_serial_ge(now32, last32))
interval = now32 - last32;
else
interval = 0;
while (n_entries-- > 0) {
isc_boolean_t is_stale = ISC_FALSE;