From: Timo Sirainen Date: Wed, 23 May 2018 12:14:50 +0000 (+0300) Subject: lib-master: If stats process wants no events, send nothing to it X-Git-Tag: 2.3.9~1810 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4be03fcbfc77e7a1a2a927cc0dc7536215d8f922;p=thirdparty%2Fdovecot%2Fcore.git lib-master: If stats process wants no events, send nothing to it Instead of sending everything to it.. --- diff --git a/src/lib-master/stats-client.c b/src/lib-master/stats-client.c index 2c007872bb..caff0f5253 100644 --- a/src/lib-master/stats-client.c +++ b/src/lib-master/stats-client.c @@ -34,6 +34,10 @@ client_handshake_filter(const char *const *args, struct event_filter **filter_r, *error_r = "Expected FILTER"; return -1; } + if (args[1] == NULL || args[1][0] == '\0') { + *filter_r = NULL; + return 0; + } *filter_r = event_filter_create(); if (!event_filter_import_unescaped(*filter_r, args+1, error_r)) { @@ -58,6 +62,10 @@ stats_client_handshake(struct stats_client *client, const char *const *args) client->handshake_received_at_least_once = TRUE; if (client->ioloop != NULL) io_loop_stop(client->ioloop); + if (filter == NULL) { + /* stats process wants nothing to be sent to it */ + return 1; + } if (client->filter != NULL) { /* Filter is already set. It becomes a bit complicated to @@ -200,7 +208,7 @@ static void stats_client_send_event(struct stats_client *client, struct event *event, const struct failure_context *ctx) { - if (!client->handshaked || + if (!client->handshaked || client->filter == NULL || !event_filter_match(client->filter, event, ctx)) return;