diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-03-31 17:35:35 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-03-31 17:35:35 +0400 |
commit | a93dd7892f8ecf0a72a242d2d203575001ef635e (patch) | |
tree | 43aaac84ff4f7059f2c89b425f47e341b6c3211e /src/main.c | |
parent | 37d6c7f23fd44283d1853141d39ecc3f3a2c54e6 (diff) | |
download | rspamd-a93dd7892f8ecf0a72a242d2d203575001ef635e.tar.gz rspamd-a93dd7892f8ecf0a72a242d2d203575001ef635e.zip |
* Preload statfiles at the early beginning in the main process
* Add JSON output for rspamd worker
* Add HTTP protocol support for rspamd worker
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index cef64d8a1..d268bc3cb 100644 --- a/src/main.c +++ b/src/main.c @@ -680,6 +680,33 @@ convert_old_config (struct rspamd_main *rspamd) } #endif +static void +preload_statfiles (struct rspamd_main *rspamd) +{ + struct classifier_config *cf; + struct statfile *st; + stat_file_t *stf; + GList *cur_cl, *cur_st; + + cur_cl = rspamd->cfg->classifiers; + while (cur_cl) { + /* Open all statfiles */ + cf = cur_cl->data; + + cur_st = cf->statfiles; + while (cur_st) { + st = cur_st->data; + stf = statfile_pool_open (rspamd->statfile_pool, st->path, st->size, FALSE); + if (stf == NULL) { + msg_warn ("preload of %s from %s failed", st->symbol, st->path); + } + cur_st = g_list_next (cur_st); + } + + cur_cl = g_list_next (cur_cl); + } +} + static gboolean load_rspamd_config (struct config_file *cfg, gboolean init_modules) { @@ -990,6 +1017,9 @@ main (gint argc, gchar **argv, gchar **env) /* Flush log */ flush_log_buf (); + /* Preload all statfiles */ + preload_statfiles (rspamd); + /* Spawn workers */ rspamd->workers = g_hash_table_new (g_direct_hash, g_direct_equal); spawn_workers (rspamd); |