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.
This commit is contained in:
Willy Tarreau 2017-10-04 15:19:26 +02:00
parent 1e62e2a780
commit d7c3fbd5c3

View File

@ -1916,7 +1916,6 @@ static struct task *process_chk_proc(struct task *t)
{ {
struct check *check = t->context; struct check *check = t->context;
struct server *s = check->server; struct server *s = check->server;
struct connection *conn = check->conn;
int rv; int rv;
int ret; int ret;
int expired = tick_is_expired(t->expire, now_ms); 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; check->state |= CHK_ST_INPROGRESS;
ret = connect_proc_chk(t); ret = connect_proc_chk(t);
switch (ret) { if (ret == SF_ERR_NONE) {
case SF_ERR_NONE:
/* the process was forked, we allow up to min(inter, /* the process was forked, we allow up to min(inter,
* timeout.connect) for it to report its status, but * timeout.connect) for it to report its status, but
* only when timeout.check is set as it may be to short * 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; goto reschedule;
default:
conn->flags |= CO_FL_ERROR;
chk_report_conn_err(check, 0, 0);
break;
} }
/* here, we failed to start the check */ /* here, we failed to start the check */