Mercurial > dovecot > core-2.2
changeset 19575:845fb37ef972
stats: Add RESET call to stats client
author | Aki Tuomi <aki.tuomi@dovecot.net> |
---|---|
date | Mon, 11 Jan 2016 15:46:28 +0200 |
parents | 0f6713172b2c |
children | d9189bd01219 |
files | src/stats/Makefile.am src/stats/client-reset.c src/stats/client-reset.h src/stats/client.c |
diffstat | 4 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/stats/Makefile.am Mon Jan 11 15:46:05 2016 +0200 +++ b/src/stats/Makefile.am Mon Jan 11 15:46:28 2016 +0200 @@ -16,6 +16,7 @@ stats_SOURCES = \ client.c \ client-export.c \ + client-reset.c \ global-memory.c \ mail-command.c \ mail-domain.c \ @@ -30,6 +31,7 @@ noinst_HEADERS = \ client.h \ client-export.h \ + client-reset.h \ global-memory.h \ mail-command.h \ mail-domain.h \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/stats/client-reset.c Mon Jan 11 15:46:28 2016 +0200 @@ -0,0 +1,24 @@ +/* Copyright (c) 2011-2015 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "net.h" +#include "ostream.h" +#include "str.h" +#include "strescape.h" +#include "mail-stats.h" +#include "mail-command.h" +#include "mail-session.h" +#include "mail-user.h" +#include "mail-domain.h" +#include "mail-ip.h" +#include "client.h" +#include "client-reset.h" + +int client_stats_reset(struct client *client, const char *const *args ATTR_UNUSED, + const char **error_r ATTR_UNUSED) +{ + struct mail_global *g = &mail_global_stats; + stats_reset(g->stats); + o_stream_nsend_str(client->output, "OK\n"); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/stats/client-reset.h Mon Jan 11 15:46:28 2016 +0200 @@ -0,0 +1,9 @@ +#ifndef CLIENT_RESET_H +#define CLIENT_RESET_H + +struct client; + +int client_stats_reset(struct client *client, const char *const *args, + const char **error_r); + +#endif
--- a/src/stats/client.c Mon Jan 11 15:46:05 2016 +0200 +++ b/src/stats/client.c Mon Jan 11 15:46:28 2016 +0200 @@ -49,6 +49,8 @@ if (strcmp(cmd, "EXPORT") == 0) return client_export(client, args, error_r); + if (strcmp(cmd, "RESET") == 0) + return client_stats_reset(client, args, error_r); *error_r = "Unknown command"; return -1;