srv_cmd.type = RSPAMD_SRV_LOG_PIPE;
srv_cmd.cmd.log_pipe.type = RSPAMD_LOG_PIPE_SYMBOLS;
+ /* Wait for startup being completed */
+ rspamd_mempool_lock_mutex (worker->srv->start_mtx);
rspamd_srv_send_command (worker, ctx->ev_base, &srv_cmd, ctx->pair[1],
rspamd_log_helper_reply_handler, ctx);
+ rspamd_mempool_unlock_mutex (worker->srv->start_mtx);
event_base_loop (ctx->ev_base, 0);
close (ctx->pair[0]);
rspamd_worker_block_signals ();
rspamd_main->cfg = rspamd_config_new ();
rspamd_main->spairs = g_hash_table_new_full (rspamd_spair_hash,
rspamd_spair_equal, g_free, rspamd_spair_close);
+ rspamd_main->start_mtx = rspamd_mempool_get_mutex (rspamd_main->server_pool);
#ifndef HAVE_SETPROCTITLE
init_title (argc, argv, env);
event_add (&usr1_ev, NULL);
rspamd_check_core_limits (rspamd_main);
+ rspamd_mempool_lock_mutex (rspamd_main->start_mtx);
spawn_workers (rspamd_main, ev_base);
+ rspamd_mempool_unlock_mutex (rspamd_main->start_mtx);
if (control_fd != -1) {
msg_info_main ("listening for control commands on %s",
rspamd_log_close (rspamd_main->logger);
REF_RELEASE (rspamd_main->cfg);
g_hash_table_unref (rspamd_main->spairs);
+ rspamd_mempool_delete (rspamd_main->server_pool);
g_free (rspamd_main);
event_base_free (ev_base);
struct rspamd_stat *stat; /**< pointer to statistics */
rspamd_mempool_t *server_pool; /**< server's memory pool */
+ rspamd_mempool_mutex_t *start_mtx; /**< server is starting up */
GHashTable *workers; /**< workers pool indexed by pid */
GHashTable *spairs; /**< socket pairs requested by workers */
rspamd_logger_t *logger;