From: Willy Tarreau Date: Tue, 10 May 2022 13:46:10 +0000 (+0200) Subject: MINOR: mux-quic: remove the now unneeded conn_stream from the qcs X-Git-Tag: v2.6-dev10~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=01c2a4a86f7bcee7beca2edb10312cfcffa7e863;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/haproxy/mux_quic-t.h b/include/haproxy/mux_quic-t.h index bf396bbd20..83fccb29ec 100644 --- a/include/haproxy/mux_quic-t.h +++ b/include/haproxy/mux_quic-t.h @@ -95,7 +95,6 @@ struct qcc { struct qcs { struct qcc *qcc; - struct conn_stream *cs; struct cs_endpoint *endp; uint32_t flags; /* QC_SF_* */ void *ctx; /* app-ops context */ diff --git a/include/haproxy/mux_quic.h b/include/haproxy/mux_quic.h index b91ef57c7a..0086909fb1 100644 --- a/include/haproxy/mux_quic.h +++ b/include/haproxy/mux_quic.h @@ -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) { - struct conn_stream *cs; - - cs = cs_new_from_mux(qcs->endp, qcs->qcc->conn->owner, buf); - if (!cs) + if (!cs_new_from_mux(qcs->endp, qcs->qcc->conn->owner, buf)) return NULL; - qcs->cs = cs; - ++qcs->qcc->nb_cs; - return cs; + ++qcs->qcc->nb_cs; + return qcs->endp->cs; } #endif /* USE_QUIC */ diff --git a/src/h3.c b/src/h3.c index 8a41f07829..68fc1025a6 100644 --- a/src/h3.c +++ b/src/h3.c @@ -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_sl *sl; struct http_hdr list[global.tune.max_http_hdr]; - struct conn_stream *cs; unsigned int flags = HTX_SL_F_NONE; struct ist meth = IST_NULL, path = 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) htx->flags |= HTX_FL_EOM; - cs = qc_attach_cs(qcs, &htx_buf); - if (!cs) + if (!qc_attach_cs(qcs, &htx_buf)) return -1; /* buffer is transferred to conn_stream and set to NULL diff --git a/src/mux_quic.c b/src/mux_quic.c index 0d7d4240f5..f03b651eea 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -114,7 +114,7 @@ struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type) qcs->stream = NULL; qcs->qcc = qcc; - qcs->cs = NULL; + qcs->endp = NULL; qcs->flags = QC_SF_NONE; qcs->ctx = NULL; @@ -1227,7 +1227,6 @@ static void qc_detach(struct conn_stream *cs) TRACE_ENTER(QMUX_EV_STRM_END, qcc->conn, qcs); - qcs->cs = NULL; --qcc->nb_cs; 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)) { qcs = eb64_entry(node, struct qcs, by_id); - if (!qcs->cs) + if (!qcs->endp->cs) continue; 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_send(qcs); } - else if (qcs->cs->data_cb->wake) { - qcs->cs->data_cb->wake(qcs->cs); + else if (qcs->endp->cs->data_cb->wake) { + qcs->endp->cs->data_cb->wake(qcs->endp->cs); } } }