From 2ca520b06a1a80497dd39c98533ae21c165752c2 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Wed, 1 Jul 2020 20:35:59 +0200 Subject: Some renaming for consistency and some quick FIXME fixes --- minecproxy/server-config.c | 20 +++++++++++--------- minecproxy/server-config.h | 2 +- minecproxy/signal-handler.c | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'minecproxy') diff --git a/minecproxy/server-config.c b/minecproxy/server-config.c index 9d79af7..d4f52b1 100644 --- a/minecproxy/server-config.c +++ b/minecproxy/server-config.c @@ -16,11 +16,11 @@ #include "server-config.h" #include "config.h" -void server_cfg_async_dns_result(struct server_config *scfg) +void server_cfg_async_dns_update(struct server_config *scfg) { struct server *server = container_of(scfg, struct server, scfg); - scfg_async_dns_result(scfg); + scfg_async_dns_update(scfg); if (list_empty(&server->scfg.dnslookups)) { uring_task_put(&server->task); @@ -28,7 +28,7 @@ void server_cfg_async_dns_result(struct server_config *scfg) } } -static void scfg_read_cb(struct uring_task *task, int res) +static void server_cfg_read_cb(struct uring_task *task, int res) { struct server *server = container_of(task, struct server, task); const char *error; @@ -63,7 +63,7 @@ static void scfg_read_cb(struct uring_task *task, int res) server_commit(server); } -static void scfg_open_cb(struct uring_task *task, int res) +static void server_cfg_open_cb(struct uring_task *task, int res) { struct server *server = container_of(task, struct server, task); @@ -78,7 +78,7 @@ static void scfg_open_cb(struct uring_task *task, int res) debug(DBG_CFG, "reading server cfg %s (fd %i)", server->name, res); uring_task_set_fd(&server->task, res); - uring_tbuf_read_until_eof(&server->task, scfg_read_cb); + uring_tbuf_read_until_eof(&server->task, server_cfg_read_cb); } struct server_cfg_monitor { @@ -172,7 +172,7 @@ static void inotify_cb(struct uring_task *task, int res) continue; } - if (!is_valid_server_config_filename(NULL, event->name)) + if (!config_valid_server_filename(NULL, event->name)) continue; if (event->mask & (IN_MOVED_FROM | IN_DELETE)) @@ -182,7 +182,8 @@ static void inotify_cb(struct uring_task *task, int res) server = server_new(event->name); verbose("New server config file detected: %s", server->name); - uring_openat(&server->task, server->name, scfg_open_cb); + uring_openat(&server->task, server->name, + server_cfg_open_cb); } else error("inotify: unknown event: 0x%08x", event->mask); } @@ -245,12 +246,13 @@ void server_cfg_monitor_init() die("opendir(%s): %m", cfg->cfg_dir); while ((dent = readdir(dir)) != NULL) { - if (!is_valid_server_config_filename(dent, NULL)) + if (!config_valid_server_filename(dent, NULL)) continue; server = server_new(dent->d_name); if (server) - uring_openat(&server->task, server->scfg.filename, scfg_open_cb); + uring_openat(&server->task, server->scfg.filename, + server_cfg_open_cb); } closedir(dir); diff --git a/minecproxy/server-config.h b/minecproxy/server-config.h index 4ccba19..ced3777 100644 --- a/minecproxy/server-config.h +++ b/minecproxy/server-config.h @@ -1,7 +1,7 @@ #ifndef fooserverconfighfoo #define fooserverconfighfoo -void server_cfg_async_dns_result(struct server_config *scfg); +void server_cfg_async_dns_update(struct server_config *scfg); void server_cfg_monitor_delete(); diff --git a/minecproxy/signal-handler.c b/minecproxy/signal-handler.c index 23d72fa..7e297a3 100644 --- a/minecproxy/signal-handler.c +++ b/minecproxy/signal-handler.c @@ -51,7 +51,7 @@ static void signalfd_read(struct uring_task *task, int res) goto out; } - server_cfg_async_dns_result(si->si_ptr); + server_cfg_async_dns_update(si->si_ptr); break; } -- cgit v1.2.3