diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-04-13 20:53:19 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-04-13 20:53:19 +0000 |
commit | d6f127de12f4279d152b2b751e1081343eb1feb9 (patch) | |
tree | f42557558831387cb065020ec6102b560c5d0581 /usr.sbin/smtpd/queue.c | |
parent | 10ab03974677764f1aa880eb9756835764cbe839 (diff) |
following an idea from jacekm@, smtpd now uses a ram-queue instead of doing
a continuous walk on the disk-queue. the implementation differs from what
jacekm@ commited (and I backed out) a while ago in that it uses a queue and
a host tree required for upcoming features.
code will be improved in tree, it requires changes to be done in queue and
bounce API, I just wanted to commit a working version first ...
tested by todd@ and I
Diffstat (limited to 'usr.sbin/smtpd/queue.c')
-rw-r--r-- | usr.sbin/smtpd/queue.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index 7d6c59e90cf..c9515bc6bc6 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.94 2010/11/28 15:32:00 gilles Exp $ */ +/* $OpenBSD: queue.c,v 1.95 2011/04/13 20:53:18 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -54,7 +54,7 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { struct submit_status ss; struct message *m; - struct batch *b; + struct ramqueue_batch *rq_batch; int fd, ret; if (iev->proc == PROC_SMTP) { @@ -97,6 +97,10 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) } imsg_compose_event(iev, IMSG_QUEUE_COMMIT_MESSAGE, 0, 0, -1, &ss, sizeof ss); + + if (ss.code != 421) + queue_pass_to_runner(env, iev, imsg); + return; case IMSG_QUEUE_MESSAGE_FILE: @@ -165,10 +169,10 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) if (iev->proc == PROC_MTA) { switch (imsg->hdr.type) { case IMSG_QUEUE_MESSAGE_FD: - b = imsg->data; - fd = queue_open_message_file(b->message_id); + rq_batch = imsg->data; + fd = queue_open_message_file(rq_batch->m_id); imsg_compose_event(iev, IMSG_QUEUE_MESSAGE_FD, 0, 0, - fd, b, sizeof *b); + fd, rq_batch, sizeof *rq_batch); return; case IMSG_QUEUE_MESSAGE_UPDATE: @@ -321,16 +325,6 @@ queue(struct smtpd *env) return (0); } -struct batch * -batch_by_id(struct smtpd *env, u_int64_t id) -{ - struct batch lookup; - - lookup.id = id; - return SPLAY_FIND(batchtree, &env->batch_queue, &lookup); -} - - void queue_purge(char *queuepath) { |