From 553b3801670723429abf5f66420683f6d39a3c72 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 5 Jun 2013 12:50:11 +0100 Subject: [PATCH] Fix fuzzy storage initialization and finalization. --- src/fuzzy_storage.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 105e3b95c..9fd6d056e 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -269,10 +269,13 @@ sigterm_handler (gint fd, short what, void *arg) }; ctx = worker->ctx; + event_del (&worker->sig_ev_usr1); + event_del (&worker->sig_ev_usr2); + event_del (&worker->bind_ev); + close (worker->cf->listen_sock); mods = ctx->max_mods + 1; sync_cache (worker); - close (worker->cf->listen_sock); - (void)event_loopexit (&tv); + (void)event_base_loopexit (ctx->ev_base, &tv); } /* @@ -287,16 +290,17 @@ sigusr2_handler (gint fd, short what, void *arg) struct rspamd_fuzzy_storage_ctx *ctx; ctx = worker->ctx; - tv.tv_sec = SOFT_SHUTDOWN_TIME; + tv.tv_sec = 0; tv.tv_usec = 0; event_del (&worker->sig_ev_usr1); event_del (&worker->sig_ev_usr2); event_del (&worker->bind_ev); close (worker->cf->listen_sock); msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); - event_base_loopexit (ctx->ev_base, &tv); mods = ctx->max_mods + 1; sync_cache (worker); + + event_base_loopexit (ctx->ev_base, &tv); return; } @@ -854,6 +858,7 @@ parse_fuzzy_update_list (struct rspamd_fuzzy_storage_ctx *ctx) } radix32tree_add (ctx->update_ips, htonl (ina.s_addr), mask, 1); } + cur ++; } return (ctx->update_ips != NULL); -- 2.39.5