Skip to content

Commit

Permalink
dnscache: use timeutils/cache.c instead of iv_now
Browse files Browse the repository at this point in the history
Otherwise we had a lot of clock_gettime() calls.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
  • Loading branch information
bazsi committed Dec 1, 2024
1 parent 1a2b4f9 commit 79cf9b4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/dnscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ dns_cache_store(DNSCache *self, gboolean persistent, gint family, void *addr, co
INIT_IV_LIST_HEAD(&entry->list);
if (!persistent)
{
entry->resolved = iv_now.tv_sec;
entry->resolved = get_cached_realtime_sec();
iv_list_add(&entry->list, &self->cache_list);
}
else
Expand Down Expand Up @@ -304,8 +304,7 @@ dns_cache_lookup(DNSCache *self, gint family, void *addr, const gchar **hostname
DNSCacheEntry *entry;
time_t now;

iv_validate_now();
now = iv_now.tv_sec;
now = get_cached_realtime_sec();
dns_cache_check_hosts(self, now);

dns_cache_fill_key(&key, family, addr);
Expand Down

0 comments on commit 79cf9b4

Please sign in to comment.