diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-01-30 21:40:22 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-01-30 21:40:22 +0000 |
commit | 8452589c8ddef50efc571850d1c840f2f09e4ed9 (patch) | |
tree | 7dbe30b9aa8baa51284a951ed50b53d864ae0e2e /usr.sbin/smtpd/ssl.c | |
parent | 5328220112c6a2ede4995eb893b771f763c4dc4f (diff) |
improve statistics for smtp process. not only collect the current sessions
count, but also the total sessions count, ssmtp sessions (both current and
total) and starttls sessions (both current and total)
# ./smtpctl/smtpctl show stats|grep smtp.sessions
smtp.sessions = 0
smtp.sessions.active = 0
smtp.sessions.ssmtp = 0
smtp.sessions.ssmtp.active = 0
smtp.sessions.starttls = 0
smtp.sessions.starttls.active = 0
#
Diffstat (limited to 'usr.sbin/smtpd/ssl.c')
-rw-r--r-- | usr.sbin/smtpd/ssl.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/ssl.c b/usr.sbin/smtpd/ssl.c index 377bf726e1a..4cf4b88c672 100644 --- a/usr.sbin/smtpd/ssl.c +++ b/usr.sbin/smtpd/ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl.c,v 1.7 2009/01/29 14:25:55 gilles Exp $ */ +/* $OpenBSD: ssl.c,v 1.8 2009/01/30 21:40:21 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -55,6 +55,8 @@ void ssl_client_init(struct session *); extern void bufferevent_read_pressure_cb(struct evbuffer *, size_t, size_t, void *); +extern struct s_smtp s_smtp; + void ssl_connect(int fd, short event, void *p) { @@ -506,6 +508,16 @@ ssl_session_accept(int fd, short event, void *p) log_info("ssl_session_accept: accepted ssl client"); s->s_flags |= F_SECURE; + + if (s->s_l->flags & F_SSMTP) { + s_smtp.ssmtp++; + s_smtp.ssmtp_active++; + } + if (s->s_l->flags & F_STARTTLS) { + s_smtp.starttls++; + s_smtp.starttls_active++; + } + session_pickup(s, NULL); return; retry: @@ -582,5 +594,11 @@ ssl_client_init(struct session *s) void ssl_session_destroy(struct session *s) { + if (s->s_l->flags & F_SSMTP) { + s_smtp.ssmtp_active--; + } + if (s->s_l->flags & F_STARTTLS) { + s_smtp.starttls_active--; + } SSL_free(s->s_ssl); } |