diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-03-13 18:03:29 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-03-13 18:03:29 +0300 |
commit | 1085ddb9c09caba4bcb4408135044dc24f7798f3 (patch) | |
tree | 88a7073ef0b503557fb28e080a61224b60c18d5a /src/lmtp.c | |
parent | 89f264624c1c846c995c22a8390b7e79f09ef960 (diff) | |
download | rspamd-1085ddb9c09caba4bcb4408135044dc24f7798f3.tar.gz rspamd-1085ddb9c09caba4bcb4408135044dc24f7798f3.zip |
* Fix reload logic
* Create listen sock for lmtp in main processes dispatcher to allow multiply lmtp workers
* Fix logic of logging
Diffstat (limited to 'src/lmtp.c')
-rw-r--r-- | src/lmtp.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/lmtp.c b/src/lmtp.c index 276aad0cb..a8f10ee2c 100644 --- a/src/lmtp.c +++ b/src/lmtp.c @@ -62,7 +62,7 @@ sigusr_handler (int fd, short what, void *arg) event_del (&worker->sig_ev); event_del (&worker->bind_ev); do_reopen_log = 1; - msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); + msg_info ("lmtp worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); event_loopexit (&tv); return; } @@ -244,11 +244,10 @@ accept_socket (int fd, short what, void *arg) * Start lmtp worker process */ void -start_lmtp_worker (struct rspamd_worker *worker) +start_lmtp_worker (struct rspamd_worker *worker, int listen_sock) { struct sigaction signals; - int listen_sock, i; - struct sockaddr_un *un_addr; + int i; char *hostbuf; long int hostmax; @@ -264,25 +263,6 @@ start_lmtp_worker (struct rspamd_worker *worker) signal_set (&worker->sig_ev, SIGUSR2, sigusr_handler, (void *) worker); signal_add (&worker->sig_ev, NULL); - /* Create listen socket */ - if (worker->srv->cfg->lmtp_family == AF_INET) { - if ((listen_sock = make_tcp_socket (&worker->srv->cfg->lmtp_addr, worker->srv->cfg->lmtp_port, TRUE)) == -1) { - msg_err ("start_lmtp: cannot create tcp listen socket. %s", strerror (errno)); - exit(-errno); - } - } - else { - un_addr = (struct sockaddr_un *) alloca (sizeof (struct sockaddr_un)); - if (!un_addr || (listen_sock = make_unix_socket (worker->srv->cfg->lmtp_host, un_addr, TRUE)) == -1) { - msg_err ("start_lmtp: cannot create unix listen socket. %s", strerror (errno)); - exit(-errno); - } - } - - if (listen (listen_sock, -1) == -1) { - msg_err ("start_lmtp: cannot listen on socket. %s", strerror (errno)); - exit(-errno); - } /* Accept event */ event_set(&worker->bind_ev, listen_sock, EV_READ | EV_PERSIST, accept_socket, (void *)worker); event_add(&worker->bind_ev, NULL); @@ -306,6 +286,7 @@ start_lmtp_worker (struct rspamd_worker *worker) io_tv.tv_usec = 0; event_loop (0); + exit (EXIT_SUCCESS); } /* |