]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename remaining management functions from cs_* to sc_*
authorWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 06:49:24 +0000 (08:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:35 +0000 (19:33 +0200)
This is the end of the renaming for the generic SC management functions
and macros:

cs_applet_process() -> sc_applet_process()
cs_attach_applet()  -> sc_attach_applet()
cs_attach_mux()     -> sc_attach_mux()
cs_attach_strm()    -> sc_attach_strm()
cs_detach_app()     -> sc_detach_app()
cs_detach_endp()    -> sc_detach_endp()
cs_notify()         -> sc_notify()
cs_reset_endp()     -> sc_reset_endp()
cs_state_in()       -> sc_state_in()
cs_update()         -> sc_update()
cs_update_rx()      -> sc_update_rx()
cs_update_tx()      -> sc_update_tx()
IS_HTX_CS()         -> IS_HTX_SC()

15 files changed:
include/haproxy/conn_stream.h
include/haproxy/cs_utils.h
src/backend.c
src/check.c
src/cli.c
src/conn_stream.c
src/hlua.c
src/http_ana.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_pt.c
src/payload.c
src/stream.c
src/tcpcheck.c

index d5c8b192da0c0040444cfa729cfabb1cd3ddf0ce..0e472856652555008789e6ba38291205c44e99ac 100644 (file)
@@ -33,7 +33,7 @@ struct appctx;
 struct stream;
 struct check;
 
-#define IS_HTX_CS(cs)     (sc_conn(cs) && IS_HTX_CONN(__sc_conn(cs)))
+#define IS_HTX_SC(cs)     (sc_conn(cs) && IS_HTX_CONN(__sc_conn(cs)))
 
 struct sedesc *sedesc_new();
 void sedesc_free(struct sedesc *sedesc);
@@ -43,11 +43,11 @@ struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags);
 struct stconn *sc_new_from_check(struct check *check, unsigned int flags);
 void sc_free(struct stconn *cs);
 
-int cs_attach_mux(struct stconn *cs, void *target, void *ctx);
-int cs_attach_strm(struct stconn *cs, struct stream *strm);
+int sc_attach_mux(struct stconn *cs, void *target, void *ctx);
+int sc_attach_strm(struct stconn *cs, struct stream *strm);
 
 void sc_destroy(struct stconn *cs);
-int cs_reset_endp(struct stconn *cs);
+int sc_reset_endp(struct stconn *cs);
 
 struct appctx *sc_applet_create(struct stconn *cs, struct applet *app);
 
index 7efe60ed29e49c3ff0146585a124f540e23b6396..2ea67d9ef07746a6fc1407769133390e7d26f850 100644 (file)
@@ -33,8 +33,8 @@
 #include <haproxy/session.h>
 #include <haproxy/stream.h>
 
-void cs_update_rx(struct stconn *cs);
-void cs_update_tx(struct stconn *cs);
+void sc_update_rx(struct stconn *cs);
+void sc_update_tx(struct stconn *cs);
 
 struct task *sc_conn_io_cb(struct task *t, void *ctx, unsigned int state);
 int sc_conn_sync_recv(struct stconn *cs);
@@ -340,11 +340,11 @@ static inline void cs_chk_snd(struct stconn *cs)
                cs->app_ops->chk_snd(cs);
 }
 
-/* Combines both cs_update_rx() and cs_update_tx() at once */
-static inline void cs_update(struct stconn *cs)
+/* Combines both sc_update_rx() and sc_update_tx() at once */
+static inline void sc_update(struct stconn *cs)
 {
-       cs_update_rx(cs);
-       cs_update_tx(cs);
+       sc_update_rx(cs);
+       sc_update_tx(cs);
 }
 
 /* for debugging, reports the stream connector state name */
