MINOR: mux-quic: remove the now unneeded conn_stream from the qcs

Since we always have a valid endpoint we can safely use it to access
the conn_stream and stop using qcs->cs. That's one less pointer to
care about.
This commit is contained in:
Willy Tarreau 2022-05-10 15:46:10 +02:00
parent b57669e6a4
commit 01c2a4a86f
4 changed files with 8 additions and 16 deletions

View File

@ -95,7 +95,6 @@ struct qcc {
struct qcs { struct qcs {
struct qcc *qcc; struct qcc *qcc;
struct conn_stream *cs;
struct cs_endpoint *endp; struct cs_endpoint *endp;
uint32_t flags; /* QC_SF_* */ uint32_t flags; /* QC_SF_* */
void *ctx; /* app-ops context */ void *ctx; /* app-ops context */

View File

@ -91,15 +91,11 @@ static inline int qcc_install_app_ops(struct qcc *qcc,
static inline struct conn_stream *qc_attach_cs(struct qcs *qcs, struct buffer *buf) static inline struct conn_stream *qc_attach_cs(struct qcs *qcs, struct buffer *buf)
{ {
struct conn_stream *cs; if (!cs_new_from_mux(qcs->endp, qcs->qcc->conn->owner, buf))
cs = cs_new_from_mux(qcs->endp, qcs->qcc->conn->owner, buf);
if (!cs)
return NULL; return NULL;
qcs->cs = cs;
++qcs->qcc->nb_cs;
return cs; ++qcs->qcc->nb_cs;
return qcs->endp->cs;
} }
#endif /* USE_QUIC */ #endif /* USE_QUIC */

View File

@ -112,7 +112,6 @@ static int h3_headers_to_htx(struct qcs *qcs, struct buffer *buf, uint64_t len,
struct htx *htx = NULL; struct htx *htx = NULL;
struct htx_sl *sl; struct htx_sl *sl;
struct http_hdr list[global.tune.max_http_hdr]; struct http_hdr list[global.tune.max_http_hdr];
struct conn_stream *cs;
unsigned int flags = HTX_SL_F_NONE; unsigned int flags = HTX_SL_F_NONE;
struct ist meth = IST_NULL, path = IST_NULL; struct ist meth = IST_NULL, path = IST_NULL;
//struct ist scheme = IST_NULL, authority = IST_NULL; //struct ist scheme = IST_NULL, authority = IST_NULL;
@ -183,8 +182,7 @@ static int h3_headers_to_htx(struct qcs *qcs, struct buffer *buf, uint64_t len,
if (fin) if (fin)
htx->flags |= HTX_FL_EOM; htx->flags |= HTX_FL_EOM;
cs = qc_attach_cs(qcs, &htx_buf); if (!qc_attach_cs(qcs, &htx_buf))
if (!cs)
return -1; return -1;
/* buffer is transferred to conn_stream and set to NULL /* buffer is transferred to conn_stream and set to NULL

View File

@ -114,7 +114,7 @@ struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type)
qcs->stream = NULL; qcs->stream = NULL;
qcs->qcc = qcc; qcs->qcc = qcc;
qcs->cs = NULL; qcs->endp = NULL;
qcs->flags = QC_SF_NONE; qcs->flags = QC_SF_NONE;
qcs->ctx = NULL; qcs->ctx = NULL;
@ -1227,7 +1227,6 @@ static void qc_detach(struct conn_stream *cs)
TRACE_ENTER(QMUX_EV_STRM_END, qcc->conn, qcs); TRACE_ENTER(QMUX_EV_STRM_END, qcc->conn, qcs);
qcs->cs = NULL;
--qcc->nb_cs; --qcc->nb_cs;
if ((b_data(&qcs->tx.buf) || qcs->tx.offset > qcs->tx.sent_offset) && if ((b_data(&qcs->tx.buf) || qcs->tx.offset > qcs->tx.sent_offset) &&
@ -1384,7 +1383,7 @@ static int qc_wake_some_streams(struct qcc *qcc)
node = eb64_next(node)) { node = eb64_next(node)) {
qcs = eb64_entry(node, struct qcs, by_id); qcs = eb64_entry(node, struct qcs, by_id);
if (!qcs->cs) if (!qcs->endp->cs)
continue; continue;
if (qcc->conn->flags & CO_FL_ERROR) { if (qcc->conn->flags & CO_FL_ERROR) {
@ -1396,8 +1395,8 @@ static int qc_wake_some_streams(struct qcc *qcc)
qcs_notify_recv(qcs); qcs_notify_recv(qcs);
qcs_notify_send(qcs); qcs_notify_send(qcs);
} }
else if (qcs->cs->data_cb->wake) { else if (qcs->endp->cs->data_cb->wake) {
qcs->cs->data_cb->wake(qcs->cs); qcs->endp->cs->data_cb->wake(qcs->endp->cs);
} }
} }
} }