From e11014c0443ea687ad65a14b9124aa366da7984a Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sat, 20 Jun 2020 12:53:25 +0200 Subject: Introduce helper for checking if a task is dead --- utils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'utils.c') diff --git a/utils.c b/utils.c index 8c7b663..b07fdff 100644 --- a/utils.c +++ b/utils.c @@ -237,6 +237,8 @@ connect_next(struct cfg *cfg, struct uring_task *task, struct connection *conn) unsigned i; again: + assert_task_alive_or(DBG_UR, task, goto out); + i = 0; remote = NULL; list_for_each_entry(tmp, conn->addrs, list) { @@ -250,8 +252,7 @@ again: if (!remote) { debug(DBG_UR, "%s: no more remote addresses to attempt\n", task->name); - conn->callback(cfg, conn, false); - return; + goto out; } conn->next_addr++; @@ -270,6 +271,10 @@ again: task->priv = conn; uring_task_set_fd(task, sfd); uring_connect(cfg, task, &conn->remote, connect_cb); + return; + +out: + conn->callback(cfg, conn, false); } void -- cgit v1.2.3