From: Vsevolod Stakhov Date: Sun, 11 Jan 2009 15:53:27 +0000 (+0300) Subject: * Implement statistic output in control interface X-Git-Tag: 0.2.7~329 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=640b2981e165356ea0609a740cc3e937cf6ab6d5;p=rspamd.git * Implement statistic output in control interface --- diff --git a/src/controller.c b/src/controller.c index 2115210e0..fb14cf8bb 100644 --- a/src/controller.c +++ b/src/controller.c @@ -161,9 +161,16 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control } break; case COMMAND_STAT: - /* XXX need to implement stat */ if (check_auth (cmd, session)) { - r = snprintf (out_buf, sizeof (out_buf), "-- end of stats report" CRLF); + r = snprintf (out_buf, sizeof (out_buf), "Messages scanned: %u" CRLF, + session->worker->srv->stat->messages_scanned); + r += snprintf (out_buf + r, sizeof (out_buf) - r , "Messages learned: %u" CRLF, + session->worker->srv->stat->messages_learned); + r += snprintf (out_buf + r, sizeof (out_buf) - r, "Connections count: %u" CRLF, + session->worker->srv->stat->connections_count); + r += snprintf (out_buf + r, sizeof (out_buf) - r, "Control connections count: %u" CRLF, + session->worker->srv->stat->control_connections_count); + r += snprintf (out_buf + r, sizeof (out_buf) - r, "-- end of stats report" CRLF); bufferevent_write (session->bev, out_buf, r); } break;