From: Christopher Faulet Date: Wed, 18 May 2022 12:35:49 +0000 (+0200) Subject: MEDIUM: check: No longer shutdown the connection in .wake callback function X-Git-Tag: v2.6-dev11~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08c8f8e20d269ada1afc5475ecba2a096b99a334;p=thirdparty%2Fhaproxy.git MEDIUM: check: No longer shutdown the connection in .wake callback function The connection is already closed by the health-check itself. Thus there is now reason to duplicate this part in the .wake callback function. It is enough to wake the health-check and wait. --- diff --git a/src/check.c b/src/check.c index 2da39af4d4..792c9aec6f 100644 --- a/src/check.c +++ b/src/check.c @@ -1024,6 +1024,9 @@ static int wake_srv_chk(struct conn_stream *cs) int ret = 0; TRACE_ENTER(CHK_EV_HCHK_WAKE, check); + if (check->result != CHK_RES_UNKNOWN) + goto end; + if (check->server) HA_SPIN_LOCK(SERVER_LOCK, &check->server->lock); else @@ -1048,21 +1051,9 @@ static int wake_srv_chk(struct conn_stream *cs) } if (check->result != CHK_RES_UNKNOWN || ret == -1) { - /* Check complete or aborted. If connection not yet closed do it - * now and wake the check task up to be sure the result is - * handled ASAP. */ + /* Check complete or aborted. Wake the check task up to be sure + * the result is handled ASAP. */ ret = -1; - if (conn) { - cs_conn_drain_and_shut(cs); - if (check->wait_list.events) - conn->mux->unsubscribe(cs, check->wait_list.events, &check->wait_list); - } - - /* We may have been scheduled to run, and the - * I/O handler expects to have a cs, so remove - * the tasklet - */ - tasklet_remove_from_tasklet_list(check->wait_list.tasklet); task_wakeup(check->task, TASK_WOKEN_IO); } @@ -1071,6 +1062,7 @@ static int wake_srv_chk(struct conn_stream *cs) else HA_SPIN_UNLOCK(EMAIL_ALERTS_LOCK, &q->lock); + end: TRACE_LEAVE(CHK_EV_HCHK_WAKE, check); return ret; }