CLEANUP: mux-fcgi: rename the "endp" field to "sd"
The stream endpoint descriptor that was named "endp" is now called "sd"
both in the fcgi_strm struct and in the few functions using this. The
name was also updated in the "show fd" output.
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index 6d12a23..c93f7c8 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -154,7 +154,7 @@
/* FCGI stream descriptor */
struct fcgi_strm {
- struct sedesc *endp;
+ struct sedesc *sd;
struct session *sess;
struct fcgi_conn *fconn;
@@ -378,7 +378,7 @@
/* a dmumy management stream */
static const struct fcgi_strm *fcgi_mgmt_stream = &(const struct fcgi_strm){
- .endp = (struct sedesc*)&closed_ep,
+ .sd = (struct sedesc*)&closed_ep,
.fconn = NULL,
.state = FCGI_SS_CLOSED,
.flags = FCGI_SF_NONE,
@@ -387,7 +387,7 @@
/* and a dummy idle stream for use with any unknown stream */
static const struct fcgi_strm *fcgi_unknown_stream = &(const struct fcgi_strm){
- .endp = (struct sedesc*)&closed_ep,
+ .sd = (struct sedesc*)&closed_ep,
.fconn = NULL,
.state = FCGI_SS_IDLE,
.flags = FCGI_SF_NONE,
@@ -425,7 +425,7 @@
/* returns the stconn associated to the FCGI stream */
static forceinline struct stconn *fcgi_strm_sc(const struct fcgi_strm *fstrm)
{
- return fstrm->endp->sc;
+ return fstrm->sd->sc;
}
@@ -927,7 +927,7 @@
fstrm->state = FCGI_SS_ERROR;
TRACE_STATE("switching to ERROR", FCGI_EV_FSTRM_ERR, fstrm->fconn->conn, fstrm);
}
- se_fl_set_error(fstrm->endp);
+ se_fl_set_error(fstrm->sd);
}
}
@@ -1013,7 +1013,7 @@
if (!fstrm->id)
fstrm->fconn->nb_reserved--;
if (fcgi_strm_sc(fstrm)) {
- if (!se_fl_test(fstrm->endp, SE_FL_EOS) && !b_data(&fstrm->rxbuf))
+ if (!se_fl_test(fstrm->sd, SE_FL_EOS) && !b_data(&fstrm->rxbuf))
fcgi_strm_notify_recv(fstrm);
}
fstrm->state = FCGI_SS_CLOSED;
@@ -1045,8 +1045,8 @@
*/
LIST_DEL_INIT(&fstrm->send_list);
tasklet_free(fstrm->shut_tl);
- BUG_ON(fstrm->endp && !se_fl_test(fstrm->endp, SE_FL_ORPHAN));
- sedesc_free(fstrm->endp);
+ BUG_ON(fstrm->sd && !se_fl_test(fstrm->sd, SE_FL_ORPHAN));
+ sedesc_free(fstrm->sd);
pool_free(pool_head_fcgi_strm, fstrm);
TRACE_LEAVE(FCGI_EV_FSTRM_END, conn);
@@ -1081,7 +1081,7 @@
fstrm->shut_tl->context = fstrm;
LIST_INIT(&fstrm->send_list);
fstrm->fconn = fconn;
- fstrm->endp = NULL;
+ fstrm->sd = NULL;
fstrm->flags = FCGI_SF_NONE;
fstrm->proto_status = 0;
fstrm->state = FCGI_SS_IDLE;
@@ -1137,7 +1137,7 @@
}
if (sc_attach_mux(sc, fstrm, fconn->conn) < 0)
goto out;
- fstrm->endp = sc->sedesc;
+ fstrm->sd = sc->sedesc;
fstrm->sess = sess;
fconn->nb_sc++;
@@ -1178,9 +1178,9 @@
}
if ((fconn->state == FCGI_CS_CLOSED || fconn->conn->flags & CO_FL_ERROR)) {
- se_fl_set(fstrm->endp, SE_FL_ERR_PENDING);
- if (se_fl_test(fstrm->endp, SE_FL_EOS))
- se_fl_set(fstrm->endp, SE_FL_ERROR);
+ se_fl_set(fstrm->sd, SE_FL_ERR_PENDING);
+ if (se_fl_test(fstrm->sd, SE_FL_EOS))
+ se_fl_set(fstrm->sd, SE_FL_ERROR);
if (fstrm->state < FCGI_SS_ERROR) {
fstrm->state = FCGI_SS_ERROR;
@@ -2628,10 +2628,10 @@
fcgi_conn_read0_pending(fconn) ||
fstrm->state == FCGI_SS_CLOSED ||
(fstrm->flags & FCGI_SF_ES_RCVD) ||
- se_fl_test(fstrm->endp, SE_FL_ERROR | SE_FL_ERR_PENDING | SE_FL_EOS))) {
+ se_fl_test(fstrm->sd, SE_FL_ERROR | SE_FL_ERR_PENDING | SE_FL_EOS))) {
/* we may have to signal the upper layers */
TRACE_DEVEL("notifying stream before switching SID", FCGI_EV_RX_RECORD|FCGI_EV_STRM_WAKE, fconn->conn, fstrm);
- se_fl_set(fstrm->endp, SE_FL_RCV_MORE);
+ se_fl_set(fstrm->sd, SE_FL_RCV_MORE);
fcgi_strm_notify_recv(fstrm);
}
fstrm = tmp_fstrm;
@@ -2709,10 +2709,10 @@
fcgi_conn_read0_pending(fconn) ||
fstrm->state == FCGI_SS_CLOSED ||
(fstrm->flags & FCGI_SF_ES_RCVD) ||
- se_fl_test(fstrm->endp, SE_FL_ERROR | SE_FL_ERR_PENDING | SE_FL_EOS))) {
+ se_fl_test(fstrm->sd, SE_FL_ERROR | SE_FL_ERR_PENDING | SE_FL_EOS))) {
/* we may have to signal the upper layers */
TRACE_DEVEL("notifying stream before switching SID", FCGI_EV_RX_RECORD|FCGI_EV_STRM_WAKE, fconn->conn, fstrm);
- se_fl_set(fstrm->endp, SE_FL_RCV_MORE);
+ se_fl_set(fstrm->sd, SE_FL_RCV_MORE);
fcgi_strm_notify_recv(fstrm);
}
@@ -3124,7 +3124,7 @@
while (node) {
fstrm = container_of(node, struct fcgi_strm, by_id);
- if (fcgi_strm_sc(fstrm) && se_fl_test(fstrm->endp, SE_FL_WAIT_FOR_HS))
+ if (fcgi_strm_sc(fstrm) && se_fl_test(fstrm->sd, SE_FL_WAIT_FOR_HS))
fcgi_strm_notify_recv(fstrm);
node = eb32_next(node);
}
@@ -3527,13 +3527,13 @@
* Attach a new stream to a connection
* (Used for outgoing connections)
*/
-static int fcgi_attach(struct connection *conn, struct sedesc *endp, struct session *sess)
+static int fcgi_attach(struct connection *conn, struct sedesc *sd, struct session *sess)
{
struct fcgi_strm *fstrm;
struct fcgi_conn *fconn = conn->ctx;
TRACE_ENTER(FCGI_EV_FSTRM_NEW, conn);
- fstrm = fcgi_stconn_new(fconn, endp->sc, sess);
+ fstrm = fcgi_stconn_new(fconn, sd->sc, sess);
if (!fstrm)
goto err;
@@ -3587,9 +3587,9 @@
/*
* Detach the stream from the connection and possibly release the connection.
*/
-static void fcgi_detach(struct sedesc *endp)
+static void fcgi_detach(struct sedesc *sd)
{
- struct fcgi_strm *fstrm = endp->se;
+ struct fcgi_strm *fstrm = sd->se;
struct fcgi_conn *fconn;
struct session *sess;
@@ -3728,7 +3728,7 @@
* for example because of a "tcp-request content reject" rule that is
* normally used to limit abuse.
*/
- if (se_fl_test(fstrm->endp, SE_FL_KILL_CONN) &&
+ if (se_fl_test(fstrm->sd, SE_FL_KILL_CONN) &&
!(fconn->flags & (FCGI_CF_ABRTS_SENT|FCGI_CF_ABRTS_FAILED))) {
TRACE_STATE("stream wants to kill the connection", FCGI_EV_STRM_SHUT, fconn->conn, fstrm);
fconn->state = FCGI_CS_CLOSED;
@@ -3789,7 +3789,7 @@
* for example because of a "tcp-request content reject" rule that is
* normally used to limit abuse.
*/
- if (se_fl_test(fstrm->endp, SE_FL_KILL_CONN) &&
+ if (se_fl_test(fstrm->sd, SE_FL_KILL_CONN) &&
!(fconn->flags & (FCGI_CF_ABRTS_SENT|FCGI_CF_ABRTS_FAILED))) {
TRACE_STATE("stream wants to kill the connection", FCGI_EV_STRM_SHUT, fconn->conn, fstrm);
fconn->state = FCGI_CS_CLOSED;
@@ -3959,18 +3959,18 @@
TRACE_STATE("fstrm rxbuf not allocated", FCGI_EV_STRM_RECV|FCGI_EV_FSTRM_BLK, fconn->conn, fstrm);
if (b_data(&fstrm->rxbuf))
- se_fl_set(fstrm->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
+ se_fl_set(fstrm->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
else {
- se_fl_clr(fstrm->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
+ se_fl_clr(fstrm->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
if (fstrm->state == FCGI_SS_ERROR || (fstrm->h1m.state == H1_MSG_DONE)) {
- se_fl_set(fstrm->endp, SE_FL_EOI);
+ se_fl_set(fstrm->sd, SE_FL_EOI);
if (!(fstrm->h1m.flags & (H1_MF_VER_11|H1_MF_XFER_LEN)))
- se_fl_set(fstrm->endp, SE_FL_EOS);
+ se_fl_set(fstrm->sd, SE_FL_EOS);
}
if (fcgi_conn_read0_pending(fconn))
- se_fl_set(fstrm->endp, SE_FL_EOS);
- if (se_fl_test(fstrm->endp, SE_FL_ERR_PENDING))
- se_fl_set(fstrm->endp, SE_FL_ERROR);
+ se_fl_set(fstrm->sd, SE_FL_EOS);
+ if (se_fl_test(fstrm->sd, SE_FL_ERR_PENDING))
+ se_fl_set(fstrm->sd, SE_FL_ERROR);
fcgi_release_buf(fconn, &fstrm->rxbuf);
}
@@ -4023,7 +4023,7 @@
if (id < 0) {
fcgi_strm_close(fstrm);
- se_fl_set(fstrm->endp, SE_FL_ERROR);
+ se_fl_set(fstrm->sd, SE_FL_ERROR);
TRACE_DEVEL("couldn't get a stream ID, leaving in error", FCGI_EV_STRM_SEND|FCGI_EV_FSTRM_ERR|FCGI_EV_STRM_ERR, fconn->conn, fstrm);
return 0;
}
@@ -4120,7 +4120,7 @@
if (fstrm->state == FCGI_SS_ERROR) {
TRACE_DEVEL("reporting error to the app-layer stream", FCGI_EV_STRM_SEND|FCGI_EV_FSTRM_ERR|FCGI_EV_STRM_ERR, fconn->conn, fstrm);
- se_fl_set_error(fstrm->endp);
+ se_fl_set_error(fstrm->sd);
if (!(fstrm->flags & FCGI_SF_BEGIN_SENT) || fcgi_strm_send_abort(fconn, fstrm))
fcgi_strm_close(fstrm);
}
@@ -4192,9 +4192,9 @@
(unsigned int)b_data(&fstrm->rxbuf), b_orig(&fstrm->rxbuf),
(unsigned int)b_head_ofs(&fstrm->rxbuf), (unsigned int)b_size(&fstrm->rxbuf),
fcgi_strm_sc(fstrm));
- if (fstrm->endp) {
- chunk_appendf(msg, " .endp.flg=0x%08x", se_fl_get(fstrm->endp));
- if (!se_fl_test(fstrm->endp, SE_FL_ORPHAN))
+ if (fstrm->sd) {
+ chunk_appendf(msg, " .sd.flg=0x%08x", se_fl_get(fstrm->sd));
+ if (!se_fl_test(fstrm->sd, SE_FL_ORPHAN))
chunk_appendf(msg, " .sc.flg=0x%08x .sc.app=%p",
fcgi_strm_sc(fstrm)->flags, fcgi_strm_sc(fstrm)->app);
}