index 2447813e8623d5eb08f33a78f7f498d26b0799f4..8b12afb3b2bd5056971d4b203e6ddf47e3b03007 100644 (file)
@@ -1576,7 +1576,7 @@ static int connect_server(struct stream *s)
                        if (avail >= 1) {
                                if (srv_conn->mux->attach(srv_conn, s->scb->sedesc, s->sess) == -1) {
                                        srv_conn = NULL;
-                                       if (cs_reset_endp(s->scb) < 0)
+                                       if (sc_reset_endp(s->scb) < 0)
                                                return SF_ERR_INTERNAL;
                                        sc_ep_clr(s->scb, ~SE_FL_DETACHED);
                                }
@@ -1651,7 +1651,7 @@ skip_reuse:
                        return SF_ERR_INTERNAL;  /* how did we get there ? */
                }
 
-               if (cs_attach_mux(s->scb, NULL, srv_conn) < 0) {
+               if (sc_attach_mux(s->scb, NULL, srv_conn) < 0) {
                        conn_free(srv_conn);
                        return SF_ERR_INTERNAL;  /* how did we get there ? */
                }
@@ -2369,7 +2369,7 @@ void back_handle_st_cer(struct stream *s)
         * Note: the stream connector will be switched to ST_REQ, ST_ASS or
         * ST_TAR and SE_FL_ERROR and SF_CONN_EXP flags will be unset.
         */
-       if (cs_reset_endp(cs) < 0) {
+       if (sc_reset_endp(cs) < 0) {
                if (!s->conn_err_type)
                        s->conn_err_type = STRM_ET_CONN_OTHER;
 
index 95203cb405a6d7cdb1c3a14c10db7df3c9caeac0..a7a7c517d9460afc53cd399ab2817eb8ee7a7335 100644 (file)
@@ -1148,7 +1148,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
                                TRACE_DEVEL("closing current connection", CHK_EV_TASK_WAKE|CHK_EV_HCHK_RUN, check);
                                check->state &= ~CHK_ST_CLOSE_CONN;
                                conn = NULL;
-                               if (!cs_reset_endp(check->cs)) {
+                               if (!sc_reset_endp(check->cs)) {
                                        /* error will be handled by tcpcheck_main().
                                         * On success, remove all flags except SE_FL_DETACHED
                                         */
index 1a1b41850bb160b7f251f87771ccc6c97cd49f19..685168b63aa185e7081b5c647a892fb7b8315f7d 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2768,7 +2768,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                 */
                if (!sc_conn_ready(s->scb)) {
                        s->srv_conn = NULL;
-                       if (cs_reset_endp(s->scb) < 0) {
+                       if (sc_reset_endp(s->scb) < 0) {
                                if (!s->conn_err_type)
                                        s->conn_err_type = STRM_ET_CONN_OTHER;
                                if (s->srv_error)
index a788b78bf5ed241b66e3b84fc6b5d82698d05ab2..4aabf1f5a57cdcc46bc1530d5a69f73d6ada94d7 100644 (file)
@@ -44,7 +44,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs);
 static int sc_conn_process(struct stconn *cs);
 static int sc_conn_recv(struct stconn *cs);
 static int sc_conn_send(struct stconn *cs);
-static int cs_applet_process(struct stconn *cs);
+static int sc_applet_process(struct stconn *cs);
 
 /* stream connector operations for connections */
 struct sc_app_ops sc_app_conn_ops = {
@@ -72,7 +72,7 @@ struct sc_app_ops sc_app_applet_ops = {
        .chk_snd = sc_app_chk_snd_applet,
        .shutr   = sc_app_shutr_applet,
        .shutw   = sc_app_shutw_applet,
-       .wake    = cs_applet_process,
+       .wake    = sc_applet_process,
        .name    = "STRM",
 };
 
@@ -247,7 +247,7 @@ static void sc_free_cond(struct stconn **csp)
  * -1 on error and 0 on sucess. SE_FL_DETACHED flag is removed. This function is
  * called from a mux when it is attached to a stream or a health-check.
  */
-int cs_attach_mux(struct stconn *cs, void *endp, void *ctx)
+int sc_attach_mux(struct stconn *cs, void *endp, void *ctx)
 {
        struct connection *conn = ctx;
        struct sedesc *sedesc = cs->sedesc;
@@ -290,7 +290,7 @@ int cs_attach_mux(struct stconn *cs, void *endp, void *ctx)
  * removed. This function is called by a stream when a backend applet is
  * registered.
  */
-static void cs_attach_applet(struct stconn *cs, void *endp)
+static void sc_attach_applet(struct stconn *cs, void *endp)
 {
        cs->sedesc->se = endp;
        sc_ep_set(cs, SE_FL_T_APPLET);
@@ -304,7 +304,7 @@ static void cs_attach_applet(struct stconn *cs, void *endp)
  * removed. This function is called by a stream when it is created to attach it
  * on the stream connector on the client side.
  */
-int cs_attach_strm(struct stconn *cs, struct stream *strm)
+int sc_attach_strm(struct stconn *cs, struct stream *strm)
 {
        cs->app = &strm->obj_type;
        sc_ep_clr(cs, SE_FL_ORPHAN);
@@ -334,7 +334,7 @@ int cs_attach_strm(struct stconn *cs, struct stream *strm)
  * endpoint is reset and flag as detached. If the app layer is also detached,
  * the stream connector is released.
  */
-static void cs_detach_endp(struct stconn **csp)
+static void sc_detach_endp(struct stconn **csp)
 {
        struct stconn *cs = *csp;
 
@@ -400,7 +400,7 @@ static void cs_detach_endp(struct stconn **csp)
 /* Detaches the stconn from the app layer. If there is no endpoint attached
  * to the stconn
  */
-static void cs_detach_app(struct stconn **csp)
+static void sc_detach_app(struct stconn **csp)
 {
        struct stconn *cs = *csp;
 
@@ -424,8 +424,8 @@ static void cs_detach_app(struct stconn **csp)
  */
 void sc_destroy(struct stconn *cs)
 {
-       cs_detach_endp(&cs);
-       cs_detach_app(&cs);
+       sc_detach_endp(&cs);
+       sc_detach_app(&cs);
        BUG_ON_HOT(cs);
 }
 
@@ -436,7 +436,7 @@ void sc_destroy(struct stconn *cs)
  * Only SE_FL_ERROR flag is removed on the endpoint. Orther flags are preserved.
  * It is the caller responsibility to remove other flags if needed.
  */
-int cs_reset_endp(struct stconn *cs)
+int sc_reset_endp(struct stconn *cs)
 {
        struct sedesc *new_endp;
 
@@ -449,7 +449,7 @@ int cs_reset_endp(struct stconn *cs)
                 * reset. The app is still attached, the cs will not be
                 * released.
                 */
-               cs_detach_endp(&cs);
+               sc_detach_endp(&cs);
                return 0;
        }
 
@@ -463,7 +463,7 @@ int cs_reset_endp(struct stconn *cs)
        se_fl_setall(new_endp, sc_ep_get(cs) & SE_FL_APP_MASK);
 
        /* The app is still attached, the cs will not be released */
-       cs_detach_endp(&cs);
+       sc_detach_endp(&cs);
        BUG_ON(cs->sedesc);
        cs->sedesc = new_endp;
        cs->sedesc->sc = cs;
@@ -474,7 +474,7 @@ int cs_reset_endp(struct stconn *cs)
 
 /* Create an applet to handle a stream connector as a new appctx. The CS will
  * wake it up every time it is solicited. The appctx must be deleted by the task
- * handler using cs_detach_endp(), possibly from within the function itself.
+ * handler using sc_detach_endp(), possibly from within the function itself.
  * It also pre-initializes the applet's context and returns it (or NULL in case
  * it could not be allocated).
  */
@@ -487,7 +487,7 @@ struct appctx *sc_applet_create(struct stconn *cs, struct applet *app)
        appctx = appctx_new_here(app, cs->sedesc);
        if (!appctx)
                return NULL;
-       cs_attach_applet(cs, appctx);
+       sc_attach_applet(cs, appctx);
        appctx->t->nice = __sc_strm(cs)->task->nice;
        applet_need_more_data(appctx);
        appctx_wakeup(appctx);
@@ -1006,7 +1006,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs)
  * handler, as what it does will be used to compute the stream task's
  * expiration.
  */
-void cs_update_rx(struct stconn *cs)
+void sc_update_rx(struct stconn *cs)
 {
        struct channel *ic = sc_ic(cs);
 
@@ -1048,7 +1048,7 @@ void cs_update_rx(struct stconn *cs)
  * handler, as what it does will be used to compute the stream task's
  * expiration.
  */
-void cs_update_tx(struct stconn *cs)
+void sc_update_tx(struct stconn *cs)
 {
        struct channel *oc = sc_oc(cs);
        struct channel *ic = sc_ic(cs);
@@ -1087,17 +1087,17 @@ void cs_update_tx(struct stconn *cs)
        }
 }
 
-/* This function is the equivalent to cs_update() except that it's
+/* This function is the equivalent to sc_update() except that it's
  * designed to be called from outside the stream handlers, typically the lower
  * layers (applets, connections) after I/O completion. After updating the stream
  * interface and timeouts, it will try to forward what can be forwarded, then to
  * wake the associated task up if an important event requires special handling.
  * It may update SE_FL_WAIT_DATA and/or SC_FL_NEED_ROOM, that the callers are
  * encouraged to watch to take appropriate action.
- * It should not be called from within the stream itself, cs_update()
+ * It should not be called from within the stream itself, sc_update()
  * is designed for this.
  */
-static void cs_notify(struct stconn *cs)
+static void sc_notify(struct stconn *cs)
 {
        struct channel *ic = sc_ic(cs);
        struct channel *oc = sc_oc(cs);
@@ -1879,7 +1879,7 @@ static int sc_conn_process(struct stconn *cs)
         * pending data, then possibly wake the stream up based on the new
         * stream connector status.
         */
-       cs_notify(cs);
+       sc_notify(cs);
        stream_release_buffers(__sc_strm(cs));
        return 0;
 }
@@ -1913,7 +1913,7 @@ struct task *sc_conn_io_cb(struct task *t, void *ctx, unsigned int state)
  * may re-enable the applet's based on the channels and stream connector's final
  * states.
  */
-static int cs_applet_process(struct stconn *cs)
+static int sc_applet_process(struct stconn *cs)
 {
        struct channel *ic = sc_ic(cs);
 
@@ -1933,10 +1933,10 @@ static int cs_applet_process(struct stconn *cs)
                applet_have_more_data(__sc_appctx(cs));
 
        /* update the stream connector, channels, and possibly wake the stream up */
-       cs_notify(cs);
+       sc_notify(cs);
        stream_release_buffers(__sc_strm(cs));
 
-       /* cs_notify may have passed through chk_snd and released some blocking
+       /* sc_notify may have passed through chk_snd and released some blocking
         * flags. Process_stream will consider those flags to wake up the
         * appctx but in the case the task is not in runqueue we may have to
         * wakeup the appctx immediately.
index 292d8f28a8be19c496f9ccb3897c5fab7691eac5..ddc5ff2435e9831866c99b8d5e5cff02db800e6c 100644 (file)
@@ -1977,7 +1977,7 @@ static void hlua_socket_handler(struct appctx *appctx)
         * interface.
         */
        if (!channel_is_empty(sc_ic(cs)))
-               cs_update(cs);
+               sc_update(cs);
 
        /* If write notifications are registered, we considers we want
         * to write, so we clear the blocking flag.
index 8a58287ba9b97141bbea9090cbc0bd3aa696b23e..d0ab21570bd0cc671b380a4d99c4bd040bbcfc31 100644 (file)
@@ -1263,7 +1263,7 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *cs)
        res->analyse_exp = TICK_ETERNITY;
        res->total = 0;
 
-       if (cs_reset_endp(s->scb) < 0) {
+       if (sc_reset_endp(s->scb) < 0) {
                if (!(s->flags & SF_ERR_MASK))
                        s->flags |= SF_ERR_INTERNAL;
                return -1;
index 058ab3bc268c15a0786c88c1c40ad249f80708fa..a78751b37aed08ca245541eb1b59eac9fda9b01f 100644 (file)
@@ -1135,7 +1135,7 @@ static struct fcgi_strm *fcgi_stconn_new(struct fcgi_conn *fconn, struct stconn
                TRACE_ERROR("fstream allocation failure", FCGI_EV_FSTRM_NEW|FCGI_EV_FSTRM_END|FCGI_EV_FSTRM_ERR, fconn->conn);
                goto out;
        }
-       if (cs_attach_mux(cs, fstrm, fconn->conn) < 0)
+       if (sc_attach_mux(cs, fstrm, fconn->conn) < 0)
                goto out;
        fstrm->endp = cs->sedesc;
        fstrm->sess = sess;
index 07b40de766aa8a5f4020841d7bb899cc79ac930e..a30500e0f8393c7b5dbcf3937c9cb62546cae1a6 100644 (file)
@@ -819,7 +819,7 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct stconn *cs, struct
                goto fail;
 
        if (cs) {
-               if (cs_attach_mux(cs, h1s, h1c->conn) < 0)
+               if (sc_attach_mux(cs, h1s, h1c->conn) < 0)
                        goto fail;
                h1s->endp = cs->sedesc;
        }
@@ -858,7 +858,7 @@ static struct h1s *h1c_bck_stream_new(struct h1c *h1c, struct stconn *cs, struct
        if (!h1s)
                goto fail;
 
-       if (cs_attach_mux(cs, h1s, h1c->conn) < 0)
+       if (sc_attach_mux(cs, h1s, h1c->conn) < 0)
                goto fail;
 
        h1s->flags |= H1S_F_RX_BLK;
index dde2392d07541175b355e84660951342177d0cbc..cfffd6978795fde544faf94df156f2642750a2d7 100644 (file)
@@ -1693,7 +1693,7 @@ static struct h2s *h2c_bck_stream_new(struct h2c *h2c, struct stconn *cs, struct
                goto out;
        }
 
-       if (cs_attach_mux(cs, h2s, h2c->conn) < 0) {
+       if (sc_attach_mux(cs, h2s, h2c->conn) < 0) {
                TRACE_ERROR("Failed to allocate a new stream", H2_EV_H2S_NEW, h2c->conn);
                h2s_destroy(h2s);
                h2s = NULL;
index 5f4c041ea2206c73e257887358169eb72580a208..acebdee522077f275367f7f6e5a98cce78645ce7 100644 (file)
@@ -316,7 +316,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio
                TRACE_POINT(PT_EV_STRM_NEW, conn, cs);
        }
        else {
-               if (cs_attach_mux(cs, ctx, conn) < 0)
+               if (sc_attach_mux(cs, ctx, conn) < 0)
                        goto fail_free_ctx;
                ctx->endp = cs->sedesc;
        }
@@ -386,7 +386,7 @@ static int mux_pt_attach(struct connection *conn, struct sedesc *endp, struct se
        TRACE_ENTER(PT_EV_STRM_NEW, conn);
        if (ctx->wait_event.events)
                conn->xprt->unsubscribe(ctx->conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event);
-       if (cs_attach_mux(endp->sc, ctx, conn) < 0)
+       if (sc_attach_mux(endp->sc, ctx, conn) < 0)
                return -1;
        ctx->endp = endp;
        se_fl_set(ctx->endp, SE_FL_RCV_MORE);
index 7e66f04084407a9d1657fa8449aaabd3df090a6f..08d5826d46a996f9a23f981bfd47685295ba35a8 100644 (file)
@@ -65,7 +65,7 @@ smp_fetch_len(const struct arg *args, struct sample *smp, const char *kw, void *
                struct check *check = __objt_check(smp->sess->origin);
 
                /* Not accurate but kept for backward compatibility purpose */
-               smp->data.u.sint = ((check->cs && IS_HTX_CS(check->cs)) ? (htxbuf(&check->bi))->data: b_data(&check->bi));
+               smp->data.u.sint = ((check->cs && IS_HTX_SC(check->cs)) ? (htxbuf(&check->bi))->data: b_data(&check->bi));
        }
        else
                return 0;
@@ -1020,7 +1020,7 @@ smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw
                struct check *check = __objt_check(smp->sess->origin);
 
                /* meaningless for HTX buffers */
-               if (check->cs && IS_HTX_CS(check->cs))
+               if (check->cs && IS_HTX_SC(check->cs))
                        return 0;
                head = b_head(&check->bi);
                data = b_data(&check->bi);
@@ -1089,7 +1089,7 @@ smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, v
                struct check *check = __objt_check(smp->sess->origin);
 
                /* meaningless for HTX buffers */
-               if (check->cs && IS_HTX_CS(check->cs))
+               if (check->cs && IS_HTX_SC(check->cs))
                        return 0;
                head = b_head(&check->bi);
                data = b_data(&check->bi);
index 3c9184cdc68d641bfbda7c41a30eca18d1b33295..b141f17c33b5d10313af22003787f1e7f6d5016a 100644 (file)
@@ -446,7 +446,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer
                s->flags |= SF_HTX;
 
        s->scf = cs;
-       if (cs_attach_strm(s->scf, s) < 0)
+       if (sc_attach_strm(s->scf, s) < 0)
                goto out_fail_attach_scf;
 
        s->scb = sc_new_from_strm(s, SC_FL_ISBACK);
@@ -1534,10 +1534,10 @@ static void stream_update_both_cs(struct stream *s)
 
        /* let's recompute both sides states */
        if (cs_state_in(scf->state, SC_SB_RDY|SC_SB_EST))
-               cs_update(scf);
+               sc_update(scf);
 
        if (cs_state_in(scb->state, SC_SB_RDY|SC_SB_EST))
-               cs_update(scb);
+               sc_update(scb);
 
        /* stream connectors are processed outside of process_stream() and must be
         * handled at the latest moment.
index d0d05256b7671049d9fdfb89c21e94f22eb64202..d0012a280eacef5a5f76cd79b5913985e8078947 100644 (file)
@@ -1100,7 +1100,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec
                TRACE_ERROR("stconn allocation error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
                goto out;
        }
-       if (cs_attach_mux(check->cs, NULL, conn) < 0) {
+       if (sc_attach_mux(check->cs, NULL, conn) < 0) {
                TRACE_ERROR("mux attach error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
                conn_free(conn);
                conn = NULL;
@@ -1569,7 +1569,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r
 
        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_CS(cs) ?  htx_free_space(htxbuf(&check->bi)) : b_room(&check->bi));
+               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);
                cur_read += read;
                if (!read ||
@@ -1580,7 +1580,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r
        }
 
   end_recv:
-       is_empty = (IS_HTX_CS(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
+       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))) {
                /* Report network errors only if we got no other data. Otherwise
                 * we'll let the upper layers decide whether the response is OK
@@ -2208,7 +2208,7 @@ int tcpcheck_main(struct check *check)
                        /* Refresh connection */
                        conn = sc_conn(cs);
                        last_read = 0;
-                       must_read = (IS_HTX_CS(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
+                       must_read = (IS_HTX_SC(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
                        break;
                case TCPCHK_ACT_SEND:
                        check->current_step = rule;