CLEANUP: check: Remove useless tests on check's stream-connector
Since the conn-stream refactoring, from the time the health-check is in
progress, its stream-connector is always defined. So, some tests on it are
useless and can be removed.
This patch should fix the issue #1739.
diff --git a/src/check.c b/src/check.c
index f717d09..f789959 100644
--- a/src/check.c
+++ b/src/check.c
@@ -789,8 +789,7 @@
if (conn && errno)
retrieve_errno_from_socket(conn);
- if (conn && !(conn->flags & CO_FL_ERROR) &&
- sc && !sc_ep_test(sc, SE_FL_ERROR) && !expired)
+ if (conn && !(conn->flags & CO_FL_ERROR) && !sc_ep_test(sc, SE_FL_ERROR) && !expired)
return;
TRACE_ENTER(CHK_EV_HCHK_END|CHK_EV_HCHK_ERR, check, 0, 0, (size_t[]){expired});
@@ -903,7 +902,7 @@
set_server_check_status(check, HCHK_STATUS_SOCKERR, err_msg);
}
- if (!sc || !conn || !conn->ctrl) {
+ if (!conn || !conn->ctrl) {
/* error before any connection attempt (connection allocation error or no control layer) */
set_server_check_status(check, HCHK_STATUS_SOCKERR, err_msg);
}
@@ -1035,7 +1034,7 @@
sc = check->sc;
conn = sc_conn(sc);
- if (unlikely(!conn || !sc || conn->flags & CO_FL_ERROR || sc_ep_test(sc, SE_FL_ERROR))) {
+ if (unlikely(!conn || conn->flags & CO_FL_ERROR || sc_ep_test(sc, SE_FL_ERROR))) {
/* We may get error reports bypassing the I/O handlers, typically
* the case when sending a pure TCP check which fails, then the I/O
* handlers above are not called. This is completely handled by the
@@ -1138,7 +1137,7 @@
*/
if (check->result == CHK_RES_UNKNOWN && likely(!(check->state & CHK_ST_PURGE))) {
sc = check->sc;
- conn = (sc ? sc_conn(sc) : NULL);
+ conn = sc_conn(sc);
/* Here the connection must be defined. Otherwise the
* error would have already been detected
@@ -1170,6 +1169,7 @@
/* check complete or aborted */
TRACE_STATE("health-check complete or aborted", CHK_EV_TASK_WAKE|CHK_EV_HCHK_END, check);
+ /* check->sc may be NULL when the healthcheck is purged */
check->current_step = NULL;
sc = check->sc;
conn = (sc ? sc_conn(sc) : NULL);