summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-11-13 13:23:24 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-11-13 13:23:24 +0000
commit6c750a337e3a4a8bbad5120354b53f3e54e72b4f (patch)
tree19aab238f412781410f667e5061cb494160437cb
parentbb8c0be811b76c6ab88d9ab6f84dfd86fefb3dbb (diff)
do not miss the last envelope
ok gilles@
-rw-r--r--usr.sbin/smtpd/queue.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index 239d31f4731..a4f5a19ecec 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.c,v 1.141 2012/11/12 14:58:53 eric Exp $ */
+/* $OpenBSD: queue.c,v 1.142 2012/11/13 13:23:23 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -419,7 +419,16 @@ queue_timeout(int fd, short event, void *p)
}
while (qwalk(q, &evpid)) {
- if (! queue_envelope_load(evpid, &envelope))
+
+ if (msgid && evpid_to_msgid(evpid) != msgid && evpcount) {
+ imsg_compose_event(env->sc_ievs[PROC_SCHEDULER],
+ IMSG_QUEUE_COMMIT_MESSAGE, 0, 0, -1, &msgid,
+ sizeof msgid);
+ evpcount = 0;
+ }
+ msgid = evpid_to_msgid(evpid);
+
+ if (!queue_envelope_load(evpid, &envelope))
log_warnx("warn: Failed to load envelope %016"PRIx64,
evpid);
else {
@@ -429,14 +438,6 @@ queue_timeout(int fd, short event, void *p)
evpcount++;
}
- if (msgid && evpid_to_msgid(evpid) != msgid && evpcount) {
- imsg_compose_event(env->sc_ievs[PROC_SCHEDULER],
- IMSG_QUEUE_COMMIT_MESSAGE, 0, 0, -1, &msgid,
- sizeof msgid);
- evpcount = 0;
- }
-
- msgid = evpid_to_msgid(evpid);
tv.tv_sec = 0;
tv.tv_usec = 0;
evtimer_add(ev, &tv);