diff options
-rw-r--r-- | announce.c | 2 | ||||
-rw-r--r-- | cfgdir.c | 2 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | server.c | 2 | ||||
-rw-r--r-- | uring.c | 12 | ||||
-rw-r--r-- | uring.h | 2 |
6 files changed, 19 insertions, 5 deletions
@@ -176,7 +176,7 @@ announce_init(struct cfg *cfg) if (sfd < 0) perrordie("socket"); - uring_task_init(&aev->task, "aev", &cfg->task, announce_free); + uring_task_init(&aev->task, "aev", uring_parent(cfg), announce_free); uring_task_set_fd(&aev->task, afd); uring_task_init(&aev->mcast_task, "aev_mcast", &aev->task, mcast_free); @@ -347,7 +347,7 @@ cfgdir_init(struct cfg *cfg) if (iwd < 0) perrordie("inotify_add_watch"); - uring_task_init(&iev->task, "iev", &cfg->task, inotify_free); + uring_task_init(&iev->task, "iev", uring_parent(cfg), inotify_free); uring_task_set_fd(&iev->task, ifd); cfg->iev = iev; uring_read(cfg, &iev->task, iev->buf, sizeof(iev->buf), 0, inotify_cb); @@ -155,9 +155,9 @@ dump_tree(struct cfg *cfg) fprintf(stderr, "Dumping Tree\n"); fprintf(stderr, "============\n"); uring_task_refdump(&cfg->task); + uring_refdump(cfg->uev); uring_task_refdump(&cfg->sev->task); announce_refdump(cfg->aev); - uring_refdump(cfg->uev); if (cfg->iev) cfgdir_refdump(cfg->iev); list_for_each_entry(server, &cfg->servers, list) @@ -261,7 +261,7 @@ signalfd_init(struct cfg *cfg) perrordie("eventfd"); fprintf(stderr, "signalfd init: %i\n", sfd); - uring_task_init(&sev->task, "sev", &cfg->task, signalfd_free); + uring_task_init(&sev->task, "sev", uring_parent(cfg), signalfd_free); uring_task_set_fd(&sev->task, sfd); cfg->sev = sev; hack_efd = sfd; @@ -373,7 +373,7 @@ server_new(struct cfg *cfg, const char *name) scfg->type = SERVER_TYPE_UNDEFINED; scfg->name = strdup(name); scfg->running = false; - uring_task_init(&scfg->task, "scfg", &cfg->task, server_free); + uring_task_init(&scfg->task, "scfg", uring_parent(cfg), server_free); list_init(&scfg->remotes); list_init(&scfg->locals); list_init(&scfg->proxys); @@ -102,6 +102,18 @@ uring_task_close_fd(struct cfg *cfg, struct uring_task *task) task->fd = -1; } +struct uring_task * +uring_parent(struct cfg *cfg) +{ + if (!cfg) + die("%s: called with null cfg\n"); + + if (!cfg->uev) + die("%s: called with uninitialized uring\n"); + + return &cfg->uev->task; +} + void uring_task_init(struct uring_task *task, const char *name, struct uring_task *parent, void (*free)(struct uring_task *)) { @@ -11,6 +11,8 @@ void uring_task_set_fd(struct uring_task *task, int fd); void uring_task_close_fd(struct cfg *cfg, struct uring_task *task); +struct uring_task *uring_parent(struct cfg *cfg); + void uring_task_init(struct uring_task *task, const char *name, struct uring_task *parent, void (*free)(struct uring_task *)); |