/* Maps events */
rspamd_map_watch (worker->srv->cfg, ctx->ev_base);
rspamd_symbols_cache_start_refresh (worker->srv->cfg->cache, ctx->ev_base);
- rspamd_stat_init (worker->srv->cfg);
+ rspamd_stat_init (worker->srv->cfg, ctx->ev_base);
event_base_loop (ctx->ev_base, 0);
rspamd_worker_block_signals ();
#include "config.h"
#include "task.h"
#include <lua.h>
+#include <event.h>
/**
* @file stat_api.h
* Initialise statistics modules
* @param cfg
*/
-void rspamd_stat_init (struct rspamd_config *cfg);
+void rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base);
/**
* Finalize statistics
};
void
-rspamd_stat_init (struct rspamd_config *cfg)
+rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base)
{
GList *cur, *curst;
struct rspamd_classifier_config *clf;
stat_ctx->cfg = cfg;
stat_ctx->statfiles = g_ptr_array_new ();
stat_ctx->classifiers = g_ptr_array_new ();
+ stat_ctx->ev_base = ev_base;
REF_RETAIN (stat_ctx->cfg);
/* Create statfiles from the classifiers */
rspamd_stat_close (void)
{
guint i;
- struct rspamd_config *cfg = stat_ctx->cfg;
g_assert (stat_ctx != NULL);
/* Global tokenizer */
struct rspamd_stat_tokenizer *tokenizer;
gpointer tkcf;
+
+ struct event_base *ev_base;
};
typedef enum rspamd_learn_cache_result {
/* XXX: stupid default */
ctx->keys_cache = rspamd_keypair_cache_new (256);
- rspamd_stat_init (worker->srv->cfg);
+ rspamd_stat_init (worker->srv->cfg, ctx->ev_base);
#ifdef WITH_HYPERSCAN
rspamd_control_worker_add_cmd_handler (worker, RSPAMD_CONTROL_HYPERSCAN_LOADED,
g_test_init (&argc, &argv, NULL);
cfg->libs_ctx = rspamd_init_libs ();
- rspamd_stat_init (cfg);
base = event_init ();
+ rspamd_stat_init (cfg, base);
if (g_test_verbose ()) {
cfg->log_level = G_LOG_LEVEL_DEBUG;