diff options
Diffstat (limited to 'agent')
-rw-r--r-- | agent/agent.h | 1 | ||||
-rw-r--r-- | agent/cache.c | 20 | ||||
-rw-r--r-- | agent/gpg-agent.c | 3 |
3 files changed, 24 insertions, 0 deletions
diff --git a/agent/agent.h b/agent/agent.h index c2d857959..743b76595 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -450,6 +450,7 @@ int agent_clear_passphrase (ctrl_t ctrl, /*-- cache.c --*/ void initialize_module_cache (void); void deinitialize_module_cache (void); +void agent_cache_housekeeping (void); void agent_flush_cache (void); int agent_put_cache (const char *key, cache_mode_t cache_mode, const char *data, int ttl); diff --git a/agent/cache.c b/agent/cache.c index 80d5f8d1e..ed5c97cd2 100644 --- a/agent/cache.c +++ b/agent/cache.c @@ -259,6 +259,26 @@ housekeeping (void) void +agent_cache_housekeeping (void) +{ + int res; + + if (DBG_CACHE) + log_debug ("agent_cache_housekeeping\n"); + + res = npth_mutex_lock (&cache_lock); + if (res) + log_fatal ("failed to acquire cache mutex: %s\n", strerror (res)); + + housekeeping (); + + res = npth_mutex_unlock (&cache_lock); + if (res) + log_fatal ("failed to release cache mutex: %s\n", strerror (res)); +} + + +void agent_flush_cache (void) { ITEM r; diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index a1964ece8..bd9a471e8 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -2398,6 +2398,9 @@ handle_tick (void) } #endif + /* Need to check for expired cache entries. */ + agent_cache_housekeeping (); + /* Check whether the homedir is still available. */ if (!shutdown_pending && (!have_homedir_inotify || !reliable_homedir_inotify) |