summaryrefslogtreecommitdiff
path: root/proxy.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-20 12:53:25 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-20 12:53:25 +0200
commite11014c0443ea687ad65a14b9124aa366da7984a (patch)
tree8c6642ed187dc71cc672cec9f3459aa75134eaa5 /proxy.c
parentfc25e880dfb1f804742006bcdd15ac70d18b4144 (diff)
Introduce helper for checking if a task is dead
Diffstat (limited to 'proxy.c')
-rw-r--r--proxy.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/proxy.c b/proxy.c
index bcc2b6d..7fb6c34 100644
--- a/proxy.c
+++ b/proxy.c
@@ -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);