From d7c3fbd5c304b695a73fc530b0472a276b1b4217 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 4 Oct 2017 15:19:26 +0200 Subject: [PATCH] CLEANUP: checks: don't report report the fork() error twice Upon fork() error, a first report is immediately made by connect_proc_chk() via set_server_check_status(), then process_chk_proc() detects the error code and makes up a dummy connection error to call chk_report_conn_err(), which tries to retrieve the errno code from the connection, fails, then saves the status message from the check, fails all "if" tests on its path related to the connection then resets the check's state to the current one with the current status message. All this useless chain is the only reason why process checks require a connection! Let's simply get rid of this second useless call. --- src/checks.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/checks.c b/src/checks.c index 8e06e8cc7..3284b53f3 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1916,7 +1916,6 @@ static struct task *process_chk_proc(struct task *t) { struct check *check = t->context; struct server *s = check->server; - struct connection *conn = check->conn; int rv; int ret; int expired = tick_is_expired(t->expire, now_ms); @@ -1940,8 +1939,7 @@ static struct task *process_chk_proc(struct task *t) check->state |= CHK_ST_INPROGRESS; ret = connect_proc_chk(t); - switch (ret) { - case SF_ERR_NONE: + if (ret == SF_ERR_NONE) { /* the process was forked, we allow up to min(inter, * timeout.connect) for it to report its status, but * only when timeout.check is set as it may be to short @@ -1955,11 +1953,6 @@ static struct task *process_chk_proc(struct task *t) } goto reschedule; - - default: - conn->flags |= CO_FL_ERROR; - chk_report_conn_err(check, 0, 0); - break; } /* here, we failed to start the check */