* 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
* 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)
{
/* 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.
*/
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
- * on the session for frontend CS and the server connection for the backend
- * CS. It returns a const address on success or NULL on failure.
+ * on the session for frontend SC and the server connection for the backend
+ * SC. It returns a const address on success or NULL on failure.
*/
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
* 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
- * source address is copied from the session one for frontend CS and the server
- * connection for the backend CS.
+ * source address is copied from the session one for frontend SC and the server
+ * connection for the backend SC.
*/
static inline int sc_get_src(struct stconn *sc)
{
* 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
* 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)
{
* the endpoint :
*/
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_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 */
* do not last beyond process_session().
*/
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_QUE, /* CS waiting in queue */
- SC_ST_TAR, /* CS in turn-around state after failed connect attempt */
- SC_ST_ASS, /* server just assigned to this CS */
+ SC_ST_QUE, /* SC waiting in queue */
+ SC_ST_TAR, /* SC in turn-around state after failed connect attempt */
+ SC_ST_ASS, /* server just assigned to this SC */
SC_ST_CON, /* initiated connection request (resource exists) */
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_EST, /* connection established (resource exists) */
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));
/* state bits for use with lists of states */
*/
struct stconn {
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 */
unsigned int flags; /* SC_FL_* */
if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) {
struct appctx *appctx;
- /* The target is an applet but the CS is in SC_ST_REQ. Thus it
- * means no appctx are attached to the CS. Otherwise, it will be
+ /* The target is an applet but the SC is in SC_ST_REQ. Thus it
+ * means no appctx are attached to the SC. Otherwise, it will be
* in SC_ST_RDY state. So, try to create the appctx now.
*/
BUG_ON(sc_appctx(sc));
DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
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.
*/
BUG_ON(!sc_appctx(s->scb));
else {
/* alive back connections of front connections with a stream connector attached */
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 */
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;
TRACE_DEVEL("unset idle expiration (attached || shutdown)", H1_EV_H1C_RECV, h1c->conn);
}
se_fl_set(h1s->endp, SE_FL_WEBSOCKET);
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;
}
if (!h1c_frt_stream_new(h1c, conn_ctx, h1c->conn->owner))
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;
- 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_release_buf(h1c, &h1c->ibuf);
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
* cases, it is only possible on the client side.
*/
}
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));
if (!h1s_new_sc(h1s, buf)) {
h1c->flags |= H1C_F_ST_ERROR;
}
}
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);
if (!h1s_upgrade_sc(h1s, buf)) {
h1c->flags |= H1C_F_ST_ERROR;
}
else if (h1m->state > H1_MSG_LAST_LF && h1m->state < H1_MSG_DONE) {
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 (b_isteq(&h1c->ibuf, 0, b_data(&h1c->ibuf), ist(H2_CONN_PREFACE)) > 0) {
h1c->flags |= H1C_F_UPG_H2C;
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
*/
BUG_ON(!h1s || (h1c->flags & H1C_F_ST_READY));
release:
if (h1c->flags & H1C_F_ST_ATTACHED) {
/* 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);
if (conn_xprt_read0_pending(conn) || (h1s->flags & H1S_F_REOS))
if ((h1c->flags & H1C_F_ST_ERROR) || (conn->flags & CO_FL_ERROR))
se_fl_set(h1s->endp, SE_FL_ERROR);
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 {
h1_release(h1c);
if (h1c->flags & H1C_F_ST_READY) {
HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock);
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;
}
if (h1c->flags & H1C_F_ST_ATTACHED) {
/* 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);
h1_alert(h1c->h1s);
h1_refresh_timeout(h1c);
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;
}
}
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);
goto end;
}
}
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);
goto end;
}
ctx->conn->subs = NULL;
} else if (pt_sc(ctx)->app_ops->wake)
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;
}
conn_ctrl_drain(ctx->conn);
if (!sc) {
ctx->endp = sedesc_new();
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;
}
ctx->endp->se = ctx;
sc = sc_new_from_endp(ctx->endp, sess, input);
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;
}
TRACE_POINT(PT_EV_STRM_NEW, conn, sc);
ret = pt_sc(ctx)->app_ops->wake ? pt_sc(ctx)->app_ops->wake(pt_sc(ctx)) : 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;
}
} else {
/* 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
- * 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))) {
sc_free(sc);
- *csp = NULL;
+ *scp = NULL;
}
}
* endpoint is reset and flag as detached. If the app layer is also detached,
* 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)
return;
}
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
*/
sc->flags &= SC_FL_ISBACK;
sc->app_ops = &sc_app_embedded_ops;
else
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
* 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)
return;
tasklet_free(sc->wait_event.tasklet);
sc->wait_event.tasklet = NULL;
sc->wait_event.events = 0;
- sc_free_cond(csp);
+ sc_free_cond(scp);
}
/* Destroy the stconn. It is detached from its endpoint and its
}
-/* 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
* 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
* 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
* 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.
*/
static void sc_app_shutw(struct stconn *sc)
* 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
* 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.
*/
static void sc_app_shutw_conn(struct stconn *sc)
{
struct channel *ic = sc_ic(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);
/* process consumer side */
}
if (oc->flags & CF_DONT_READ)
- sc_wont_read(cso);
+ sc_wont_read(sco);
else
- sc_will_read(cso);
+ sc_will_read(sco);
/* 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
* parsing.
*/
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)) {
int new_len, last_len;
if (ic->pipe)
last_len += ic->pipe->data;
- sc_chk_snd(cso);
+ sc_chk_snd(sco);
new_len = co_data(ic);
if (ic->pipe)
sc_will_read(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) ||
(sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))) {
!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST) ||
sc_ep_test(sc, SE_FL_ERROR) ||
((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 */
(oc->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) ||
((oc->flags & CF_SHUTW) ||
(((oc->flags & CF_WAKE_WRITE) ||
!(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)))))) {
task_wakeup(task, TASK_WOKEN_IO);
}
}
/* <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);
ret = conn->mux->rcv_buf(sc, &ic->buf, max, cur_flags);
ic->total += ret;
/* 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
* shutdowns.
*/
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,
* 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
* SE_FL_ERROR back, so give up
*/
/* 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
* 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)
{
}
/* 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));
/* If txn is defined, HTTP req/rep states */