diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-01-28 19:38:47 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-01-28 19:38:47 +0000 |
commit | b77bf55f02ac9f890173d8279c884f5d4b89fd57 (patch) | |
tree | 8e2890060141ebec10618c836ce862e932c87a4c | |
parent | f61d235bbd9708fdbdb841ea2940e853f4ad5ad5 (diff) |
when pausing listeners, do not simply disable their events as new
clients would still be able to connect. instead, at pause time we
close and remove the listeners, and at resume time we request the
parent to reconfigure all listeners.
discussed with pyr@
-rw-r--r-- | usr.sbin/smtpd/smtp.c | 15 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 3 |
3 files changed, 11 insertions, 13 deletions
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c index 0a6dcdc98ff..ee77f657380 100644 --- a/usr.sbin/smtpd/smtp.c +++ b/usr.sbin/smtpd/smtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp.c,v 1.16 2009/01/04 22:35:09 gilles Exp $ */ +/* $OpenBSD: smtp.c,v 1.17 2009/01/28 19:38:46 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -633,24 +633,17 @@ smtp_disable_events(struct smtpd *env) void smtp_pause(struct smtpd *env) { - struct listener *l; - log_debug("smtp_pause_listeners: pausing listening sockets"); - TAILQ_FOREACH(l, &env->sc_listeners, entry) { - event_del(&l->ev); - } + smtp_disable_events(env); env->sc_opts |= SMTPD_SMTP_PAUSED; } void smtp_resume(struct smtpd *env) { - struct listener *l; - log_debug("smtp_pause_listeners: resuming listening sockets"); - TAILQ_FOREACH(l, &env->sc_listeners, entry) { - event_add(&l->ev, NULL); - } + imsg_compose(env->sc_ibufs[PROC_PARENT], IMSG_PARENT_SEND_CONFIG, + 0, 0, -1, NULL, 0); env->sc_opts &= ~SMTPD_SMTP_PAUSED; } diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index d4f4cd888ab..3d1d6dab8c5 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.25 2009/01/27 11:42:30 gilles Exp $ */ +/* $OpenBSD: smtpd.c,v 1.26 2009/01/28 19:38:46 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -410,6 +410,10 @@ parent_dispatch_smtp(int fd, short event, void *p) break; switch (imsg.hdr.type) { + case IMSG_PARENT_SEND_CONFIG: { + parent_send_config(-1, -1, env); + break; + } case IMSG_PARENT_AUTHENTICATE: { struct session_auth_req *req; struct session_auth_reply reply; diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index d6d115444c4..fcada9b9aba 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.52 2009/01/28 17:29:11 jacekm Exp $ */ +/* $OpenBSD: smtpd.h,v 1.53 2009/01/28 19:38:46 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -197,6 +197,7 @@ enum imsg_type { IMSG_PARENT_MAILBOX_RENAME, IMSG_PARENT_AUTHENTICATE, + IMSG_PARENT_SEND_CONFIG, IMSG_MDA_PAUSE, IMSG_MTA_PAUSE, |