diff options
| author | 2012-11-20 09:47:45 +0000 | |
|---|---|---|
| committer | 2012-11-20 09:47:45 +0000 | |
| commit | 4fe02f32a80cb9b3c25e45b3b7ba3f76b64f896b (patch) | |
| tree | 257fece714ecc5fa1072d30f7a1705da6342314f /usr.sbin/smtpd/control.c | |
| parent | Do not crash on stray .Ta macros found outside column lists. (diff) | |
| download | wireguard-openbsd-4fe02f32a80cb9b3c25e45b3b7ba3f76b64f896b.tar.xz wireguard-openbsd-4fe02f32a80cb9b3c25e45b3b7ba3f76b64f896b.zip | |
Allow "smtpctl show queue" to run in "online" mode if the smtpd server
is running. The scheduler sends the runtime state of each envelope to
the queue process which loads the envelope, fills the runtime bits and
sends the envelope back to the client. Iteration over the envelope set
happens in small chunks to make the request interruptible and to allow
the server to keep doing its job in the meantime.
Adpat "smtpctl schedule-all" to schedule the messages one by one using
the same iteration mechanism.
Document "smtpctl monitor" and "smtpctl show queue".
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/control.c')
| -rw-r--r-- | usr.sbin/smtpd/control.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index e1eb8a925a9..86de6d06357 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.78 2012/11/12 14:58:53 eric Exp $ */ +/* $OpenBSD: control.c,v 1.79 2012/11/20 09:47:45 eric Exp $ */ /* * Copyright (c) 2012 Gilles Chehade <gilles@openbsd.org> @@ -94,6 +94,28 @@ control_imsg(struct imsgev *iev, struct imsg *imsg) return; } } + if (iev->proc == PROC_SCHEDULER) { + switch (imsg->hdr.type) { + case IMSG_SCHEDULER_MESSAGES: + c = control_connbyfd(imsg->hdr.peerid); + if (c == NULL) + return; + imsg_compose_event(&c->iev, IMSG_SCHEDULER_MESSAGES, 0, + 0, -1, imsg->data, imsg->hdr.len-sizeof imsg->hdr); + return; + } + } + if (iev->proc == PROC_QUEUE) { + switch (imsg->hdr.type) { + case IMSG_SCHEDULER_ENVELOPES: + c = control_connbyfd(imsg->hdr.peerid); + if (c == NULL) + return; + imsg_compose_event(&c->iev, IMSG_SCHEDULER_ENVELOPES, 0, + 0, -1, imsg->data, imsg->hdr.len-sizeof imsg->hdr); + return; + } + } switch (imsg->hdr.type) { case IMSG_STAT_INCREMENT: @@ -591,6 +613,22 @@ control_dispatch_ext(int fd, short event, void *arg) imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0); break; + case IMSG_SCHEDULER_MESSAGES: + if (euid) + goto badcred; + imsg_compose_event(env->sc_ievs[PROC_SCHEDULER], + IMSG_SCHEDULER_MESSAGES, fd, 0, -1, imsg.data, + imsg.hdr.len - sizeof(imsg.hdr)); + break; + + case IMSG_SCHEDULER_ENVELOPES: + if (euid) + goto badcred; + imsg_compose_event(env->sc_ievs[PROC_SCHEDULER], + IMSG_SCHEDULER_ENVELOPES, fd, 0, -1, imsg.data, + imsg.hdr.len - sizeof(imsg.hdr)); + break; + case IMSG_SCHEDULER_SCHEDULE: if (euid) goto badcred; |
