From: Stephan Bosch Date: Wed, 23 Nov 2022 01:33:06 +0000 (+0100) Subject: stats: Use the new listener type field to distinguish the various listener types. X-Git-Tag: 2.4.0~3300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56aa63e485948bb1be8daad70a3cf8e137556303;p=thirdparty%2Fdovecot%2Fcore.git stats: Use the new listener type field to distinguish the various listener types. --- diff --git a/src/stats/main.c b/src/stats/main.c index f63c3fd15b..67c9e7d7e2 100644 --- a/src/stats/main.c +++ b/src/stats/main.c @@ -18,30 +18,13 @@ time_t stats_startup_time; static const struct stats_settings *stats_settings; -static bool client_is_writer(const char *path) -{ - const char *name, *suffix; - - name = strrchr(path, '/'); - if (name == NULL) - name = path; - else - name++; - - suffix = strrchr(name, '-'); - if (suffix == NULL) - suffix = name; - else - suffix++; - - return strcmp(suffix, "writer") == 0; -} - static void client_connected(struct master_service_connection *conn) { - if (strcmp(conn->name, "http") == 0) + const char *type = master_service_connection_get_type(conn); + + if (strcmp(type, "http") == 0) client_http_create(conn); - else if (client_is_writer(conn->name)) + else if (strcmp(type, "writer") == 0) client_writer_create(conn->fd); else client_reader_create(conn->fd); diff --git a/src/stats/stats-settings.c b/src/stats/stats-settings.c index 26404202b5..4ca9abfe37 100644 --- a/src/stats/stats-settings.c +++ b/src/stats/stats-settings.c @@ -20,18 +20,21 @@ static bool stats_settings_check(void *_set, pool_t pool, const char **error_r); static struct file_listener_settings stats_unix_listeners_array[] = { { .path = "stats-reader", + .type = "reader", .mode = 0600, .user = "", .group = "", }, { .path = "stats-writer", + .type = "writer", .mode = 0660, .user = "", .group = "$default_internal_group", }, { .path = "login/stats-writer", + .type = "writer", .mode = 0600, .user = "$default_login_user", .group = "",