resolved: cache - use clock_boottime_or_monotonic()
We cannot rely on CLOCK_BOOTTIME being supported by the kernel, so fallack to CLOCK_MONOTONIC if the former is not supported.
This commit is contained in:
parent
b04d9f2871
commit
240b589b14
|
@ -152,7 +152,7 @@ void dns_cache_prune(DnsCache *c) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
t = now(CLOCK_BOOTTIME);
|
t = now(clock_boottime_or_monotonic());
|
||||||
|
|
||||||
if (i->until > t)
|
if (i->until > t)
|
||||||
break;
|
break;
|
||||||
|
@ -406,7 +406,7 @@ int dns_cache_put(
|
||||||
dns_cache_make_space(c, answer->n_rrs + q->n_keys);
|
dns_cache_make_space(c, answer->n_rrs + q->n_keys);
|
||||||
|
|
||||||
if (timestamp <= 0)
|
if (timestamp <= 0)
|
||||||
timestamp = now(CLOCK_BOOTTIME);
|
timestamp = now(clock_boottime_or_monotonic());
|
||||||
|
|
||||||
/* Second, add in positive entries for all contained RRs */
|
/* Second, add in positive entries for all contained RRs */
|
||||||
for (i = 0; i < MIN(max_rrs, answer->n_rrs); i++) {
|
for (i = 0; i < MIN(max_rrs, answer->n_rrs); i++) {
|
||||||
|
|
Loading…
Reference in a new issue