diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-20 12:53:25 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-20 12:53:25 +0200 |
commit | e11014c0443ea687ad65a14b9124aa366da7984a (patch) | |
tree | 8c6642ed187dc71cc672cec9f3459aa75134eaa5 /proxy.c | |
parent | fc25e880dfb1f804742006bcdd15ac70d18b4144 (diff) |
Introduce helper for checking if a task is dead
Diffstat (limited to 'proxy.c')
-rw-r--r-- | proxy.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -122,6 +122,8 @@ proxy_client_data_out(struct cfg *cfg, struct uring_task *task, int res) { struct server_proxy *proxy = container_of(task, struct server_proxy, clienttask); + assert_task_alive(DBG_PROXY, task); + if (res <= 0) { debug(DBG_PROXY, "%s: result was %i\n", proxy->scfg->name, res); uring_task_close_fd(cfg, task); @@ -139,6 +141,8 @@ proxy_client_data_in(struct cfg *cfg, struct uring_task *task, int res) { struct server_proxy *proxy = container_of(task, struct server_proxy, clienttask); + assert_task_alive(DBG_PROXY, task); + if (res <= 0) { debug(DBG_PROXY, "%s: result was %i\n", proxy->scfg->name, res); uring_task_close_fd(cfg, task); @@ -157,6 +161,8 @@ proxy_server_data_out(struct cfg *cfg, struct uring_task *task, int res) { struct server_proxy *proxy = container_of(task, struct server_proxy, servertask); + assert_task_alive(DBG_PROXY, task); + if (res <= 0) { debug(DBG_PROXY, "%s: result was %i\n", proxy->scfg->name, res); uring_task_close_fd(cfg, task); @@ -174,6 +180,8 @@ proxy_server_data_in(struct cfg *cfg, struct uring_task *task, int res) { struct server_proxy *proxy = container_of(task, struct server_proxy, servertask); + assert_task_alive(DBG_PROXY, task); + if (res <= 0) { debug(DBG_PROXY, "%s: result was %i\n", proxy->scfg->name, res); uring_task_close_fd(cfg, task); @@ -190,6 +198,9 @@ proxy_connected_cb(struct cfg *cfg, struct connection *conn, bool connected) { struct server_proxy *proxy = container_of(conn, struct server_proxy, server_conn); + assert_task_alive(DBG_PROXY, &proxy->clienttask); + assert_task_alive(DBG_PROXY, &proxy->servertask); + if (!connected) { error("%s: proxy connection to remote server failed\n", proxy->scfg->name); |