CLEANUP: check: rename all occurrences of stconn "cs" to "sc"
The check struct had a "cs" field renamed to "sc", which also required
a tiny update to a few functions using it to distinguish a check from
a stream (log.c, payload.c, ssl_sample.c, tcp_sample.c, tcpcheck.c,
connection.c).
Function arguments and local variables called "cs" were renamed to "sc".
The presence of one "cs=" in the debugging traces was also turned to
"sc=" for consistency.
diff --git a/include/haproxy/check-t.h b/include/haproxy/check-t.h
index 4ad6ec8..7ce087f 100644
--- a/include/haproxy/check-t.h
+++ b/include/haproxy/check-t.h
@@ -150,7 +150,7 @@
struct session *sess; /* Health check session. */
struct vars vars; /* Health check dynamic variables. */
struct xprt_ops *xprt; /* transport layer operations for health checks */
- struct stconn *cs; /* stream connector used by health checks */
+ struct stconn *sc; /* stream connector used by health checks */
struct buffer bi, bo; /* input and output buffers to send/recv check */
struct buffer_wait buf_wait; /* Wait list for buffer allocation */
struct task *task; /* the task associated to the health check processing, NULL if disabled */
diff --git a/include/haproxy/check.h b/include/haproxy/check.h
index eb89951..485c494 100644
--- a/include/haproxy/check.h
+++ b/include/haproxy/check.h
@@ -82,7 +82,7 @@
const char *init_check(struct check *check, int type);
void free_check(struct check *check);
void check_purge(struct check *check);
-int wake_srv_chk(struct stconn *cs);
+int wake_srv_chk(struct stconn *sc);
int init_srv_check(struct server *srv);
int init_srv_agent_check(struct server *srv);
diff --git a/src/check.c b/src/check.c
index a7a7c51..f33e572 100644
--- a/src/check.c
+++ b/src/check.c
@@ -223,11 +223,11 @@
return;
- if (check->cs) {
- struct connection *conn = sc_conn(check->cs);
+ if (check->sc) {
+ struct connection *conn = sc_conn(check->sc);
chunk_appendf(&trace_buf, " - conn=%p(0x%08x)", conn, conn ? conn->flags : 0);
- chunk_appendf(&trace_buf, " cs=%p(0x%08x)", check->cs, check->cs->flags);
+ chunk_appendf(&trace_buf, " sc=%p(0x%08x)", check->sc, check->sc->flags);
}
if (mask & CHK_EV_TCPCHK) {
@@ -771,8 +771,8 @@
*/
void chk_report_conn_err(struct check *check, int errno_bck, int expired)
{
- struct stconn *cs = check->cs;
- struct connection *conn = sc_conn(cs);
+ struct stconn *sc = check->sc;
+ struct connection *conn = sc_conn(sc);
const char *err_msg;
struct buffer *chk;
int step;
@@ -786,7 +786,7 @@
retrieve_errno_from_socket(conn);
if (conn && !(conn->flags & CO_FL_ERROR) &&
- cs && !sc_ep_test(cs, SE_FL_ERROR) && !expired)
+ sc && !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});
@@ -899,13 +899,13 @@
set_server_check_status(check, HCHK_STATUS_SOCKERR, err_msg);
}
- if (!cs || !conn || !conn->ctrl) {
+ if (!sc || !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);
}
else if (conn->flags & CO_FL_WAIT_L4_CONN) {
/* L4 not established (yet) */
- if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, SE_FL_ERROR))
+ if (conn->flags & CO_FL_ERROR || sc_ep_test(sc, SE_FL_ERROR))
set_server_check_status(check, HCHK_STATUS_L4CON, err_msg);
else if (expired)
set_server_check_status(check, HCHK_STATUS_L4TOUT, err_msg);
@@ -920,12 +920,12 @@
}
else if (conn->flags & CO_FL_WAIT_L6_CONN) {
/* L6 not established (yet) */
- if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, SE_FL_ERROR))
+ if (conn->flags & CO_FL_ERROR || sc_ep_test(sc, SE_FL_ERROR))
set_server_check_status(check, HCHK_STATUS_L6RSP, err_msg);
else if (expired)
set_server_check_status(check, HCHK_STATUS_L6TOUT, err_msg);
}
- else if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, SE_FL_ERROR)) {
+ else if (conn->flags & CO_FL_ERROR || sc_ep_test(sc, SE_FL_ERROR)) {
/* I/O error after connection was established and before we could diagnose */
set_server_check_status(check, HCHK_STATUS_SOCKERR, err_msg);
}
@@ -1009,10 +1009,10 @@
* It returns 0 on normal cases, <0 if at least one close() has happened on the
* connection (eg: reconnect). It relies on tcpcheck_main().
*/
-int wake_srv_chk(struct stconn *cs)
+int wake_srv_chk(struct stconn *sc)
{
struct connection *conn;
- struct check *check = __sc_check(cs);
+ struct check *check = __sc_check(sc);
struct email_alertq *q = container_of(check, typeof(*q), check);
int ret = 0;
@@ -1028,10 +1028,10 @@
/* we may have to make progress on the TCP checks */
ret = tcpcheck_main(check);
- cs = check->cs;
- conn = sc_conn(cs);
+ sc = check->sc;
+ conn = sc_conn(sc);
- if (unlikely(!conn || !cs || conn->flags & CO_FL_ERROR || sc_ep_test(cs, SE_FL_ERROR))) {
+ if (unlikely(!conn || !sc || 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
@@ -1063,9 +1063,9 @@
/* This function checks if any I/O is wanted, and if so, attempts to do so */
struct task *srv_chk_io_cb(struct task *t, void *ctx, unsigned int state)
{
- struct stconn *cs = ctx;
+ struct stconn *sc = ctx;
- wake_srv_chk(cs);
+ wake_srv_chk(sc);
return NULL;
}
@@ -1079,7 +1079,7 @@
{
struct check *check = context;
struct proxy *proxy = check->proxy;
- struct stconn *cs;
+ struct stconn *sc;
struct connection *conn;
int rv;
int expired = tick_is_expired(t->expire, now_ms);
@@ -1119,8 +1119,8 @@
check->current_step = NULL;
- check->cs = sc_new_from_check(check, SC_FL_NONE);
- if (!check->cs) {
+ check->sc = sc_new_from_check(check, SC_FL_NONE);
+ if (!check->sc) {
set_server_check_status(check, HCHK_STATUS_SOCKERR, NULL);
goto end;
}
@@ -1133,13 +1133,13 @@
* which can happen on connect timeout or error.
*/
if (check->result == CHK_RES_UNKNOWN && likely(!(check->state & CHK_ST_PURGE))) {
- cs = check->cs;
- conn = (cs ? sc_conn(cs) : NULL);
+ sc = check->sc;
+ conn = (sc ? sc_conn(sc) : NULL);
/* Here the connection must be defined. Otherwise the
* error would have already been detected
*/
- if ((conn && ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR))) || expired) {
+ if ((conn && ((conn->flags & CO_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR))) || expired) {
TRACE_ERROR("report connection error", CHK_EV_TASK_WAKE|CHK_EV_HCHK_END|CHK_EV_HCHK_ERR, check);
chk_report_conn_err(check, 0, expired);
}
@@ -1148,11 +1148,11 @@
TRACE_DEVEL("closing current connection", CHK_EV_TASK_WAKE|CHK_EV_HCHK_RUN, check);
check->state &= ~CHK_ST_CLOSE_CONN;
conn = NULL;
- if (!sc_reset_endp(check->cs)) {
+ if (!sc_reset_endp(check->sc)) {
/* error will be handled by tcpcheck_main().
* On success, remove all flags except SE_FL_DETACHED
*/
- sc_ep_clr(check->cs, ~SE_FL_DETACHED);
+ sc_ep_clr(check->sc, ~SE_FL_DETACHED);
}
tcpcheck_main(check);
}
@@ -1167,8 +1167,8 @@
TRACE_STATE("health-check complete or aborted", CHK_EV_TASK_WAKE|CHK_EV_HCHK_END, check);
check->current_step = NULL;
- cs = check->cs;
- conn = (cs ? sc_conn(cs) : NULL);
+ sc = check->sc;
+ conn = (sc ? sc_conn(sc) : NULL);
if (conn && conn->xprt) {
/* The check was aborted and the connection was not yet closed.
@@ -1176,12 +1176,12 @@
* as a failed response coupled with "observe layer7" caused the
* server state to be suddenly changed.
*/
- sc_conn_drain_and_shut(cs);
+ sc_conn_drain_and_shut(sc);
}
- if (cs) {
- sc_destroy(cs);
- cs = check->cs = NULL;
+ if (sc) {
+ sc_destroy(sc);
+ sc = check->sc = NULL;
conn = NULL;
}
@@ -1265,18 +1265,18 @@
{
struct check *check = target;
- BUG_ON(!check->cs);
+ BUG_ON(!check->sc);
if ((check->state & CHK_ST_IN_ALLOC) && b_alloc(&check->bi)) {
TRACE_STATE("unblocking check, input buffer allocated", CHK_EV_TCPCHK_EXP|CHK_EV_RX_BLK, check);
check->state &= ~CHK_ST_IN_ALLOC;
- tasklet_wakeup(check->cs->wait_event.tasklet);
+ tasklet_wakeup(check->sc->wait_event.tasklet);
return 1;
}
if ((check->state & CHK_ST_OUT_ALLOC) && b_alloc(&check->bo)) {
TRACE_STATE("unblocking check, output buffer allocated", CHK_EV_TCPCHK_SND|CHK_EV_TX_BLK, check);
check->state &= ~CHK_ST_OUT_ALLOC;
- tasklet_wakeup(check->cs->wait_event.tasklet);
+ tasklet_wakeup(check->sc->wait_event.tasklet);
return 1;
}
@@ -1340,9 +1340,9 @@
check_release_buf(check, &check->bi);
check_release_buf(check, &check->bo);
- if (check->cs) {
- sc_destroy(check->cs);
- check->cs = NULL;
+ if (check->sc) {
+ sc_destroy(check->sc);
+ check->sc = NULL;
}
}
diff --git a/src/connection.c b/src/connection.c
index a9bbc74..6bd238a 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2103,7 +2103,7 @@
struct connection *conn = NULL;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[0] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[0] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -2200,7 +2200,7 @@
struct connection *conn;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[0] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[0] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -2227,7 +2227,7 @@
const char *err_code_str;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[0] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[0] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
diff --git a/src/log.c b/src/log.c
index 287d8a0..a5cf7b1 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1998,7 +1998,7 @@
be = ((obj_type(sess->origin) == OBJ_TYPE_CHECK) ? __objt_check(sess->origin)->proxy : fe);
txn = NULL;
fe_conn = objt_conn(sess->origin);
- be_conn = ((obj_type(sess->origin) == OBJ_TYPE_CHECK) ? sc_conn(__objt_check(sess->origin)->cs) : NULL);
+ be_conn = ((obj_type(sess->origin) == OBJ_TYPE_CHECK) ? sc_conn(__objt_check(sess->origin)->sc) : NULL);
status = 0;
s_flags = SF_ERR_PRXCOND | SF_FINST_R;
uniq_id = _HA_ATOMIC_FETCH_ADD(&global.req_count, 1);
diff --git a/src/payload.c b/src/payload.c
index 354ef5c..04d3a57 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -65,7 +65,7 @@
struct check *check = __objt_check(smp->sess->origin);
/* Not accurate but kept for backward compatibility purpose */
- smp->data.u.sint = ((check->cs && IS_HTX_SC(check->cs)) ? (htxbuf(&check->bi))->data: b_data(&check->bi));
+ smp->data.u.sint = ((check->sc && IS_HTX_SC(check->sc)) ? (htxbuf(&check->bi))->data: b_data(&check->bi));
}
else
return 0;
@@ -1020,7 +1020,7 @@
struct check *check = __objt_check(smp->sess->origin);
/* meaningless for HTX buffers */
- if (check->cs && IS_HTX_SC(check->cs))
+ if (check->sc && IS_HTX_SC(check->sc))
return 0;
head = b_head(&check->bi);
data = b_data(&check->bi);
@@ -1089,7 +1089,7 @@
struct check *check = __objt_check(smp->sess->origin);
/* meaningless for HTX buffers */
- if (check->cs && IS_HTX_SC(check->cs))
+ if (check->sc && IS_HTX_SC(check->sc))
return 0;
head = b_head(&check->bi);
data = b_data(&check->bi);
diff --git a/src/ssl_sample.c b/src/ssl_sample.c
index 6b5f794..35fcec3 100644
--- a/src/ssl_sample.c
+++ b/src/ssl_sample.c
@@ -1168,7 +1168,7 @@
struct connection *conn;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1205,7 +1205,7 @@
SSL *ssl;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1228,7 +1228,7 @@
SSL *ssl;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1262,7 +1262,7 @@
int sint;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1293,7 +1293,7 @@
SSL *ssl;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1325,7 +1325,7 @@
smp->data.type = SMP_T_STR;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1360,7 +1360,7 @@
smp->data.type = SMP_T_STR;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1393,7 +1393,7 @@
SSL *ssl;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1431,7 +1431,7 @@
smp->data.type = SMP_T_BIN;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1463,7 +1463,7 @@
SSL *ssl;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1500,7 +1500,7 @@
SSL *ssl;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1649,7 +1649,7 @@
struct ssl_sock_ctx *ctx;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1702,7 +1702,7 @@
const char *err_code_str;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
@@ -1932,7 +1932,7 @@
SSL *ssl;
if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->cs) : NULL;
+ conn = (kw[4] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? sc_conn(smp->strm->scb) : NULL;
diff --git a/src/tcp_sample.c b/src/tcp_sample.c
index 99bb514..2e8a621 100644
--- a/src/tcp_sample.c
+++ b/src/tcp_sample.c
@@ -52,7 +52,7 @@
if (kw[0] == 'b') { /* bc_src */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- ? sc_conn(__objt_check(smp->sess->origin)->cs)
+ ? sc_conn(__objt_check(smp->sess->origin)->sc)
: (smp->strm ? sc_conn(smp->strm->scb): NULL));
if (conn && conn_get_src(conn))
src = conn_src(conn);
@@ -96,7 +96,7 @@
if (kw[0] == 'b') { /* bc_src_port */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- ? sc_conn(__objt_check(smp->sess->origin)->cs)
+ ? sc_conn(__objt_check(smp->sess->origin)->sc)
: (smp->strm ? sc_conn(smp->strm->scb): NULL));
if (conn && conn_get_src(conn))
src = conn_src(conn);
@@ -131,7 +131,7 @@
if (kw[0] == 'b') { /* bc_dst */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- ? sc_conn(__objt_check(smp->sess->origin)->cs)
+ ? sc_conn(__objt_check(smp->sess->origin)->sc)
: (smp->strm ? sc_conn(smp->strm->scb): NULL));
if (conn && conn_get_dst(conn))
dst = conn_dst(conn);
@@ -227,7 +227,7 @@
if (kw[0] == 'b') { /* bc_dst_port */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
- ? sc_conn(__objt_check(smp->sess->origin)->cs)
+ ? sc_conn(__objt_check(smp->sess->origin)->sc)
: (smp->strm ? sc_conn(smp->strm->scb): NULL));
if (conn && conn_get_dst(conn))
dst = conn_dst(conn);
diff --git a/src/tcpcheck.c b/src/tcpcheck.c
index 62e28e2..da3d21f 100644
--- a/src/tcpcheck.c
+++ b/src/tcpcheck.c
@@ -821,7 +821,7 @@
const char *hs = NULL; /* health status */
const char *as = NULL; /* admin status */
const char *ps = NULL; /* performance status */
- const char *cs = NULL; /* maxconn */
+ const char *sc = NULL; /* maxconn */
const char *err = NULL; /* first error to report */
const char *wrn = NULL; /* first warning to report */
char *cmd, *p;
@@ -931,7 +931,7 @@
}
/* try to parse a maxconn here */
else if (strncasecmp(cmd, "maxconn:", strlen("maxconn:")) == 0) {
- cs = cmd;
+ sc = cmd;
}
else {
/* keep a copy of the first error */
@@ -976,16 +976,16 @@
wrn = msg;
}
- if (cs) {
+ if (sc) {
const char *msg;
- cs += strlen("maxconn:");
+ sc += strlen("maxconn:");
TRACE_DEVEL("change server maxconn", CHK_EV_TCPCHK_EXP, check);
/* This is safe to call server_parse_maxconn_change_request
* because the server lock is held during the check.
*/
- msg = server_parse_maxconn_change_request(check->server, cs);
+ msg = server_parse_maxconn_change_request(check->server, sc);
if (!wrn || !*wrn)
wrn = msg;
}
@@ -1056,7 +1056,7 @@
struct proxy *proxy = check->proxy;
struct server *s = check->server;
struct task *t = check->task;
- struct connection *conn = sc_conn(check->cs);
+ struct connection *conn = sc_conn(check->sc);
struct protocol *proto;
struct xprt_ops *xprt;
struct tcpcheck_rule *next;
@@ -1071,8 +1071,8 @@
if (conn->flags & CO_FL_WAIT_XPRT) {
/* We are still waiting for the connection establishment */
if (next && next->action == TCPCHK_ACT_SEND) {
- if (!(check->cs->wait_event.events & SUB_RETRY_SEND))
- conn->mux->subscribe(check->cs, SUB_RETRY_SEND, &check->cs->wait_event);
+ if (!(check->sc->wait_event.events & SUB_RETRY_SEND))
+ conn->mux->subscribe(check->sc, SUB_RETRY_SEND, &check->sc->wait_event);
ret = TCPCHK_EVAL_WAIT;
TRACE_DEVEL("not connected yet", CHK_EV_TCPCHK_CONN, check);
}
@@ -1082,7 +1082,7 @@
goto out;
}
- /* Note: here check->cs = cs = conn = NULL */
+ /* Note: here check->sc = sc = conn = NULL */
/* Always release input and output buffer when a new connect is evaluated */
check_release_buf(check, &check->bi);
@@ -1100,14 +1100,14 @@
TRACE_ERROR("stconn allocation error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
goto out;
}
- if (sc_attach_mux(check->cs, NULL, conn) < 0) {
+ if (sc_attach_mux(check->sc, NULL, conn) < 0) {
TRACE_ERROR("mux attach error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
conn_free(conn);
conn = NULL;
status = SF_ERR_RESOURCE;
goto fail_check;
}
- conn->ctx = check->cs;
+ conn->ctx = check->sc;
conn_set_owner(conn, check->sess, NULL);
/* no client address */
@@ -1198,7 +1198,7 @@
goto fail_check;
conn_set_private(conn);
- conn->ctx = check->cs;
+ conn->ctx = check->sc;
#ifdef USE_OPENSSL
if (connect->sni)
@@ -1247,7 +1247,7 @@
mux_ops = conn_get_best_mux(conn, IST_NULL, PROTO_SIDE_BE, mode);
}
- if (mux_ops && conn_install_mux(conn, mux_ops, check->cs, proxy, check->sess) < 0) {
+ if (mux_ops && conn_install_mux(conn, mux_ops, check->sc, proxy, check->sess) < 0) {
TRACE_ERROR("failed to install mux", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
status = SF_ERR_INTERNAL;
goto fail_check;
@@ -1294,9 +1294,9 @@
if (conn->flags & CO_FL_WAIT_XPRT) {
if (conn->mux) {
if (next && next->action == TCPCHK_ACT_SEND)
- conn->mux->subscribe(check->cs, SUB_RETRY_SEND, &check->cs->wait_event);
+ conn->mux->subscribe(check->sc, SUB_RETRY_SEND, &check->sc->wait_event);
else
- conn->mux->subscribe(check->cs, SUB_RETRY_RECV, &check->cs->wait_event);
+ conn->mux->subscribe(check->sc, SUB_RETRY_RECV, &check->sc->wait_event);
}
ret = TCPCHK_EVAL_WAIT;
TRACE_DEVEL("not connected yet", CHK_EV_TCPCHK_CONN, check);
@@ -1324,8 +1324,8 @@
{
enum tcpcheck_eval_ret ret = TCPCHK_EVAL_CONTINUE;
struct tcpcheck_send *send = &rule->send;
- struct stconn *cs = check->cs;
- struct connection *conn = __sc_conn(cs);
+ struct stconn *sc = check->sc;
+ struct connection *conn = __sc_conn(sc);
struct buffer *tmp = NULL;
struct htx *htx = NULL;
int connection_hdr = 0;
@@ -1482,16 +1482,16 @@
do_send:
TRACE_DATA("send data", CHK_EV_TCPCHK_SND|CHK_EV_TX_DATA, check);
- if (conn->mux->snd_buf(cs, &check->bo,
+ if (conn->mux->snd_buf(sc, &check->bo,
(IS_HTX_CONN(conn) ? (htxbuf(&check->bo))->data: b_data(&check->bo)), 0) <= 0) {
- if ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR)) {
+ if ((conn->flags & CO_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR)) {
ret = TCPCHK_EVAL_STOP;
TRACE_DEVEL("connection error during send", CHK_EV_TCPCHK_SND|CHK_EV_TX_DATA|CHK_EV_TX_ERR, check);
goto out;
}
}
if ((IS_HTX_CONN(conn) && !htx_is_empty(htxbuf(&check->bo))) || (!IS_HTX_CONN(conn) && b_data(&check->bo))) {
- conn->mux->subscribe(cs, SUB_RETRY_SEND, &cs->wait_event);
+ conn->mux->subscribe(sc, SUB_RETRY_SEND, &sc->wait_event);
ret = TCPCHK_EVAL_WAIT;
TRACE_DEVEL("data not fully sent, wait", CHK_EV_TCPCHK_SND|CHK_EV_TX_DATA, check);
goto out;
@@ -1534,8 +1534,8 @@
*/
enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_rule *rule)
{
- struct stconn *cs = check->cs;
- struct connection *conn = __sc_conn(cs);
+ struct stconn *sc = check->sc;
+ struct connection *conn = __sc_conn(sc);
enum tcpcheck_eval_ret ret = TCPCHK_EVAL_CONTINUE;
size_t max, read, cur_read = 0;
int is_empty;
@@ -1543,12 +1543,12 @@
TRACE_ENTER(CHK_EV_RX_DATA, check);
- if (cs->wait_event.events & SUB_RETRY_RECV) {
+ if (sc->wait_event.events & SUB_RETRY_RECV) {
TRACE_DEVEL("waiting for response", CHK_EV_RX_DATA, check);
goto wait_more_data;
}
- if (sc_ep_test(cs, SE_FL_EOS))
+ if (sc_ep_test(sc, SE_FL_EOS))
goto end_recv;
if (check->state & CHK_ST_IN_ALLOC) {
@@ -1565,23 +1565,23 @@
/* errors on the connection and the stream connector were already checked */
/* prepare to detect if the mux needs more room */
- sc_ep_clr(cs, SE_FL_WANT_ROOM);
+ sc_ep_clr(sc, SE_FL_WANT_ROOM);
- while (sc_ep_test(cs, SE_FL_RCV_MORE) ||
- (!(conn->flags & CO_FL_ERROR) && !sc_ep_test(cs, SE_FL_ERROR | SE_FL_EOS))) {
- max = (IS_HTX_SC(cs) ? htx_free_space(htxbuf(&check->bi)) : b_room(&check->bi));
- read = conn->mux->rcv_buf(cs, &check->bi, max, 0);
+ while (sc_ep_test(sc, SE_FL_RCV_MORE) ||
+ (!(conn->flags & CO_FL_ERROR) && !sc_ep_test(sc, SE_FL_ERROR | SE_FL_EOS))) {
+ max = (IS_HTX_SC(sc) ? htx_free_space(htxbuf(&check->bi)) : b_room(&check->bi));
+ read = conn->mux->rcv_buf(sc, &check->bi, max, 0);
cur_read += read;
if (!read ||
- sc_ep_test(cs, SE_FL_WANT_ROOM) ||
+ sc_ep_test(sc, SE_FL_WANT_ROOM) ||
(--read_poll <= 0) ||
(read < max && read >= global.tune.recv_enough))
break;
}
end_recv:
- is_empty = (IS_HTX_SC(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
- if (is_empty && ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR))) {
+ is_empty = (IS_HTX_SC(sc) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
+ if (is_empty && ((conn->flags & CO_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR))) {
/* Report network errors only if we got no other data. Otherwise
* we'll let the upper layers decide whether the response is OK
* or not. It is very common that an RST sent by the server is
@@ -1591,13 +1591,13 @@
goto stop;
}
if (!cur_read) {
- if (sc_ep_test(cs, SE_FL_EOI)) {
+ if (sc_ep_test(sc, SE_FL_EOI)) {
/* If EOI is set, it means there is a response or an error */
goto out;
}
- if (!sc_ep_test(cs, SE_FL_WANT_ROOM | SE_FL_ERROR | SE_FL_EOS)) {
- conn->mux->subscribe(cs, SUB_RETRY_RECV, &cs->wait_event);
+ if (!sc_ep_test(sc, SE_FL_WANT_ROOM | SE_FL_ERROR | SE_FL_EOS)) {
+ conn->mux->subscribe(sc, SUB_RETRY_RECV, &sc->wait_event);
TRACE_DEVEL("waiting for response", CHK_EV_RX_DATA, check);
goto wait_more_data;
}
@@ -2125,8 +2125,8 @@
int tcpcheck_main(struct check *check)
{
struct tcpcheck_rule *rule;
- struct stconn *cs = check->cs;
- struct connection *conn = sc_conn(cs);
+ struct stconn *sc = check->sc;
+ struct connection *conn = sc_conn(sc);
int must_read = 1, last_read = 0;
int retcode = 0;
enum tcpcheck_eval_ret eval_ret;
@@ -2139,11 +2139,11 @@
/* Note: the stream connector and the connection may only be undefined before
* the first rule evaluation (it is always a connect rule) or when the
- * stream connector allocation failed on a connect rule, during cs allocation.
+ * stream connector allocation failed on a connect rule, during sc allocation.
*/
/* 1- check for connection error, if any */
- if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR))
+ if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR))
goto out_end_tcpcheck;
/* 2- check if a rule must be resume. It happens if check->current_step
@@ -2188,7 +2188,7 @@
switch (rule->action) {
case TCPCHK_ACT_CONNECT:
/* Not the first connection, release it first */
- if (sc_conn(cs) && check->current_step != rule) {
+ if (sc_conn(sc) && check->current_step != rule) {
check->state |= CHK_ST_CLOSE_CONN;
retcode = -1;
}
@@ -2196,7 +2196,7 @@
check->current_step = rule;
/* We are still waiting the connection gets closed */
- if (cs && (check->state & CHK_ST_CLOSE_CONN)) {
+ if (sc && (check->state & CHK_ST_CLOSE_CONN)) {
TRACE_DEVEL("wait previous connection closure", CHK_EV_TCPCHK_EVAL|CHK_EV_TCPCHK_CONN, check);
eval_ret = TCPCHK_EVAL_WAIT;
break;
@@ -2206,9 +2206,9 @@
eval_ret = tcpcheck_eval_connect(check, rule);
/* Refresh connection */
- conn = sc_conn(cs);
+ conn = sc_conn(sc);
last_read = 0;
- must_read = (IS_HTX_SC(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
+ must_read = (IS_HTX_SC(sc) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
break;
case TCPCHK_ACT_SEND:
check->current_step = rule;
@@ -2225,7 +2225,7 @@
goto out_end_tcpcheck;
else if (eval_ret == TCPCHK_EVAL_WAIT)
goto out;
- last_read = ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR | SE_FL_EOS));
+ last_read = ((conn->flags & CO_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR | SE_FL_EOS));
must_read = 0;
}
@@ -2235,8 +2235,8 @@
if (eval_ret == TCPCHK_EVAL_WAIT) {
check->current_step = rule->expect.head;
- if (!(cs->wait_event.events & SUB_RETRY_RECV))
- conn->mux->subscribe(cs, SUB_RETRY_RECV, &cs->wait_event);
+ if (!(sc->wait_event.events & SUB_RETRY_RECV))
+ conn->mux->subscribe(sc, SUB_RETRY_RECV, &sc->wait_event);
}
break;
case TCPCHK_ACT_ACTION_KW:
@@ -2306,7 +2306,7 @@
TRACE_PROTO("tcp-check passed", CHK_EV_TCPCHK_EVAL, check);
out_end_tcpcheck:
- if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR)) {
+ if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR)) {
TRACE_ERROR("report connection error", CHK_EV_TCPCHK_EVAL|CHK_EV_TCPCHK_ERR, check);
chk_report_conn_err(check, errno, 0);
}