CLEANUP: stconn: rename remaining management functions from cs_* to sc_*

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()
This commit is contained in:
Willy Tarreau 2022-05-27 08:49:24 +02:00
parent a0b58b537d
commit 19c65a9ded
15 changed files with 56 additions and 56 deletions

View File

@ -33,7 +33,7 @@ struct appctx;
struct stream; struct stream;
struct check; 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(); struct sedesc *sedesc_new();
void sedesc_free(struct sedesc *sedesc); 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); struct stconn *sc_new_from_check(struct check *check, unsigned int flags);
void sc_free(struct stconn *cs); void sc_free(struct stconn *cs);
int cs_attach_mux(struct stconn *cs, void *target, void *ctx); int sc_attach_mux(struct stconn *cs, void *target, void *ctx);
int cs_attach_strm(struct stconn *cs, struct stream *strm); int sc_attach_strm(struct stconn *cs, struct stream *strm);
void sc_destroy(struct stconn *cs); 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); struct appctx *sc_applet_create(struct stconn *cs, struct applet *app);

View File

@ -33,8 +33,8 @@
#include <haproxy/session.h> #include <haproxy/session.h>
#include <haproxy/stream.h> #include <haproxy/stream.h>
void cs_update_rx(struct stconn *cs); void sc_update_rx(struct stconn *cs);
void cs_update_tx(struct stconn *cs); void sc_update_tx(struct stconn *cs);
struct task *sc_conn_io_cb(struct task *t, void *ctx, unsigned int state); struct task *sc_conn_io_cb(struct task *t, void *ctx, unsigned int state);
int sc_conn_sync_recv(struct stconn *cs); 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); cs->app_ops->chk_snd(cs);
} }
/* Combines both cs_update_rx() and cs_update_tx() at once */ /* Combines both sc_update_rx() and sc_update_tx() at once */
static inline void cs_update(struct stconn *cs) static inline void sc_update(struct stconn *cs)
{ {
cs_update_rx(cs); sc_update_rx(cs);
cs_update_tx(cs); sc_update_tx(cs);
} }
/* for debugging, reports the stream connector state name */ /* for debugging, reports the stream connector state name */

View File

@ -1576,7 +1576,7 @@ static int connect_server(struct stream *s)
if (avail >= 1) { if (avail >= 1) {
if (srv_conn->mux->attach(srv_conn, s->scb->sedesc, s->sess) == -1) { if (srv_conn->mux->attach(srv_conn, s->scb->sedesc, s->sess) == -1) {
srv_conn = NULL; srv_conn = NULL;
if (cs_reset_endp(s->scb) < 0) if (sc_reset_endp(s->scb) < 0)
return SF_ERR_INTERNAL; return SF_ERR_INTERNAL;
sc_ep_clr(s->scb, ~SE_FL_DETACHED); sc_ep_clr(s->scb, ~SE_FL_DETACHED);
} }
@ -1651,7 +1651,7 @@ skip_reuse:
return SF_ERR_INTERNAL; /* how did we get there ? */ 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); conn_free(srv_conn);
return SF_ERR_INTERNAL; /* how did we get there ? */ 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 * 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. * 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) if (!s->conn_err_type)
s->conn_err_type = STRM_ET_CONN_OTHER; s->conn_err_type = STRM_ET_CONN_OTHER;

