aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/stat_config.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-06 16:19:48 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-06 16:19:48 +0000
commitb9ed71b1badf535aa989f056da56ccf8ed187b76 (patch)
tree7a398efed96ce3ffbd8a0c8f873340c53a292e30 /src/libstat/stat_config.c
parent4b0615f1d6983ef1c9e3c292c4608d3f37df2172 (diff)
downloadrspamd-b9ed71b1badf535aa989f056da56ccf8ed187b76.tar.gz
rspamd-b9ed71b1badf535aa989f056da56ccf8ed187b76.zip
Add preliminary support of async events in libstat
Diffstat (limited to 'src/libstat/stat_config.c')
-rw-r--r--src/libstat/stat_config.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c
index 1646ce3b7..ac4d70fc8 100644
--- a/src/libstat/stat_config.c
+++ b/src/libstat/stat_config.c
@@ -110,6 +110,7 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base)
stat_ctx->cfg = cfg;
stat_ctx->statfiles = g_ptr_array_new ();
stat_ctx->classifiers = g_ptr_array_new ();
+ stat_ctx->async_elts = g_queue_new ();
stat_ctx->ev_base = ev_base;
REF_RETAIN (stat_ctx->cfg);
@@ -197,6 +198,8 @@ rspamd_stat_close (void)
struct rspamd_classifier *cl;
struct rspamd_statfile *st;
struct rspamd_stat_ctx *st_ctx;
+ struct rspamd_stat_async_elt *aelt;
+ GList *cur;
guint i, j;
gint id;
@@ -218,6 +221,19 @@ rspamd_stat_close (void)
g_slice_free1 (sizeof (*cl), cl);
}
+ cur = st_ctx->async_elts->head;
+
+ while (cur) {
+ aelt = cur->data;
+
+ if (aelt->cleanup) {
+ aelt->cleanup (aelt, aelt->ud);
+ }
+
+ cur = g_list_next (cur);
+ }
+
+ g_queue_free (stat_ctx->async_elts);
g_ptr_array_free (st_ctx->statfiles, TRUE);
g_ptr_array_free (st_ctx->classifiers, TRUE);
REF_RELEASE (stat_ctx->cfg);