]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: mux-quic: remove stconn usage in h3/hq
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 15 Sep 2022 09:22:32 +0000 (11:22 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 16 Sep 2022 11:53:30 +0000 (13:53 +0200)
Small cleanup on snd_buf for application protocol layer.
* do not export h3_snd_buf
* replace stconn by a qcs argument. This is better as h3/hq-interop only
  uses the qcs instance.

This should be backported up to 2.6.

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

index 504e9bfedec5efa0df8b994a59c5f1aa4e4d829b..ab088d86aecbccb313b23e557f4c4a8aa68f9215 100644 (file)
@@ -111,7 +111,5 @@ enum h3s_st_req {
 
 extern const struct qcc_app_ops h3_ops;
 
-size_t h3_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, int flags);
-
 #endif /* USE_QUIC */
 #endif /* _HAPROXY_H3_T_H */
index 1670262a1b3d4228c6ca59ede646e423845b4e50..43ea53044c93d9e025ace90fb33050d39354d4df 100644 (file)
@@ -185,7 +185,7 @@ struct qcc_app_ops {
        int (*init)(struct qcc *qcc);
        int (*attach)(struct qcs *qcs, void *conn_ctx);
        ssize_t (*decode_qcs)(struct qcs *qcs, struct buffer *b, int fin);
-       size_t (*snd_buf)(struct stconn *sc, struct buffer *buf, size_t count, int flags);
+       size_t (*snd_buf)(struct qcs *qcs, struct buffer *buf, size_t count, int flags);
        void (*detach)(struct qcs *qcs);
        int (*finalize)(void *ctx);
        void (*shutdown)(void *ctx);                    /* Close a connection. */
index 8d13f5d09c0496c3e3eb3333896cc3470c954bc7..187c6065bba59b64851aa7111f8ec3f427461e4c 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -31,7 +31,6 @@
 #include <haproxy/qpack-dec.h>
 #include <haproxy/qpack-enc.h>
 #include <haproxy/quic_enc.h>
-#include <haproxy/stconn.h>
 #include <haproxy/tools.h>
 #include <haproxy/trace.h>
 #include <haproxy/xprt_quic.h>
@@ -1013,10 +1012,9 @@ static int h3_resp_data_send(struct qcs *qcs, struct buffer *buf, size_t count)
        return total;
 }
 
-size_t h3_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, int flags)
+static size_t h3_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count, int flags)
 {
        size_t total = 0;
-       struct qcs *qcs = __sc_mux_strm(sc);
        struct htx *htx;
        enum htx_blk_type btype;
        struct htx_blk *blk;
index be0287f6f53b3a093369a68d09531cbbfcbee344..a133cd53b440f3d4aff732292ba4847c5bb73c52 100644 (file)
@@ -12,7 +12,6 @@ static ssize_t hq_interop_decode_qcs(struct qcs *qcs, struct buffer *b, int fin)
 {
        struct htx *htx;
        struct htx_sl *sl;
-       struct stconn *sc;
        struct buffer htx_buf = BUF_NULL;
        struct ist path;
        char *ptr = b_head(b);
@@ -70,8 +69,7 @@ static ssize_t hq_interop_decode_qcs(struct qcs *qcs, struct buffer *b, int fin)
        htx_add_endof(htx, HTX_BLK_EOH);
        htx_to_buf(htx, &htx_buf);
 
-       sc = qc_attach_sc(qcs, &htx_buf);
-       if (!sc)
+       if (!qc_attach_sc(qcs, &htx_buf))
                return -1;
 
        b_free(&htx_buf);
@@ -90,10 +88,9 @@ static struct buffer *mux_get_buf(struct qcs *qcs)
        return &qcs->tx.buf;
 }
 
-static size_t hq_interop_snd_buf(struct stconn *sc, struct buffer *buf,
+static size_t hq_interop_snd_buf(struct qcs *qcs, struct buffer *buf,
                                  size_t count, int flags)
 {
-       struct qcs *qcs = __sc_mux_strm(sc);
        struct htx *htx;
        enum htx_blk_type btype;
        struct htx_blk *blk;
index 08db5387ee1ca178079b59ad29a3002e9be18c55..5b4a35469e61adf6d9dad724132ff26630b8836a 100644 (file)
@@ -2225,7 +2225,7 @@ static size_t qc_snd_buf(struct stconn *sc, struct buffer *buf,
                goto end;
        }
 
-       ret = qcs->qcc->app_ops->snd_buf(sc, buf, count, flags);
+       ret = qcs->qcc->app_ops->snd_buf(qcs, buf, count, flags);
 
  end:
        TRACE_LEAVE(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs);