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);
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 = "",