View 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); TRACE_DEVEL("closing current connection", CHK_EV_TASK_WAKE|CHK_EV_HCHK_RUN, check);
check->state &= ~CHK_ST_CLOSE_CONN; check->state &= ~CHK_ST_CLOSE_CONN;
conn = NULL; conn = NULL;
if (!cs_reset_endp(check->cs)) { if (!sc_reset_endp(check->cs)) {
/* error will be handled by tcpcheck_main(). /* error will be handled by tcpcheck_main().
* On success, remove all flags except SE_FL_DETACHED * On success, remove all flags except SE_FL_DETACHED
*/ */

View File

@ -2768,7 +2768,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
*/ */
if (!sc_conn_ready(s->scb)) { if (!sc_conn_ready(s->scb)) {
s->srv_conn = NULL; s->srv_conn = NULL;
if (cs_reset_endp(s->scb) < 0) { if (sc_reset_endp(s->scb) < 0) {
if (!s->conn_err_type) if (!s->conn_err_type)
s->conn_err_type = STRM_ET_CONN_OTHER; s->conn_err_type = STRM_ET_CONN_OTHER;
if (s->srv_error) if (s->srv_error)

View 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_process(struct stconn *cs);
static int sc_conn_recv(struct stconn *cs); static int sc_conn_recv(struct stconn *cs);
static int sc_conn_send(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 */ /* stream connector operations for connections */
struct sc_app_ops sc_app_conn_ops = { 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, .chk_snd = sc_app_chk_snd_applet,
.shutr = sc_app_shutr_applet, .shutr = sc_app_shutr_applet,
.shutw = sc_app_shutw_applet, .shutw = sc_app_shutw_applet,
.wake = cs_applet_process, .wake = sc_applet_process,
.name = "STRM", .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 * -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. * 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 connection *conn = ctx;
struct sedesc *sedesc = cs->sedesc; 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 * removed. This function is called by a stream when a backend applet is
* registered. * 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; cs->sedesc->se = endp;
sc_ep_set(cs, SE_FL_T_APPLET); 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 * removed. This function is called by a stream when it is created to attach it
* on the stream connector on the client side. * 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; cs->app = &strm->obj_type;
sc_ep_clr(cs, SE_FL_ORPHAN); 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, * endpoint is reset and flag as detached. If the app layer is also detached,
* the stream connector is released. * 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; 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 /* Detaches the stconn from the app layer. If there is no endpoint attached
* to the stconn * to the stconn
*/ */
static void cs_detach_app(struct stconn **csp) static void sc_detach_app(struct stconn **csp)
{ {
struct stconn *cs = *csp; struct stconn *cs = *csp;
@ -424,8 +424,8 @@ static void cs_detach_app(struct stconn **csp)
*/ */
void sc_destroy(struct stconn *cs) void sc_destroy(struct stconn *cs)
{ {
cs_detach_endp(&cs); sc_detach_endp(&cs);
cs_detach_app(&cs); sc_detach_app(&cs);
BUG_ON_HOT(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. * 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. * 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; 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 * reset. The app is still attached, the cs will not be
* released. * released.
*/ */
cs_detach_endp(&cs); sc_detach_endp(&cs);
return 0; 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); se_fl_setall(new_endp, sc_ep_get(cs) & SE_FL_APP_MASK);
/* The app is still attached, the cs will not be released */ /* The app is still attached, the cs will not be released */
cs_detach_endp(&cs); sc_detach_endp(&cs);
BUG_ON(cs->sedesc); BUG_ON(cs->sedesc);
cs->sedesc = new_endp; cs->sedesc = new_endp;
cs->sedesc->sc = cs; 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 /* 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 * 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 also pre-initializes the applet's context and returns it (or NULL in case
* it could not be allocated). * 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); appctx = appctx_new_here(app, cs->sedesc);
if (!appctx) if (!appctx)
return NULL; return NULL;
cs_attach_applet(cs, appctx); sc_attach_applet(cs, appctx);
appctx->t->nice = __sc_strm(cs)->task->nice; appctx->t->nice = __sc_strm(cs)->task->nice;
applet_need_more_data(appctx); applet_need_more_data(appctx);
appctx_wakeup(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 * handler, as what it does will be used to compute the stream task's
* expiration. * expiration.
*/ */
void cs_update_rx(struct stconn *cs) void sc_update_rx(struct stconn *cs)
{ {
struct channel *ic = sc_ic(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 * handler, as what it does will be used to compute the stream task's
* expiration. * expiration.
*/ */
void cs_update_tx(struct stconn *cs) void sc_update_tx(struct stconn *cs)
{ {
struct channel *oc = sc_oc(cs); struct channel *oc = sc_oc(cs);
struct channel *ic = sc_ic(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 * designed to be called from outside the stream handlers, typically the lower
* layers (applets, connections) after I/O completion. After updating the stream * 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 * 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. * 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 * It may update SE_FL_WAIT_DATA and/or SC_FL_NEED_ROOM, that the callers are
* encouraged to watch to take appropriate action. * 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. * 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 *ic = sc_ic(cs);
struct channel *oc = sc_oc(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 * pending data, then possibly wake the stream up based on the new
* stream connector status. * stream connector status.
*/ */
cs_notify(cs); sc_notify(cs);
stream_release_buffers(__sc_strm(cs)); stream_release_buffers(__sc_strm(cs));
return 0; 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 * may re-enable the applet's based on the channels and stream connector's final
* states. * states.
*/ */
static int cs_applet_process(struct stconn *cs) static int sc_applet_process(struct stconn *cs)
{ {
struct channel *ic = sc_ic(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)); applet_have_more_data(__sc_appctx(cs));
/* update the stream connector, channels, and possibly wake the stream up */ /* update the stream connector, channels, and possibly wake the stream up */
cs_notify(cs); sc_notify(cs);
stream_release_buffers(__sc_strm(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 * 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 * appctx but in the case the task is not in runqueue we may have to
* wakeup the appctx immediately. * wakeup the appctx immediately.

View File

@ -1977,7 +1977,7 @@ static void hlua_socket_handler(struct appctx *appctx)
* interface. * interface.
*/ */
if (!channel_is_empty(sc_ic(cs))) if (!channel_is_empty(sc_ic(cs)))
cs_update(cs); sc_update(cs);
/* If write notifications are registered, we considers we want /* If write notifications are registered, we considers we want
* to write, so we clear the blocking flag. * to write, so we clear the blocking flag.

View File

@ -1263,7 +1263,7 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *cs)
res->analyse_exp = TICK_ETERNITY; res->analyse_exp = TICK_ETERNITY;
res->total = 0; res->total = 0;
if (cs_reset_endp(s->scb) < 0) { if (sc_reset_endp(s->scb) < 0) {
if (!(s->flags & SF_ERR_MASK)) if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_INTERNAL; s->flags |= SF_ERR_INTERNAL;
return -1; return -1;

View 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); TRACE_ERROR("fstream allocation failure", FCGI_EV_FSTRM_NEW|FCGI_EV_FSTRM_END|FCGI_EV_FSTRM_ERR, fconn->conn);
goto out; goto out;
} }
if (cs_attach_mux(cs, fstrm, fconn->conn) < 0) if (sc_attach_mux(cs, fstrm, fconn->conn) < 0)
goto out; goto out;
fstrm->endp = cs->sedesc; fstrm->endp = cs->sedesc;
fstrm->sess = sess; fstrm->sess = sess;

View File

@ -819,7 +819,7 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct stconn *cs, struct
goto fail; goto fail;
if (cs) { if (cs) {
if (cs_attach_mux(cs, h1s, h1c->conn) < 0) if (sc_attach_mux(cs, h1s, h1c->conn) < 0)
goto fail; goto fail;
h1s->endp = cs->sedesc; h1s->endp = cs->sedesc;
} }
@ -858,7 +858,7 @@ static struct h1s *h1c_bck_stream_new(struct h1c *h1c, struct stconn *cs, struct
if (!h1s) if (!h1s)
goto fail; goto fail;
if (cs_attach_mux(cs, h1s, h1c->conn) < 0) if (sc_attach_mux(cs, h1s, h1c->conn) < 0)
goto fail; goto fail;
h1s->flags |= H1S_F_RX_BLK; h1s->flags |= H1S_F_RX_BLK;

View File

@ -1693,7 +1693,7 @@ static struct h2s *h2c_bck_stream_new(struct h2c *h2c, struct stconn *cs, struct
goto out; 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); TRACE_ERROR("Failed to allocate a new stream", H2_EV_H2S_NEW, h2c->conn);
h2s_destroy(h2s); h2s_destroy(h2s);
h2s = NULL; h2s = NULL;

View 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); TRACE_POINT(PT_EV_STRM_NEW, conn, cs);
} }
else { else {
if (cs_attach_mux(cs, ctx, conn) < 0) if (sc_attach_mux(cs, ctx, conn) < 0)
goto fail_free_ctx; goto fail_free_ctx;
ctx->endp = cs->sedesc; 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); TRACE_ENTER(PT_EV_STRM_NEW, conn);
if (ctx->wait_event.events) if (ctx->wait_event.events)
conn->xprt->unsubscribe(ctx->conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event); 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; return -1;
ctx->endp = endp; ctx->endp = endp;
se_fl_set(ctx->endp, SE_FL_RCV_MORE); se_fl_set(ctx->endp, SE_FL_RCV_MORE);

View 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); struct check *check = __objt_check(smp->sess->origin);
/* Not accurate but kept for backward compatibility purpose */ /* 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 else
return 0; 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); struct check *check = __objt_check(smp->sess->origin);
/* meaningless for HTX buffers */ /* meaningless for HTX buffers */
if (check->cs && IS_HTX_CS(check->cs)) if (check->cs && IS_HTX_SC(check->cs))
return 0; return 0;
head = b_head(&check->bi); head = b_head(&check->bi);
data = b_data(&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); struct check *check = __objt_check(smp->sess->origin);
/* meaningless for HTX buffers */ /* meaningless for HTX buffers */
if (check->cs && IS_HTX_CS(check->cs)) if (check->cs && IS_HTX_SC(check->cs))
return 0; return 0;
head = b_head(&check->bi); head = b_head(&check->bi);
data = b_data(&check->bi); data = b_data(&check->bi);

View File

@ -446,7 +446,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer
s->flags |= SF_HTX; s->flags |= SF_HTX;
s->scf = cs; s->scf = cs;
if (cs_attach_strm(s->scf, s) < 0) if (sc_attach_strm(s->scf, s) < 0)
goto out_fail_attach_scf; goto out_fail_attach_scf;
s->scb = sc_new_from_strm(s, SC_FL_ISBACK); 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 */ /* let's recompute both sides states */
if (cs_state_in(scf->state, SC_SB_RDY|SC_SB_EST)) 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)) 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 /* stream connectors are processed outside of process_stream() and must be
* handled at the latest moment. * handled at the latest moment.

View 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); TRACE_ERROR("stconn allocation error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
goto out; 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); TRACE_ERROR("mux attach error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
conn_free(conn); conn_free(conn);
conn = NULL; 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) || while (sc_ep_test(cs, SE_FL_RCV_MORE) ||
(!(conn->flags & CO_FL_ERROR) && !sc_ep_test(cs, SE_FL_ERROR | SE_FL_EOS))) { (!(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); read = conn->mux->rcv_buf(cs, &check->bi, max, 0);
cur_read += read; cur_read += read;
if (!read || if (!read ||
@ -1580,7 +1580,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r
} }
end_recv: 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))) { 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 /* Report network errors only if we got no other data. Otherwise
* we'll let the upper layers decide whether the response is OK * we'll let the upper layers decide whether the response is OK
@ -2208,7 +2208,7 @@ int tcpcheck_main(struct check *check)
/* Refresh connection */ /* Refresh connection */
conn = sc_conn(cs); conn = sc_conn(cs);
last_read = 0; 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; break;
case TCPCHK_ACT_SEND: case TCPCHK_ACT_SEND:
check->current_step = rule; check->current_step = rule;