diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-01-04 19:37:42 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-01-04 19:37:42 +0000 |
commit | 5f61b60a6b0e894f17c28cac99a3482809e5c91c (patch) | |
tree | 3e4780b60352ac89371bc06211486df130824e86 /usr.sbin/smtpd/control.c | |
parent | 199a745fdcd9bc8c19dce443d37061a3fc8dc147 (diff) |
- runner is now capable of pausing/resuming the scheduling of deliveries
for both mda and mta batches.
- smtpctl can be used to disable/enable deliveries at runtime using the
pause/resume commands.
ok jacekm@
Diffstat (limited to 'usr.sbin/smtpd/control.c')
-rw-r--r-- | usr.sbin/smtpd/control.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index 04370e980fc..a1905876d4d 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.5 2009/01/01 16:15:47 jacekm Exp $ */ +/* $OpenBSD: control.c,v 1.6 2009/01/04 19:37:41 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -311,6 +311,51 @@ control_dispatch_ext(int fd, short event, void *arg) env->sc_flags |= SMTPD_EXITING; imsg_compose(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0); break; + case IMSG_RUNNER_PAUSE_MDA: + if (env->sc_flags & SMTPD_MDA_PAUSED) { + imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, + NULL, 0); + break; + } + env->sc_flags |= SMTPD_MDA_PAUSED; + imsg_compose(env->sc_ibufs[PROC_RUNNER], IMSG_RUNNER_PAUSE_MDA, + 0, 0, -1, NULL, 0); + imsg_compose(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0); + break; + case IMSG_RUNNER_PAUSE_MTA: + if (env->sc_flags & SMTPD_MTA_PAUSED) { + imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, + NULL, 0); + break; + } + env->sc_flags |= SMTPD_MTA_PAUSED; + imsg_compose(env->sc_ibufs[PROC_RUNNER], IMSG_RUNNER_PAUSE_MTA, + 0, 0, -1, NULL, 0); + imsg_compose(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0); + break; + case IMSG_RUNNER_RESUME_MDA: + if (! (env->sc_flags & SMTPD_MDA_PAUSED)) { + imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, + NULL, 0); + break; + } + env->sc_flags &= ~SMTPD_MDA_PAUSED; + imsg_compose(env->sc_ibufs[PROC_RUNNER], IMSG_RUNNER_RESUME_MDA, + 0, 0, -1, NULL, 0); + imsg_compose(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0); + break; + case IMSG_RUNNER_RESUME_MTA: + if (!(env->sc_flags & SMTPD_MTA_PAUSED)) { + imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, + NULL, 0); + break; + } + env->sc_flags &= ~SMTPD_MTA_PAUSED; + imsg_compose(env->sc_ibufs[PROC_RUNNER], IMSG_RUNNER_RESUME_MTA, + 0, 0, -1, NULL, 0); + imsg_compose(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0); + break; + default: log_debug("control_dispatch_ext: " "error handling imsg %d", imsg.hdr.type); |