From 8c694b5e2b85dd13f437a76de5aba5200daef5a1 Mon Sep 17 00:00:00 2001 From: Richard Fuchs <rfuchs@sipwise.com> Date: Mon, 14 Apr 2025 16:30:07 -0400 Subject: [PATCH] MT#55283 convert cookie_cache to int64_t Change-Id: If94cc69d180a0a17b0973a30800e0770d7d8f413 --- daemon/cookie_cache.c | 6 +++--- include/cookie_cache.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon/cookie_cache.c b/daemon/cookie_cache.c index 28dc02806..69b874e11 100644 --- a/daemon/cookie_cache.c +++ b/daemon/cookie_cache.c @@ -22,20 +22,20 @@ INLINE void cookie_cache_state_cleanup(struct cookie_cache_state *s) { void cookie_cache_init(struct cookie_cache *c) { cookie_cache_state_init(&c->current); cookie_cache_state_init(&c->old); - c->swap_time = timeval_from_us(rtpe_now).tv_sec; + c->swap_time_us = rtpe_now; mutex_init(&c->lock); cond_init(&c->cond); } /* lock must be held */ static void __cookie_cache_check_swap(struct cookie_cache *c) { - if (timeval_from_us(rtpe_now).tv_sec - c->swap_time >= 30) { + if (timeval_from_us(rtpe_now).tv_sec - timeval_from_us(c->swap_time_us).tv_sec >= 30) { g_hash_table_remove_all(c->old.cookies); bencode_buffer_free(&c->old.buffer); swap_ptrs(&c->old.cookies, &c->current.cookies); c->old.buffer = c->current.buffer; bencode_buffer_init(&c->current.buffer); - c->swap_time = timeval_from_us(rtpe_now).tv_sec; + c->swap_time_us = rtpe_now; } } diff --git a/include/cookie_cache.h b/include/cookie_cache.h index e32483bb2..5e6e9eb45 100644 --- a/include/cookie_cache.h +++ b/include/cookie_cache.h @@ -43,7 +43,7 @@ struct cookie_cache { mutex_t lock; cond_t cond; struct cookie_cache_state current, old; - time_t swap_time; + int64_t swap_time_us; }; void cookie_cache_init(struct cookie_cache *);