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);
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;
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);
gdouble values[];
} rspamd_token_t;
+struct rspamd_stat_async_elt {
+ void (*handler)(struct rspamd_stat_async_elt *elt, gpointer ud);
+ void (*cleanup)(struct rspamd_stat_async_elt *elt, gpointer ud);
+ struct event ev;
+ gpointer ud;
+};
+
struct rspamd_stat_ctx {
/* Subroutines for all objects */
struct rspamd_stat_classifier *classifiers_subrs;
/* Runtime configuration */
GPtrArray *statfiles; /* struct rspamd_statfile */
GPtrArray *classifiers; /* struct rspamd_classifier */
+ GQueue *async_elts; /* struct rspamd_stat_async_elt */
struct rspamd_config *cfg;
/* Global tokenizer */
struct rspamd_stat_tokenizer *tokenizer;