aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-24 20:16:53 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-24 20:16:53 +0300
commit1cd34f5283bcf1d4973a351dc5235094608e3d2d (patch)
tree2d6185294cfea7c3c062c8d2123df96f5e02e1b0 /src/main.c
parent606128de4cb33a2727d6609df46ecf0c72006a73 (diff)
downloadrspamd-1cd34f5283bcf1d4973a351dc5235094608e3d2d.tar.gz
rspamd-1cd34f5283bcf1d4973a351dc5235094608e3d2d.zip
* Add initial LMTP support and LDA delivery to rspamd
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 782f0acff..6a170726a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,6 +27,7 @@
#include "cfg_file.h"
#include "util.h"
#include "perl.h"
+#include "lmtp.h"
/* 2 seconds to fork new process in place of dead one */
#define SOFT_FORK_TIME 2
@@ -178,6 +179,11 @@ fork_worker (struct rspamd_main *rspamd, int listen_sock, int reconfig, enum pro
msg_info ("fork_worker: starting controller process %d", getpid ());
start_controller (cur);
break;
+ case TYPE_LMTP:
+ setproctitle ("lmtp process");
+ pidfile_close (rspamd->pfh);
+ msg_info ("fork_worker: starting lmtp process %d", getpid ());
+ start_lmtp_worker (cur);
case TYPE_WORKER:
default:
setproctitle ("worker process");
@@ -368,6 +374,11 @@ main (int argc, char **argv, char **env)
if (cfg->controller_enabled) {
fork_worker (rspamd, listen_sock, 0, TYPE_CONTROLLER);
}
+
+ /* Start lmtp if enabled */
+ if (cfg->lmtp_enable) {
+ fork_worker (rspamd, listen_sock, 0, TYPE_LMTP);
+ }
/* Signal processing cycle */
for (;;) {
@@ -394,17 +405,17 @@ main (int argc, char **argv, char **env)
if (WIFEXITED (res) && WEXITSTATUS (res) == 0) {
/* Normal worker termination, do not fork one more */
msg_info ("main: %s process %d terminated normally",
- (cur->type == TYPE_WORKER) ? "worker" : "controller", cur->pid);
+ (cur->type != TYPE_WORKER) ? "controller" : "worker", cur->pid);
}
else {
if (WIFSIGNALED (res)) {
msg_warn ("main: %s process %d terminated abnormally by signal: %d",
- (cur->type == TYPE_WORKER) ? "worker" : "controller",
+ (cur->type != TYPE_WORKER) ? "controller" : "worker",
cur->pid, WTERMSIG(res));
}
else {
msg_warn ("main: %s process %d terminated abnormally",
- (cur->type == TYPE_WORKER) ? "worker" : "controller", cur->pid);
+ (cur->type != TYPE_WORKER) ? "controller" : "worker", cur->pid);
}
/* Fork another worker in replace of dead one */
delay_fork (cur->type);