CLEANUP: stconn: replace a few remaining occurrences of CS in comments or traces

A few "CS" desginating stconns were still present in code comments and
stream traces. This addresses them.
This commit is contained in:
Willy Tarreau 2022-05-27 11:23:05 +02:00
parent 1d2c79a53c
commit e68bc6178a
7 changed files with 65 additions and 65 deletions

View File

@ -132,7 +132,7 @@ static inline int sc_conn_ready(const struct stconn *sc)
* states, before plugging a mux. Thus it should only care about CO_FL_ERROR * states, before plugging a mux. Thus it should only care about CO_FL_ERROR
* before SC_ST_EST, and after that it must absolutely ignore it since the mux * before SC_ST_EST, and after that it must absolutely ignore it since the mux
* may hold pending data. This function returns true if such an error was * may hold pending data. This function returns true if such an error was
* reported. Both the CS and the CONN must be valid. * reported. Both the SC and the CONN must be valid.
*/ */
static inline int sc_is_conn_error(const struct stconn *sc) static inline int sc_is_conn_error(const struct stconn *sc)
{ {
@ -166,7 +166,7 @@ static inline int sc_alloc_ibuf(struct stconn *sc, struct buffer_wait *wait)
/* Returns the source address of the stream connector and, if not set, fallbacks on /* Returns the source address of the stream connector and, if not set, fallbacks on
* the session for frontend CS and the server connection for the backend CS. It * the session for frontend SC and the server connection for the backend SC. It
* returns a const address on success or NULL on failure. * returns a const address on success or NULL on failure.
*/ */
static inline const struct sockaddr_storage *sc_src(const struct stconn *sc) static inline const struct sockaddr_storage *sc_src(const struct stconn *sc)
@ -186,8 +186,8 @@ static inline const struct sockaddr_storage *sc_src(const struct stconn *sc)
/* Returns the destination address of the stream connector and, if not set, fallbacks /* Returns the destination address of the stream connector and, if not set, fallbacks
* on the session for frontend CS and the server connection for the backend * on the session for frontend SC and the server connection for the backend
* CS. It returns a const address on success or NULL on failure. * SC. It returns a const address on success or NULL on failure.
*/ */
static inline const struct sockaddr_storage *sc_dst(const struct stconn *sc) static inline const struct sockaddr_storage *sc_dst(const struct stconn *sc)
{ {
@ -207,8 +207,8 @@ static inline const struct sockaddr_storage *sc_dst(const struct stconn *sc)
/* Retrieves the source address of the stream connector. Returns non-zero on success /* Retrieves the source address of the stream connector. Returns non-zero on success
* or zero on failure. The operation is only performed once and the address is * or zero on failure. The operation is only performed once and the address is
* stored in the stream connector for future use. On the first call, the stream connector * stored in the stream connector for future use. On the first call, the stream connector
* source address is copied from the session one for frontend CS and the server * source address is copied from the session one for frontend SC and the server
* connection for the backend CS. * connection for the backend SC.
*/ */
static inline int sc_get_src(struct stconn *sc) static inline int sc_get_src(struct stconn *sc)
{ {
@ -238,7 +238,7 @@ static inline int sc_get_src(struct stconn *sc)
* success or zero on failure. The operation is only performed once and the * success or zero on failure. The operation is only performed once and the
* address is stored in the stream connector for future use. On the first call, the * address is stored in the stream connector for future use. On the first call, the
* stream connector destination address is copied from the session one for frontend * stream connector destination address is copied from the session one for frontend
* CS and the server connection for the backend CS. * SC and the server connection for the backend SC.
*/ */
static inline int sc_get_dst(struct stconn *sc) static inline int sc_get_dst(struct stconn *sc)
{ {

View File

@ -70,7 +70,7 @@ enum se_flags {
* the endpoint : * the endpoint :
*/ */
SE_FL_WAIT_FOR_HS = 0x00200000, /* This stream is waiting for handhskae */ SE_FL_WAIT_FOR_HS = 0x00200000, /* This stream is waiting for handhskae */
SE_FL_KILL_CONN = 0x00400000, /* must kill the connection when the CS closes */ SE_FL_KILL_CONN = 0x00400000, /* must kill the connection when the SC closes */
SE_FL_WAIT_DATA = 0x00800000, /* stream endpoint cannot work without more data from the stream's output */ SE_FL_WAIT_DATA = 0x00800000, /* stream endpoint cannot work without more data from the stream's output */
SE_FL_WILL_CONSUME = 0x01000000, /* stream endpoint is interested in consuming more data */ SE_FL_WILL_CONSUME = 0x01000000, /* stream endpoint is interested in consuming more data */
SE_FL_HAVE_NO_DATA = 0x02000000, /* the endpoint has no more data to deliver to the stream */ SE_FL_HAVE_NO_DATA = 0x02000000, /* the endpoint has no more data to deliver to the stream */
@ -106,17 +106,17 @@ enum sc_flags {
* do not last beyond process_session(). * do not last beyond process_session().
*/ */
enum sc_state { enum sc_state {
SC_ST_INI = 0, /* CS not sollicitated yet */ SC_ST_INI = 0, /* SC not sollicitated yet */
SC_ST_REQ, /* [transient] connection initiation desired and not started yet */ SC_ST_REQ, /* [transient] connection initiation desired and not started yet */
SC_ST_QUE, /* CS waiting in queue */ SC_ST_QUE, /* SC waiting in queue */
SC_ST_TAR, /* CS in turn-around state after failed connect attempt */ SC_ST_TAR, /* SC in turn-around state after failed connect attempt */
SC_ST_ASS, /* server just assigned to this CS */ SC_ST_ASS, /* server just assigned to this SC */
SC_ST_CON, /* initiated connection request (resource exists) */ SC_ST_CON, /* initiated connection request (resource exists) */
SC_ST_CER, /* [transient] previous connection attempt failed (resource released) */ SC_ST_CER, /* [transient] previous connection attempt failed (resource released) */
SC_ST_RDY, /* [transient] ready proven after I/O success during SC_ST_CON */ SC_ST_RDY, /* [transient] ready proven after I/O success during SC_ST_CON */
SC_ST_EST, /* connection established (resource exists) */ SC_ST_EST, /* connection established (resource exists) */
SC_ST_DIS, /* [transient] disconnected from other side, but cleanup not done yet */ SC_ST_DIS, /* [transient] disconnected from other side, but cleanup not done yet */
SC_ST_CLO, /* CS closed, might not existing anymore. Buffers shut. */ SC_ST_CLO, /* SC closed, might not existing anymore. Buffers shut. */
} __attribute__((packed)); } __attribute__((packed));
/* state bits for use with lists of states */ /* state bits for use with lists of states */
@ -180,7 +180,7 @@ struct sc_app_ops {
*/ */
struct stconn { struct stconn {
enum obj_type obj_type; /* differentiates connection from applet context */ enum obj_type obj_type; /* differentiates connection from applet context */
enum sc_state state; /* CS_ST* */ enum sc_state state; /* SC_ST* */
/* 2 bytes hole here */ /* 2 bytes hole here */
unsigned int flags; /* SC_FL_* */ unsigned int flags; /* SC_FL_* */

View File

@ -2170,8 +2170,8 @@ void back_handle_st_req(struct stream *s)
if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) { if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) {
struct appctx *appctx; struct appctx *appctx;
/* The target is an applet but the CS is in SC_ST_REQ. Thus it /* The target is an applet but the SC is in SC_ST_REQ. Thus it
* means no appctx are attached to the CS. Otherwise, it will be * means no appctx are attached to the SC. Otherwise, it will be
* in SC_ST_RDY state. So, try to create the appctx now. * in SC_ST_RDY state. So, try to create the appctx now.
*/ */
BUG_ON(sc_appctx(sc)); BUG_ON(sc_appctx(sc));
@ -2444,7 +2444,7 @@ void back_handle_st_rdy(struct stream *s)
DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) { if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) {
/* Here the appctx must exists because the CS was set to /* Here the appctx must exists because the SC was set to
* SC_ST_RDY state when the appctx was created. * SC_ST_RDY state when the appctx was created.
*/ */
BUG_ON(!sc_appctx(s->scb)); BUG_ON(!sc_appctx(s->scb));

View File

@ -628,7 +628,7 @@ static void h1_refresh_timeout(struct h1c *h1c)
else { else {
/* alive back connections of front connections with a stream connector attached */ /* alive back connections of front connections with a stream connector attached */
h1c->task->expire = TICK_ETERNITY; h1c->task->expire = TICK_ETERNITY;
TRACE_DEVEL("no connection timeout (alive back h1c or front h1c with a CS)", H1_EV_H1C_SEND|H1_EV_H1C_RECV, h1c->conn); TRACE_DEVEL("no connection timeout (alive back h1c or front h1c with an SC)", H1_EV_H1C_SEND|H1_EV_H1C_RECV, h1c->conn);
} }
/* Finally set the idle expiration date if shorter */ /* Finally set the idle expiration date if shorter */
@ -696,7 +696,7 @@ static void h1_set_idle_expiration(struct h1c *h1c)
TRACE_DEVEL("set idle expiration (http-request timeout)", H1_EV_H1C_RECV, h1c->conn); TRACE_DEVEL("set idle expiration (http-request timeout)", H1_EV_H1C_RECV, h1c->conn);
} }
} }
else { // CS_ATTACHED or SHUTDOWN else { // ST_ATTACHED or SHUTDOWN
h1c->idle_exp = TICK_ETERNITY; h1c->idle_exp = TICK_ETERNITY;
TRACE_DEVEL("unset idle expiration (attached || shutdown)", H1_EV_H1C_RECV, h1c->conn); TRACE_DEVEL("unset idle expiration (attached || shutdown)", H1_EV_H1C_RECV, h1c->conn);
} }
@ -733,7 +733,7 @@ static struct stconn *h1s_new_sc(struct h1s *h1s, struct buffer *input)
se_fl_set(h1s->endp, SE_FL_WEBSOCKET); se_fl_set(h1s->endp, SE_FL_WEBSOCKET);
if (!sc_new_from_endp(h1s->endp, h1c->conn->owner, input)) { if (!sc_new_from_endp(h1s->endp, h1c->conn->owner, input)) {
TRACE_ERROR("CS allocation failure", H1_EV_STRM_NEW|H1_EV_STRM_END|H1_EV_STRM_ERR, h1c->conn, h1s); TRACE_ERROR("SC allocation failure", H1_EV_STRM_NEW|H1_EV_STRM_END|H1_EV_STRM_ERR, h1c->conn, h1s);
goto err; goto err;
} }
@ -1009,9 +1009,9 @@ static int h1_init(struct connection *conn, struct proxy *proxy, struct session
if (!h1c_frt_stream_new(h1c, conn_ctx, h1c->conn->owner)) if (!h1c_frt_stream_new(h1c, conn_ctx, h1c->conn->owner))
goto fail; goto fail;
/* Attach the CS but Not ready yet */ /* Attach the SC but Not ready yet */
h1c->flags = (h1c->flags & ~H1C_F_ST_EMBRYONIC) | H1C_F_ST_ATTACHED; h1c->flags = (h1c->flags & ~H1C_F_ST_EMBRYONIC) | H1C_F_ST_ATTACHED;
TRACE_DEVEL("Inherit the CS from TCP connection to perform an upgrade", TRACE_DEVEL("Inherit the SC from TCP connection to perform an upgrade",
H1_EV_H1C_NEW|H1_EV_STRM_NEW, h1c->conn, h1c->h1s); H1_EV_H1C_NEW|H1_EV_STRM_NEW, h1c->conn, h1c->h1s);
} }
@ -1878,7 +1878,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
h1_release_buf(h1c, &h1c->ibuf); h1_release_buf(h1c, &h1c->ibuf);
if (!(h1c->flags & H1C_F_ST_READY)) { if (!(h1c->flags & H1C_F_ST_READY)) {
/* The H1 connection is not ready. Most of time, there is no CS /* The H1 connection is not ready. Most of time, there is no SC
* attached, except for TCP>H1 upgrade, from a TCP frontend. In both * attached, except for TCP>H1 upgrade, from a TCP frontend. In both
* cases, it is only possible on the client side. * cases, it is only possible on the client side.
*/ */
@ -1891,7 +1891,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
} }
if (!(h1c->flags & H1C_F_ST_ATTACHED)) { if (!(h1c->flags & H1C_F_ST_ATTACHED)) {
TRACE_DEVEL("request headers fully parsed, create and attach the CS", H1_EV_RX_DATA, h1c->conn, h1s); TRACE_DEVEL("request headers fully parsed, create and attach the SC", H1_EV_RX_DATA, h1c->conn, h1s);
BUG_ON(h1s_sc(h1s)); BUG_ON(h1s_sc(h1s));
if (!h1s_new_sc(h1s, buf)) { if (!h1s_new_sc(h1s, buf)) {
h1c->flags |= H1C_F_ST_ERROR; h1c->flags |= H1C_F_ST_ERROR;
@ -1899,7 +1899,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
} }
} }
else { else {
TRACE_DEVEL("request headers fully parsed, upgrade the inherited CS", H1_EV_RX_DATA, h1c->conn, h1s); TRACE_DEVEL("request headers fully parsed, upgrade the inherited SC", H1_EV_RX_DATA, h1c->conn, h1s);
BUG_ON(h1s_sc(h1s) == NULL); BUG_ON(h1s_sc(h1s) == NULL);
if (!h1s_upgrade_sc(h1s, buf)) { if (!h1s_upgrade_sc(h1s, buf)) {
h1c->flags |= H1C_F_ST_ERROR; h1c->flags |= H1C_F_ST_ERROR;
@ -1952,7 +1952,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
} }
else if (h1m->state > H1_MSG_LAST_LF && h1m->state < H1_MSG_DONE) { else if (h1m->state > H1_MSG_LAST_LF && h1m->state < H1_MSG_DONE) {
se_fl_set(h1s->endp, SE_FL_ERROR); se_fl_set(h1s->endp, SE_FL_ERROR);
TRACE_ERROR("message aborted, set error on CS", H1_EV_RX_DATA|H1_EV_H1S_ERR, h1c->conn, h1s); TRACE_ERROR("message aborted, set error on SC", H1_EV_RX_DATA|H1_EV_H1S_ERR, h1c->conn, h1s);
} }
if (h1s->flags & H1S_F_TX_BLK) { if (h1s->flags & H1S_F_TX_BLK) {
@ -2962,7 +2962,7 @@ static int h1_process(struct h1c * h1c)
if (b_isteq(&h1c->ibuf, 0, b_data(&h1c->ibuf), ist(H2_CONN_PREFACE)) > 0) { if (b_isteq(&h1c->ibuf, 0, b_data(&h1c->ibuf), ist(H2_CONN_PREFACE)) > 0) {
h1c->flags |= H1C_F_UPG_H2C; h1c->flags |= H1C_F_UPG_H2C;
if (h1c->flags & H1C_F_ST_ATTACHED) { if (h1c->flags & H1C_F_ST_ATTACHED) {
/* Force the REOS here to be sure to release the CS. /* Force the REOS here to be sure to release the SC.
Here ATTACHED implies !READY, and h1s defined Here ATTACHED implies !READY, and h1s defined
*/ */
BUG_ON(!h1s || (h1c->flags & H1C_F_ST_READY)); BUG_ON(!h1s || (h1c->flags & H1C_F_ST_READY));
@ -3111,7 +3111,7 @@ static int h1_process(struct h1c * h1c)
release: release:
if (h1c->flags & H1C_F_ST_ATTACHED) { if (h1c->flags & H1C_F_ST_ATTACHED) {
/* Don't release the H1 connection right now, we must destroy the /* Don't release the H1 connection right now, we must destroy the
* attached CS first. Here, the H1C must not be READY */ * attached SC first. Here, the H1C must not be READY */
BUG_ON(!h1s || h1c->flags & H1C_F_ST_READY); BUG_ON(!h1s || h1c->flags & H1C_F_ST_READY);
if (conn_xprt_read0_pending(conn) || (h1s->flags & H1S_F_REOS)) if (conn_xprt_read0_pending(conn) || (h1s->flags & H1S_F_REOS))
@ -3119,7 +3119,7 @@ static int h1_process(struct h1c * h1c)
if ((h1c->flags & H1C_F_ST_ERROR) || (conn->flags & CO_FL_ERROR)) if ((h1c->flags & H1C_F_ST_ERROR) || (conn->flags & CO_FL_ERROR))
se_fl_set(h1s->endp, SE_FL_ERROR); se_fl_set(h1s->endp, SE_FL_ERROR);
h1_alert(h1s); h1_alert(h1s);
TRACE_DEVEL("waiting to release the CS before releasing the connection", H1_EV_H1C_WAKE); TRACE_DEVEL("waiting to release the SC before releasing the connection", H1_EV_H1C_WAKE);
} }
else { else {
h1_release(h1c); h1_release(h1c);
@ -3249,7 +3249,7 @@ struct task *h1_timeout_task(struct task *t, void *context, unsigned int state)
if (h1c->flags & H1C_F_ST_READY) { if (h1c->flags & H1C_F_ST_READY) {
HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock);
t->expire = TICK_ETERNITY; t->expire = TICK_ETERNITY;
TRACE_DEVEL("leaving (CS still attached)", H1_EV_H1C_WAKE, h1c->conn, h1c->h1s); TRACE_DEVEL("leaving (SC still attached)", H1_EV_H1C_WAKE, h1c->conn, h1c->h1s);
return t; return t;
} }
@ -3268,12 +3268,12 @@ struct task *h1_timeout_task(struct task *t, void *context, unsigned int state)
if (h1c->flags & H1C_F_ST_ATTACHED) { if (h1c->flags & H1C_F_ST_ATTACHED) {
/* Don't release the H1 connection right now, we must destroy the /* Don't release the H1 connection right now, we must destroy the
* attached CS first. Here, the H1C must not be READY */ * attached SC first. Here, the H1C must not be READY */
se_fl_set(h1c->h1s->endp, SE_FL_EOS | SE_FL_ERROR); se_fl_set(h1c->h1s->endp, SE_FL_EOS | SE_FL_ERROR);
h1_alert(h1c->h1s); h1_alert(h1c->h1s);
h1_refresh_timeout(h1c); h1_refresh_timeout(h1c);
HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].idle_conns_lock); HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].idle_conns_lock);
TRACE_DEVEL("waiting to release the CS before releasing the connection", H1_EV_H1C_WAKE); TRACE_DEVEL("waiting to release the SC before releasing the connection", H1_EV_H1C_WAKE);
return t; return t;
} }
@ -3493,7 +3493,7 @@ static void h1_shutr(struct stconn *sc, enum co_shr_mode mode)
} }
if (!(h1c->flags & (H1C_F_ST_READY|H1C_F_ST_ERROR))) { if (!(h1c->flags & (H1C_F_ST_READY|H1C_F_ST_ERROR))) {
/* Here attached is implicit because there is CS */ /* Here attached is implicit because there is SC */
TRACE_STATE("keep connection alive (ALIVE but not READY nor ERROR)", H1_EV_STRM_SHUT, h1c->conn, h1s); TRACE_STATE("keep connection alive (ALIVE but not READY nor ERROR)", H1_EV_STRM_SHUT, h1c->conn, h1s);
goto end; goto end;
} }
@ -3536,7 +3536,7 @@ static void h1_shutw(struct stconn *sc, enum co_shw_mode mode)
} }
if (!(h1c->flags & (H1C_F_ST_READY|H1C_F_ST_ERROR))) { if (!(h1c->flags & (H1C_F_ST_READY|H1C_F_ST_ERROR))) {
/* Here attached is implicit because there is CS */ /* Here attached is implicit because there is SC */
TRACE_STATE("keep connection alive (ALIVE but not READY nor ERROR)", H1_EV_STRM_SHUT, h1c->conn, h1s); TRACE_STATE("keep connection alive (ALIVE but not READY nor ERROR)", H1_EV_STRM_SHUT, h1c->conn, h1s);
goto end; goto end;
} }

View File

@ -254,7 +254,7 @@ struct task *mux_pt_io_cb(struct task *t, void *tctx, unsigned int status)
ctx->conn->subs = NULL; ctx->conn->subs = NULL;
} else if (pt_sc(ctx)->app_ops->wake) } else if (pt_sc(ctx)->app_ops->wake)
pt_sc(ctx)->app_ops->wake(pt_sc(ctx)); pt_sc(ctx)->app_ops->wake(pt_sc(ctx));
TRACE_DEVEL("leaving waking up CS", PT_EV_CONN_WAKE, ctx->conn); TRACE_DEVEL("leaving waking up SC", PT_EV_CONN_WAKE, ctx->conn);
return t; return t;
} }
conn_ctrl_drain(ctx->conn); conn_ctrl_drain(ctx->conn);
@ -301,7 +301,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio
if (!sc) { if (!sc) {
ctx->endp = sedesc_new(); ctx->endp = sedesc_new();
if (!ctx->endp) { if (!ctx->endp) {
TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn); TRACE_ERROR("SC allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn);
goto fail_free_ctx; goto fail_free_ctx;
} }
ctx->endp->se = ctx; ctx->endp->se = ctx;
@ -310,7 +310,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio
sc = sc_new_from_endp(ctx->endp, sess, input); sc = sc_new_from_endp(ctx->endp, sess, input);
if (!sc) { if (!sc) {
TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn); TRACE_ERROR("SC allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn);
goto fail_free_endp; goto fail_free_endp;
} }
TRACE_POINT(PT_EV_STRM_NEW, conn, sc); TRACE_POINT(PT_EV_STRM_NEW, conn, sc);
@ -352,7 +352,7 @@ static int mux_pt_wake(struct connection *conn)
ret = pt_sc(ctx)->app_ops->wake ? pt_sc(ctx)->app_ops->wake(pt_sc(ctx)) : 0; ret = pt_sc(ctx)->app_ops->wake ? pt_sc(ctx)->app_ops->wake(pt_sc(ctx)) : 0;
if (ret < 0) { if (ret < 0) {
TRACE_DEVEL("leaving waking up CS", PT_EV_CONN_WAKE, ctx->conn); TRACE_DEVEL("leaving waking up SC", PT_EV_CONN_WAKE, ctx->conn);
return ret; return ret;
} }
} else { } else {

View File

@ -230,15 +230,15 @@ void sc_free(struct stconn *sc)
/* Conditionally removes a stream connector if it is detached and if there is no app /* Conditionally removes a stream connector if it is detached and if there is no app
* layer defined. Except on error path, this one must be used. if release, the * layer defined. Except on error path, this one must be used. if release, the
* pointer on the CS is set to NULL. * pointer on the SC is set to NULL.
*/ */
static void sc_free_cond(struct stconn **csp) static void sc_free_cond(struct stconn **scp)
{ {
struct stconn *sc = *csp; struct stconn *sc = *scp;
if (!sc->app && (!sc->sedesc || sc_ep_test(sc, SE_FL_DETACHED))) { if (!sc->app && (!sc->sedesc || sc_ep_test(sc, SE_FL_DETACHED))) {
sc_free(sc); sc_free(sc);
*csp = NULL; *scp = NULL;
} }
} }
@ -334,9 +334,9 @@ int sc_attach_strm(struct stconn *sc, 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 sc_detach_endp(struct stconn **csp) static void sc_detach_endp(struct stconn **scp)
{ {
struct stconn *sc = *csp; struct stconn *sc = *scp;
if (!sc) if (!sc)
return; return;
@ -386,7 +386,7 @@ static void sc_detach_endp(struct stconn **csp)
} }
reset_cs: reset_cs:
/* FIXME: Rest CS for now but must be reviewed. CS flags are only /* FIXME: Rest SC for now but must be reviewed. SC flags are only
* connection related for now but this will evolved * connection related for now but this will evolved
*/ */
sc->flags &= SC_FL_ISBACK; sc->flags &= SC_FL_ISBACK;
@ -394,15 +394,15 @@ static void sc_detach_endp(struct stconn **csp)
sc->app_ops = &sc_app_embedded_ops; sc->app_ops = &sc_app_embedded_ops;
else else
sc->app_ops = NULL; sc->app_ops = NULL;
sc_free_cond(csp); sc_free_cond(scp);
} }
/* 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 sc_detach_app(struct stconn **csp) static void sc_detach_app(struct stconn **scp)
{ {
struct stconn *sc = *csp; struct stconn *sc = *scp;
if (!sc) if (!sc)
return; return;
@ -416,7 +416,7 @@ static void sc_detach_app(struct stconn **csp)
tasklet_free(sc->wait_event.tasklet); tasklet_free(sc->wait_event.tasklet);
sc->wait_event.tasklet = NULL; sc->wait_event.tasklet = NULL;
sc->wait_event.events = 0; sc->wait_event.events = 0;
sc_free_cond(csp); sc_free_cond(scp);
} }
/* Destroy the stconn. It is detached from its endpoint and its /* Destroy the stconn. It is detached from its endpoint and its
@ -472,7 +472,7 @@ int sc_reset_endp(struct stconn *sc)
} }
/* 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 SC 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 sc_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
@ -533,7 +533,7 @@ static void sc_app_shutr(struct stconn *sc)
* This function performs a shutdown-write on a detached stream connector in a * This function performs a shutdown-write on a detached stream connector in a
* connected or init state (it does nothing for other states). It either shuts * connected or init state (it does nothing for other states). It either shuts
* the write side or marks itself as closed. The buffer flags are updated to * the write side or marks itself as closed. The buffer flags are updated to
* reflect the new state. It does also close everything if the CS was marked as * reflect the new state. It does also close everything if the SC was marked as
* being in error state. The owner task is woken up if it exists. * being in error state. The owner task is woken up if it exists.
*/ */
static void sc_app_shutw(struct stconn *sc) static void sc_app_shutw(struct stconn *sc)
@ -672,7 +672,7 @@ static void sc_app_shutr_conn(struct stconn *sc)
* a connection in a connected or init state (it does nothing for other * a connection in a connected or init state (it does nothing for other
* states). It either shuts the write side or marks itself as closed. The * states). It either shuts the write side or marks itself as closed. The
* buffer flags are updated to reflect the new state. It does also close * buffer flags are updated to reflect the new state. It does also close
* everything if the CS was marked as being in error state. If there is a * everything if the SC was marked as being in error state. If there is a
* data-layer shutdown, it is called. * data-layer shutdown, it is called.
*/ */
static void sc_app_shutw_conn(struct stconn *sc) static void sc_app_shutw_conn(struct stconn *sc)
@ -1101,7 +1101,7 @@ static void sc_notify(struct stconn *sc)
{ {
struct channel *ic = sc_ic(sc); struct channel *ic = sc_ic(sc);
struct channel *oc = sc_oc(sc); struct channel *oc = sc_oc(sc);
struct stconn *cso = sc_opposite(sc); struct stconn *sco = sc_opposite(sc);
struct task *task = sc_strm_task(sc); struct task *task = sc_strm_task(sc);
/* process consumer side */ /* process consumer side */
@ -1135,9 +1135,9 @@ static void sc_notify(struct stconn *sc)
} }
if (oc->flags & CF_DONT_READ) if (oc->flags & CF_DONT_READ)
sc_wont_read(cso); sc_wont_read(sco);
else else
sc_will_read(cso); sc_will_read(sco);
/* Notify the other side when we've injected data into the IC that /* Notify the other side when we've injected data into the IC that
* needs to be forwarded. We can do fast-forwarding as soon as there * needs to be forwarded. We can do fast-forwarding as soon as there
@ -1152,7 +1152,7 @@ static void sc_notify(struct stconn *sc)
* parsing. * parsing.
*/ */
if (!channel_is_empty(ic) && if (!channel_is_empty(ic) &&
sc_ep_test(cso, SE_FL_WAIT_DATA) && sc_ep_test(sco, SE_FL_WAIT_DATA) &&
(!(ic->flags & CF_EXPECT_MORE) || c_full(ic) || ci_data(ic) == 0 || ic->pipe)) { (!(ic->flags & CF_EXPECT_MORE) || c_full(ic) || ci_data(ic) == 0 || ic->pipe)) {
int new_len, last_len; int new_len, last_len;
@ -1160,7 +1160,7 @@ static void sc_notify(struct stconn *sc)
if (ic->pipe) if (ic->pipe)
last_len += ic->pipe->data; last_len += ic->pipe->data;
sc_chk_snd(cso); sc_chk_snd(sco);
new_len = co_data(ic); new_len = co_data(ic);
if (ic->pipe) if (ic->pipe)
@ -1177,7 +1177,7 @@ static void sc_notify(struct stconn *sc)
sc_will_read(sc); sc_will_read(sc);
sc_chk_rcv(sc); sc_chk_rcv(sc);
sc_chk_rcv(cso); sc_chk_rcv(sco);
if (ic->flags & CF_SHUTR || sc_ep_test(sc, SE_FL_APPLET_NEED_CONN) || if (ic->flags & CF_SHUTR || sc_ep_test(sc, SE_FL_APPLET_NEED_CONN) ||
(sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))) { (sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))) {
@ -1195,7 +1195,7 @@ static void sc_notify(struct stconn *sc)
!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST) || !sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST) ||
sc_ep_test(sc, SE_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR) ||
((ic->flags & CF_READ_PARTIAL) && ((ic->flags & CF_READ_PARTIAL) &&
((ic->flags & CF_EOI) || !ic->to_forward || cso->state != SC_ST_EST)) || ((ic->flags & CF_EOI) || !ic->to_forward || sco->state != SC_ST_EST)) ||
/* changes on the consumption side */ /* changes on the consumption side */
(oc->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) || (oc->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) ||
@ -1203,7 +1203,7 @@ static void sc_notify(struct stconn *sc)
((oc->flags & CF_SHUTW) || ((oc->flags & CF_SHUTW) ||
(((oc->flags & CF_WAKE_WRITE) || (((oc->flags & CF_WAKE_WRITE) ||
!(oc->flags & (CF_AUTO_CLOSE|CF_SHUTW_NOW|CF_SHUTW))) && !(oc->flags & (CF_AUTO_CLOSE|CF_SHUTW_NOW|CF_SHUTW))) &&
(cso->state != SC_ST_EST || (sco->state != SC_ST_EST ||
(channel_is_empty(oc) && !oc->to_forward)))))) { (channel_is_empty(oc) && !oc->to_forward)))))) {
task_wakeup(task, TASK_WOKEN_IO); task_wakeup(task, TASK_WOKEN_IO);
} }
@ -1436,7 +1436,7 @@ static int sc_conn_recv(struct stconn *sc)
} }
/* <max> may be null. This is the mux responsibility to set /* <max> may be null. This is the mux responsibility to set
* SE_FL_RCV_MORE on the CS if more space is needed. * SE_FL_RCV_MORE on the SC if more space is needed.
*/ */
max = channel_recv_max(ic); max = channel_recv_max(ic);
ret = conn->mux->rcv_buf(sc, &ic->buf, max, cur_flags); ret = conn->mux->rcv_buf(sc, &ic->buf, max, cur_flags);
@ -1482,7 +1482,7 @@ static int sc_conn_recv(struct stconn *sc)
ic->total += ret; ic->total += ret;
/* End-of-input reached, we can leave. In this case, it is /* End-of-input reached, we can leave. In this case, it is
* important to break the loop to not block the CS because of * important to break the loop to not block the SC because of
* the channel's policies.This way, we are still able to receive * the channel's policies.This way, we are still able to receive
* shutdowns. * shutdowns.
*/ */
@ -1640,7 +1640,7 @@ static int sc_conn_send(struct stconn *sc)
if (sc_ep_test(sc, SE_FL_ERROR | SE_FL_ERR_PENDING) || sc_is_conn_error(sc)) { if (sc_ep_test(sc, SE_FL_ERROR | SE_FL_ERR_PENDING) || sc_is_conn_error(sc)) {
/* We're probably there because the tasklet was woken up, /* We're probably there because the tasklet was woken up,
* but process_stream() ran before, detected there were an * but process_stream() ran before, detected there were an
* error and put the CS back to SC_ST_TAR. There's still * error and put the SC back to SC_ST_TAR. There's still
* CO_FL_ERROR on the connection but we don't want to add * CO_FL_ERROR on the connection but we don't want to add
* SE_FL_ERROR back, so give up * SE_FL_ERROR back, so give up
*/ */
@ -1887,7 +1887,7 @@ static int sc_conn_process(struct stconn *sc)
/* This is the ->process() function for any stream connector's wait_event task. /* This is the ->process() function for any stream connector's wait_event task.
* It's assigned during the stream connector's initialization, for any type of * It's assigned during the stream connector's initialization, for any type of
* stream connector. Thus it is always safe to perform a tasklet_wakeup() on a * stream connector. Thus it is always safe to perform a tasklet_wakeup() on a
* stream connector, as the presence of the CS is checked there. * stream connector, as the presence of the SC is checked there.
*/ */
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)
{ {

View File

@ -172,7 +172,7 @@ static void strm_trace(enum trace_level level, uint64_t mask, const struct trace
} }
/* Front and back stream connector state */ /* Front and back stream connector state */
chunk_appendf(&trace_buf, " CS=(%s,%s)", chunk_appendf(&trace_buf, " SC=(%s,%s)",
sc_state_str(s->scf->state), sc_state_str(s->scb->state)); sc_state_str(s->scf->state), sc_state_str(s->scb->state));
/* If txn is defined, HTTP req/rep states */ /* If txn is defined, HTTP req/rep states */