]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: remove the now unneeded conn_stream from the qcs
authorWilly Tarreau <w@1wt.eu>
Tue, 10 May 2022 13:46:10 +0000 (15:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 13 May 2022 12:28:48 +0000 (14:28 +0200)
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.

include/haproxy/mux_quic-t.h
include/haproxy/mux_quic.h
src/h3.c
src/mux_quic.c

index bf396bbd2085b79a1ddaa240916c20af4ef8bc4f..83fccb29ec74f06e630c100d6146b8e2d2f577c8 100644 (file)
@@ -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 */
index b91ef57c7a7e43583d3e4ff55249a67aec447c47..0086909fb135503c259a0fc241da3a074133b010 100644 (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)
 {
-       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 */
index 8a41f07829bb3fc68690a927b70b323f0609ae78..68fc1025a689234775cdb6b971e9f9bd2cafad81 100644 (file)
--- 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
index 0d7d4240f55f0fbdc347ea1591527116c2ab69d7..f03b651eea5374ac3cfefd6147737d9d2d3a14c0 100644 (file)
@@ -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);
                        }
                }
        }