break;
case ISC_R_SUCCESS:
LOCK(&adbname->lock); /* Must be unlocked by the caller */
- if (adbname->last_used + ADB_STALE_MARGIN <= last_update) {
+ if (adbname->last_used + ADB_CACHE_MINIMUM <= last_update) {
adbname->last_used = now;
ISC_LIST_UNLINK(adb->names_lru, adbname, link);
dns_adbentry_detach(&adbentry);
goto create;
}
- if (adbentry->last_used + ADB_STALE_MARGIN <= last_update) {
+ if (adbentry->last_used + ADB_CACHE_MINIMUM <= last_update) {
adbentry->last_used = now;
ISC_LIST_UNLINK(adb->entries_lru, adbentry, link);
goto next;
}
+ /*
+ * Make sure that we are not purging ADB names that has been
+ * just created.
+ */
+ if (adbname->last_used + ADB_CACHE_MINIMUM >= now) {
+ prev = NULL;
+ goto next;
+ }
+
if (overmem) {
expire_name(adbname, DNS_EVENT_ADBCANCELED, now);
removed++;
if (adbname->last_used + ADB_STALE_MARGIN < now) {
expire_name(adbname, DNS_EVENT_ADBCANCELED, now);
removed++;
+ goto next;
}
/*
- * we won't expire anything on the LRU list as the
+ * We won't expire anything on the LRU list as the
* .last_used + ADB_STALE_MARGIN will always be bigger
* than `now` for all previous entries, so we just stop
- * the scanning
+ * the scanning.
*/
prev = NULL;
next:
goto next;
}
+ /*
+ * Make sure that we are not purging ADB named that has been
+ * just created.
+ */
+ if (adbentry->last_used + ADB_CACHE_MINIMUM >= now) {
+ prev = NULL;
+ goto next;
+ }
+
if (overmem) {
maybe_expire_entry(adbentry, INT_MAX);
removed++;
}
/*
- * we won't expire anything on the LRU list as the
+ * We won't expire anything on the LRU list as the
* .last_used + ADB_STALE_MARGIN will always be bigger
* than `now` for all previous entries, so we just stop
* the scanning