diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-05-30 16:22:08 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-05-30 16:22:08 +0000 |
commit | 72dc61e90e95b2d6dfcf03458c6827626c937da8 (patch) | |
tree | 683469617529c3109b758e0e32254f43938aeb9a /usr.sbin/smtpd/smtp_session.c | |
parent | 6e8f6056ab972438b3ceb7e49ef41b226afa16a5 (diff) |
fix a bug where sessions_active counter, used to compute accept limits, was
decremented below 0 after the recent change that moved stats to shared mmap
memory. session_destroy() which is called from mta and smtp processes didnt
differentiate between them and decremented the counter when we had outgoing
sessions destroyed.
Diffstat (limited to 'usr.sbin/smtpd/smtp_session.c')
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 2dffde7c185..fe8a925932a 100644 --- a/usr.sbin/smtpd/smtp_session.c +++ b/usr.sbin/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.102 2009/05/28 08:50:08 jacekm Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.103 2009/05/30 16:22:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -958,15 +958,24 @@ session_destroy(struct session *s) if (close(s->s_fd) == -1) fatal("session_destroy: close"); - s->s_env->stats->smtp.sessions_active--; - if (s->s_env->stats->smtp.sessions_active < s->s_env->sc_maxconn && - !(s->s_msg.flags & F_MESSAGE_ENQUEUED)) { - /* - * if our session_destroy occurs because of a configuration - * reload, our listener no longer exist and s->s_l is NULL. - */ - if (s->s_l != NULL) - event_add(&s->s_l->ev, NULL); + switch (smtpd_process) { + case PROC_MTA: + s->s_env->stats->mta.sessions_active--; + break; + case PROC_SMTP: + s->s_env->stats->smtp.sessions_active--; + if (s->s_env->stats->smtp.sessions_active < s->s_env->sc_maxconn && + !(s->s_msg.flags & F_MESSAGE_ENQUEUED)) { + /* + * if our session_destroy occurs because of a configuration + * reload, our listener no longer exist and s->s_l is NULL. + */ + if (s->s_l != NULL) + event_add(&s->s_l->ev, NULL); + } + break; + default: + fatalx("session_destroy: cannot be called from this process"); } SPLAY_REMOVE(sessiontree, &s->s_env->sc_sessions, s); |