diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-13 14:59:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-13 14:59:21 +0100 |
commit | 432718d1dcf1c97c2d5cd3381240ecb9c0ac4e3d (patch) | |
tree | a939db3faedd1d187c930fec828c4f9eab73d5b2 /src/libutil | |
parent | 378a1f21a399b364b8f7a8651adfdb4a5ede8973 (diff) | |
download | rspamd-432718d1dcf1c97c2d5cd3381240ecb9c0ac4e3d.tar.gz rspamd-432718d1dcf1c97c2d5cd3381240ecb9c0ac4e3d.zip |
[Fix] Fix HTTP maps updates
Issue: #2286
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/map.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c index 2873b76f6..f666ad98d 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -344,9 +344,13 @@ rspamd_map_cache_cb (gint fd, short what, gpointer ud) if (cache_cbd->gen != cache_cbd->data->gen) { /* We have another update, so this cache element is obviously expired */ - /* Important: we do not set cache availability to zero here */ + /* + * Important!: we do not set cache availability to zero here, as there + * might be fresh cache + */ + msg_info_map ("cached data is now expired (gen mismatch %L != %L) for %s", + cache_cbd->gen, cache_cbd->data->gen, map->name); MAP_RELEASE (cache_cbd->shm, "rspamd_http_map_cached_cbdata"); - msg_info_map ("cached data is now expired (gen mismatch) for %s", map->name); event_del (&cache_cbd->timeout); g_free (cache_cbd); } @@ -447,6 +451,9 @@ http_map_finish (struct rspamd_http_connection *conn, cbd->periodic->need_modify = TRUE; /* Reset the whole chain */ cbd->periodic->cur_backend = 0; + /* Reset cache, old cached data will be cleaned on timeout */ + g_atomic_int_set (&map->cache->available, 0); + rspamd_map_periodic_callback (-1, EV_TIMEOUT, cbd->periodic); MAP_RELEASE (cbd, "http_callback_data"); |