}
fclose (f);
+ /* Init counters */
+ counters = rspamd_hash_new_shared (rspamd->server_pool, g_str_hash, g_str_equal, 64);
/* Init C modules */
for (i = 0; i < MODULES_NUM; i ++) {
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
+
/* Create listen socket */
listen_sock = create_listen_socket (&rspamd->cfg->bind_addr, rspamd->cfg->bind_port,
rspamd->cfg->bind_family, rspamd->cfg->bind_host);
/* Init statfile pool */
rspamd->statfile_pool = statfile_pool_new (cfg->max_statfile_size);
- /* Init counters */
- counters = rspamd_hash_new_shared (rspamd->server_pool, g_str_hash, g_str_equal, 64);
+
+ /* Perform modules configuring */
+ for (i = 0; i < MODULES_NUM; i ++) {
+ modules[i].module_config_func (cfg);
+ }
for (i = 0; i < cfg->workers_number; i++) {
fork_worker (rspamd, listen_sock, TYPE_WORKER);
if (!read_regexp_expression (regexp_module_ctx->regexp_pool, cur_item, cur->param, cur->value, cfg)) {
res = FALSE;
}
+ set_counter (cur_item->symbol, 0);
regexp_module_ctx->items = g_list_prepend (regexp_module_ctx->items, cur_item);
}
}
double alpha;
char *key;
-#if 0
cd = rspamd_hash_lookup (counters, (gpointer)name);
if (cd == NULL) {
cd = memory_pool_alloc_shared (counters->pool, sizeof (struct counter_data));
cd->value = value;
- cd->number = 1;
+ cd->number = 0;
key = memory_pool_strdup_shared (counters->pool, name);
rspamd_hash_insert (counters, (gpointer)key, (gpointer)cd);
}
memory_pool_wunlock_rwlock (counters->lock);
}
-#endif
}
/*
start_worker (struct rspamd_worker *worker, int listen_sock)
{
struct sigaction signals;
- int i;
#ifdef WITH_PROFILER
extern void _start (void), etext (void);
event_set(&worker->bind_ev, listen_sock, EV_READ | EV_PERSIST, accept_socket, (void *)worker);
event_add(&worker->bind_ev, NULL);
- /* Perform modules configuring */
- for (i = 0; i < MODULES_NUM; i ++) {
- modules[i].module_config_func (worker->srv->cfg);
- }
-
/* Send SIGUSR2 to parent */
kill (getppid (), SIGUSR2);