CLEANUP: quic/h3: rename all occurrences of stconn "cs" to "sc"

Function arguments and local variables called "cs" were renamed to "sc"
to avoid future confusion. The "nb_cs" stream-connector counter was
renamed to "nb_sc" and qc_attach_cs() was renamed to qc_attach_sc().
This commit is contained in:
Willy Tarreau 2022-05-27 10:09:11 +02:00
parent 0adb281fb0
commit 3215e731b6
6 changed files with 26 additions and 26 deletions

View File

@ -101,7 +101,7 @@ enum h3s_t {
extern const struct qcc_app_ops h3_ops;
size_t h3_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags);
size_t h3_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, int flags);
#endif /* USE_QUIC */
#endif /* _HAPROXY_H3_T_H */

View File

@ -32,7 +32,7 @@ enum qcs_type {
struct qcc {
struct connection *conn;
uint64_t nb_cs; /* number of attached stream connectors */
uint64_t nb_sc; /* number of attached stream connectors */
uint32_t flags; /* QC_CF_* */
struct {
@ -97,7 +97,7 @@ struct qcc {
#define QC_SF_FIN_RECV 0x00000001 /* last frame received for this stream */
#define QC_SF_FIN_STREAM 0x00000002 /* FIN bit must be set for last frame of the stream */
#define QC_SF_BLK_MROOM 0x00000004 /* app layer is blocked waiting for room in the qcs.tx.buf */
#define QC_SF_DETACH 0x00000008 /* cs is detached but there is remaining data to send */
#define QC_SF_DETACH 0x00000008 /* sc is detached but there is remaining data to send */
#define QC_SF_BLK_SFCTL 0x00000010 /* stream blocked due to stream flow control limit */
#define QC_SF_DEM_FULL 0x00000020 /* demux blocked on request channel buffer full */
#define QC_SF_READ_ABORTED 0x00000040 /* stream rejected by app layer */
@ -138,7 +138,7 @@ struct qcc_app_ops {
int (*init)(struct qcc *qcc);
int (*attach)(struct qcs *qcs);
int (*decode_qcs)(struct qcs *qcs, int fin, void *ctx);
size_t (*snd_buf)(struct stconn *cs, struct buffer *buf, size_t count, int flags);
size_t (*snd_buf)(struct stconn *sc, struct buffer *buf, size_t count, int flags);
void (*detach)(struct qcs *qcs);
int (*finalize)(void *ctx);
int (*is_active)(const struct qcc *qcc, void *ctx);

View File

@ -91,7 +91,7 @@ static inline int qcc_install_app_ops(struct qcc *qcc,
return 0;
}
static inline struct stconn *qc_attach_cs(struct qcs *qcs, struct buffer *buf)
static inline struct stconn *qc_attach_sc(struct qcs *qcs, struct buffer *buf)
{
struct qcc *qcc = qcs->qcc;
struct session *sess = qcc->conn->owner;
@ -110,7 +110,7 @@ static inline struct stconn *qc_attach_cs(struct qcs *qcs, struct buffer *buf)
if (!sc_new_from_endp(qcs->endp, sess, buf))
return NULL;
++qcc->nb_cs;
++qcc->nb_sc;
/* TODO duplicated from mux_h2 */
sess->accept_date = date;

View File

@ -341,7 +341,7 @@ static int h3_headers_to_htx(struct qcs *qcs, struct ncbuf *buf, uint64_t len,
if (fin)
htx->flags |= HTX_FL_EOM;
if (!qc_attach_cs(qcs, &htx_buf))
if (!qc_attach_sc(qcs, &htx_buf))
return -1;
/* buffer is transferred to the stream connector and set to NULL
@ -860,10 +860,10 @@ static int h3_resp_data_send(struct qcs *qcs, struct buffer *buf, size_t count)
return total;
}
size_t h3_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags)
size_t h3_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, int flags)
{
size_t total = 0;
struct qcs *qcs = __sc_mux_strm(cs);
struct qcs *qcs = __sc_mux_strm(sc);
struct htx *htx;
enum htx_blk_type btype;
struct htx_blk *blk;

View File

@ -14,7 +14,7 @@ static int hq_interop_decode_qcs(struct qcs *qcs, int fin, void *ctx)
struct ncbuf *rxbuf = &qcs->rx.ncbuf;
struct htx *htx;
struct htx_sl *sl;
struct stconn *cs;
struct stconn *sc;
struct buffer htx_buf = BUF_NULL;
struct ist path;
char *ptr = ncb_head(rxbuf);
@ -72,8 +72,8 @@ static int hq_interop_decode_qcs(struct qcs *qcs, int fin, void *ctx)
htx_add_endof(htx, HTX_BLK_EOH);
htx_to_buf(htx, &htx_buf);
cs = qc_attach_cs(qcs, &htx_buf);
if (!cs)
sc = qc_attach_sc(qcs, &htx_buf);
if (!sc)
return 1;
qcs_consume(qcs, ncb_data(rxbuf, 0));
@ -93,10 +93,10 @@ static struct buffer *mux_get_buf(struct qcs *qcs)
return &qcs->tx.buf;
}
static size_t hq_interop_snd_buf(struct stconn *cs, struct buffer *buf,
static size_t hq_interop_snd_buf(struct stconn *sc, struct buffer *buf,
size_t count, int flags)
{
struct qcs *qcs = __sc_mux_strm(cs);
struct qcs *qcs = __sc_mux_strm(sc);
struct htx *htx;
enum htx_blk_type btype;
struct htx_blk *blk;

View File

@ -699,7 +699,7 @@ static inline int qcc_is_dead(const struct qcc *qcc)
/* Return true if the mux timeout should be armed. */
static inline int qcc_may_expire(struct qcc *qcc)
{
return !qcc->nb_cs;
return !qcc->nb_sc;
}
/* release function. This one should be called to free all resources allocated
@ -1316,7 +1316,7 @@ static int qc_init(struct connection *conn, struct proxy *prx,
qcc->conn = conn;
conn->ctx = qcc;
qcc->nb_cs = 0;
qcc->nb_sc = 0;
qcc->flags = 0;
qcc->app_ops = NULL;
@ -1429,7 +1429,7 @@ static void qc_detach(struct sedesc *endp)
TRACE_ENTER(QMUX_EV_STRM_END, qcc->conn, qcs);
--qcc->nb_cs;
--qcc->nb_sc;
if ((b_data(&qcs->tx.buf) || qcs->tx.offset > qcs->tx.sent_offset) &&
!(qcc->conn->flags & CO_FL_ERROR)) {
@ -1455,10 +1455,10 @@ static void qc_detach(struct sedesc *endp)
}
/* Called from the upper layer, to receive data */
static size_t qc_rcv_buf(struct stconn *cs, struct buffer *buf,
static size_t qc_rcv_buf(struct stconn *sc, struct buffer *buf,
size_t count, int flags)
{
struct qcs *qcs = __sc_mux_strm(cs);
struct qcs *qcs = __sc_mux_strm(sc);
struct htx *qcs_htx = NULL;
struct htx *cs_htx = NULL;
size_t ret = 0;
@ -1525,15 +1525,15 @@ static size_t qc_rcv_buf(struct stconn *cs, struct buffer *buf,
return ret;
}
static size_t qc_snd_buf(struct stconn *cs, struct buffer *buf,
static size_t qc_snd_buf(struct stconn *sc, struct buffer *buf,
size_t count, int flags)
{
struct qcs *qcs = __sc_mux_strm(cs);
struct qcs *qcs = __sc_mux_strm(sc);
size_t ret;
TRACE_ENTER(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs);
ret = qcs->qcc->app_ops->snd_buf(cs, buf, count, flags);
ret = qcs->qcc->app_ops->snd_buf(sc, buf, count, flags);
TRACE_LEAVE(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs);
@ -1545,19 +1545,19 @@ static size_t qc_snd_buf(struct stconn *cs, struct buffer *buf,
* as at least one event is still subscribed. The <event_type> must only be a
* combination of SUB_RETRY_RECV and SUB_RETRY_SEND. It always returns 0.
*/
static int qc_subscribe(struct stconn *cs, int event_type,
static int qc_subscribe(struct stconn *sc, int event_type,
struct wait_event *es)
{
return qcs_subscribe(__sc_mux_strm(cs), event_type, es);
return qcs_subscribe(__sc_mux_strm(sc), event_type, es);
}
/* Called from the upper layer, to unsubscribe <es> from events <event_type>.
* The <es> pointer is not allowed to differ from the one passed to the
* subscribe() call. It always returns zero.
*/
static int qc_unsubscribe(struct stconn *cs, int event_type, struct wait_event *es)
static int qc_unsubscribe(struct stconn *sc, int event_type, struct wait_event *es)
{
struct qcs *qcs = __sc_mux_strm(cs);
struct qcs *qcs = __sc_mux_strm(sc);
BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV));
BUG_ON(qcs->subs && qcs->subs != es);