diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/database.c | 14 | ||||
-rw-r--r-- | src/lists.c | 4 | ||||
-rw-r--r-- | src/shared.h | 1 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/database.c b/src/database.c index 7e4de95..886c9a4 100644 --- a/src/database.c +++ b/src/database.c @@ -93,3 +93,17 @@ void db_destroy(void) pthread_mutex_unlock(&database_mutex); } + +void db_invalidate_cached_results(void) +{ + size_t i; + db_entry *entry; + + pthread_mutex_lock(&database_mutex); + + for (i = 0; i < HASH_MAX; i++) + eli_for(entry, database[i], ht_chain) + entry->cached_result_valid = false; + + pthread_mutex_unlock(&database_mutex); +} diff --git a/src/lists.c b/src/lists.c index 98ba866..8eb0d5e 100644 --- a/src/lists.c +++ b/src/lists.c @@ -151,9 +151,9 @@ int lists_reload(const char *file) ret = lists_load(file, 0); if (!ret) lists_destroy(); - pthread_mutex_unlock(&entry_list_mutex); - // FIXME: invalidate all cached results + db_invalidate_cached_results(); + pthread_mutex_unlock(&entry_list_mutex); return ret; } diff --git a/src/shared.h b/src/shared.h index 13fd791..187edcc 100644 --- a/src/shared.h +++ b/src/shared.h @@ -87,6 +87,7 @@ typedef struct { db_entry *db_find(uint32_t ipv4); void db_destroy(void); +void db_invalidate_cached_results(void); // worker.c |