diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2012-10-25 09:51:09 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2012-10-25 09:51:09 +0000 |
commit | c0411ea8d985cedd8f13107e4d7064f1a06a6eea (patch) | |
tree | fdee9f810a479df8fb8f942fec9115bbd543bb8e /usr.sbin/smtpd/queue.c | |
parent | ab20b8f4d1b3d70a7add8b28a95c34ccc60ab3a8 (diff) |
Make the mda request the message fd from the queue when needed, instead of
pushing the fd with the envelope. This allows the mda to deal itself with
session limits. Envelopes are sent at full rate to the mda, which buffers
them on per-user queues, or sends them back for rescheduling if it already
has too many pending envelopes. Delivery sessions are created (within per-
user and global limits) to drain the queues.
This makes the server handle envelope bursts more efficiently.
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/queue.c')
-rw-r--r-- | usr.sbin/smtpd/queue.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index f552d1950b1..bc6635827c6 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.139 2012/10/14 18:45:34 eric Exp $ */ +/* $OpenBSD: queue.c,v 1.140 2012/10/25 09:51:08 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -48,12 +48,9 @@ static void queue_pass_to_scheduler(struct imsgev *, struct imsg *); static void queue_shutdown(void); static void queue_sig_handler(int, short, void *); -#define MDA_RUNMAX 50 - static void queue_imsg(struct imsgev *iev, struct imsg *imsg) { - static size_t mda_running; static uint64_t batch_id; struct submit_status ss; struct envelope *e, evp; @@ -167,17 +164,9 @@ queue_imsg(struct imsgev *iev, struct imsg *imsg) id = *(uint64_t*)(imsg->data); if (queue_envelope_load(id, &evp) == 0) errx(1, "cannot load evp:%016" PRIx64, id); - if (mda_running >= MDA_RUNMAX) { - imsg_compose_event(env->sc_ievs[PROC_SCHEDULER], - IMSG_QUEUE_DELIVERY_TEMPFAIL, 0, 0, -1, - &evp, sizeof evp); - return; - } evp.lasttry = time(NULL); - fd = queue_message_fd_r(evpid_to_msgid(id)); imsg_compose_event(env->sc_ievs[PROC_MDA], - IMSG_MDA_SESS_NEW, 0, 0, fd, &evp, sizeof evp); - mda_running += 1; + IMSG_MDA_SESS_NEW, 0, 0, -1, &evp, sizeof evp); return; case IMSG_SMTP_ENQUEUE: @@ -224,8 +213,6 @@ queue_imsg(struct imsgev *iev, struct imsg *imsg) imsg_compose_event(env->sc_ievs[PROC_SCHEDULER], IMSG_QUEUE_DELIVERY_OK, 0, 0, -1, &e->id, sizeof e->id); - if (iev->proc == PROC_MDA) - mda_running--; return; case IMSG_QUEUE_DELIVERY_TEMPFAIL: @@ -235,8 +222,6 @@ queue_imsg(struct imsgev *iev, struct imsg *imsg) imsg_compose_event(env->sc_ievs[PROC_SCHEDULER], IMSG_QUEUE_DELIVERY_TEMPFAIL, 0, 0, -1, e, sizeof *e); - if (iev->proc == PROC_MDA) - mda_running--; return; case IMSG_QUEUE_DELIVERY_PERMFAIL: @@ -246,8 +231,6 @@ queue_imsg(struct imsgev *iev, struct imsg *imsg) imsg_compose_event(env->sc_ievs[PROC_SCHEDULER], IMSG_QUEUE_DELIVERY_PERMFAIL, 0, 0, -1, &e->id, sizeof e->id); - if (iev->proc == PROC_MDA) - mda_running--; return; case IMSG_QUEUE_DELIVERY_LOOP: @@ -257,8 +240,6 @@ queue_imsg(struct imsgev *iev, struct imsg *imsg) imsg_compose_event(env->sc_ievs[PROC_SCHEDULER], IMSG_QUEUE_DELIVERY_LOOP, 0, 0, -1, &e->id, sizeof e->id); - if (iev->proc == PROC_MDA) - mda_running--; return; } } |