diff options
Diffstat (limited to 'announce.c')
-rw-r--r-- | announce.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -22,13 +22,16 @@ mcast_free(struct uring_task *task) { struct announce *aev = container_of(task, struct announce, mcast_task); - fprintf(stderr, "%s: called with task 0x%p and aev 0x%p\n", __func__, task, aev); + debug(DBG_ANN, "task %p, aev %p\n", task, aev); } static void mcast_sent(struct cfg *cfg, struct uring_task *task, int res) { - fprintf(stderr, "%s: result %i\n", __func__, res); + if (res < 0) + error("failure %i\n", res); + else + debug(DBG_ANN, "result %i\n", res); } static void @@ -44,7 +47,7 @@ mcast_send(struct cfg *cfg, struct announce *aev, struct server *server) server->pretty_name, server->announce_port); if (len < 1 || len >= sizeof(server->mcast_buf.buf)) { - error("%s: snprintf returned %i\n", __func__, len); + error("snprintf returned %i\n", len); return; } @@ -59,7 +62,7 @@ mcast_send_all(struct cfg *cfg, struct announce *aev) struct server *server; list_for_each_entry(server, &cfg->servers, list) { - fprintf(stderr, "Announcing server: %s\n", server->name); + verbose("Announcing server: %s\n", server->name); mcast_send(cfg, aev, server); } } @@ -69,17 +72,17 @@ announce_cb(struct cfg *cfg, struct uring_task *task, int res) { struct announce *aev = container_of(task, struct announce, task); - fprintf(stderr, "%s: ret is %i (ref %u)\n", __func__, res, task->refcount); + debug(DBG_ANN, "res %i\n", res); if (task->dead) { - fprintf(stderr, "%s: task is dead\n", __func__); + debug(DBG_ANN, "task is dead\n"); return; } if (res != sizeof(aev->value)) perrordie("timerfd_read"); - fprintf(stderr, "%s: called with value %" PRIu64 "\n", __func__, aev->value); + debug(DBG_ANN, "timerfd value %" PRIu64 "\n", aev->value); mcast_send_all(cfg, aev); uring_read(cfg, &aev->task, &aev->value, sizeof(aev->value), announce_cb); } @@ -89,7 +92,7 @@ announce_free(struct uring_task *task) { struct announce *aev = container_of(task, struct announce, task); - fprintf(stderr, "%s: called with task 0x%p and aev 0x%p\n", __func__, task, aev); + debug(DBG_ANN, "task %p, aev 0x%p\n", task, aev); xfree(aev); } @@ -107,11 +110,11 @@ void announce_delete(struct cfg *cfg) { if (!cfg->aev) { - fprintf(stderr, "%s called with no announce!\n", __func__); + error("missing parameters\n"); return; } - fprintf(stderr, "%s called, closing fd %i\n", __func__, cfg->aev->task.fd); + debug(DBG_ANN, "closing fd %i\n", cfg->aev->task.fd); uring_task_destroy(cfg, &cfg->aev->mcast_task); uring_task_destroy(cfg, &cfg->aev->task); cfg->aev = NULL; |