aboutsummaryrefslogtreecommitdiffstats
path: root/src/lmtp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-01-16 20:59:37 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-01-16 20:59:37 +0400
commit9bacf0d835d66aaddcdb9e664a34364f25ed2554 (patch)
tree8aa7287724a3abce1b6b63dc7215e101d44eb87d /src/lmtp.c
parent9f2cb66ccbce8cd0fb659b79063bcebf1d816a1d (diff)
downloadrspamd-9bacf0d835d66aaddcdb9e664a34364f25ed2554.tar.gz
rspamd-9bacf0d835d66aaddcdb9e664a34364f25ed2554.zip
* Introduce new system of worker's and modules initialization:
- Removed legacy limitation of worker's types; - Using GQuarks to identify workers and modules; - Remove modules.sh script; - Add a common system of workers and modules; - Write management and configuration for new architecture.
Diffstat (limited to 'src/lmtp.c')
-rw-r--r--src/lmtp.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/lmtp.c b/src/lmtp.c
index 81b546d4f..da38dc6ae 100644
--- a/src/lmtp.c
+++ b/src/lmtp.c
@@ -30,7 +30,6 @@
#include "cfg_file.h"
#include "util.h"
#include "url.h"
-#include "modules.h"
#include "message.h"
static gchar greetingbuf[1024];
@@ -38,6 +37,18 @@ static struct timeval io_tv;
static gboolean lmtp_write_socket (void *arg);
+void start_lmtp (struct rspamd_worker *worker);
+
+worker_t lmtp_worker = {
+ "controller", /* Name */
+ NULL, /* Init function */
+ start_lmtp, /* Start function */
+ TRUE, /* Has socket */
+ FALSE, /* Non unique */
+ FALSE, /* Non threaded */
+ TRUE /* Killable */
+};
+
#ifndef HAVE_SA_SIGINFO
static void
sig_handler (gint signo)
@@ -279,15 +290,14 @@ accept_socket (gint fd, short what, void *arg)
* Start lmtp worker process
*/
void
-start_lmtp_worker (struct rspamd_worker *worker)
+start_lmtp (struct rspamd_worker *worker)
{
struct sigaction signals;
- gint i;
gchar *hostbuf;
gsize hostmax;
+ module_t **mod;
worker->srv->pid = getpid ();
- worker->srv->type = TYPE_LMTP;
worker->ctx = event_init ();
g_mime_init (0);
@@ -310,8 +320,10 @@ start_lmtp_worker (struct rspamd_worker *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);
+ mod = &modules[0];
+ while (*mod) {
+ (*mod)->module_config_func (worker->srv->cfg);
+ mod ++;
}
/* Fill hostname buf */