diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2012-09-11 19:19:14 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2012-09-11 19:19:14 +0000 |
commit | 34a98fa33a98cb3cccb0012e71886df99b4c51f1 (patch) | |
tree | 937c6133de2d5f548b88c78f4882cc22f4781809 | |
parent | 75d91eb1ab993c3474b6284d3924439167dfdb6f (diff) |
- simplify scheduler_compute_schedule by making it a quadratic delaying.
no more if/else, we derive the delay from the retry count. works for
qmail, should work for us too.
ok eric@
-rw-r--r-- | usr.sbin/smtpd/scheduler_backend.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/usr.sbin/smtpd/scheduler_backend.c b/usr.sbin/smtpd/scheduler_backend.c index 41ca95e8b41..6fccd4da8ae 100644 --- a/usr.sbin/smtpd/scheduler_backend.c +++ b/usr.sbin/smtpd/scheduler_backend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler_backend.c,v 1.5 2012/08/24 12:29:50 eric Exp $ */ +/* $OpenBSD: scheduler_backend.c,v 1.6 2012/09/11 19:19:13 gilles Exp $ */ /* * Copyright (c) 2012 Gilles Chehade <gilles@openbsd.org> @@ -61,18 +61,12 @@ scheduler_compute_schedule(struct scheduler_info *sched) { time_t delay; - if (sched->retry == 0) - delay = 0; -#if 0 - /* for testing scheduler sleep */ - delay = arc4random() % 30; -#endif - else if (sched->retry < 4) - delay = (sched->retry * 15 * 60); - else if (sched->retry < 8) - delay = ((sched->retry - 3) * 60 * 60); + if (sched->type == D_MTA) + delay = 800; else - delay = ((sched->retry - 7) * 24 * 60 * 60); + delay = 10; - return (sched->creation + delay); + delay = ((delay * sched->retry) * sched->retry) / 2; + + return (sched->creation + delay); } |