]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: redirect app_ops snd_buf through mux
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 12 Nov 2021 15:09:29 +0000 (16:09 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 18 Nov 2021 09:50:58 +0000 (10:50 +0100)
This change is required to be able to use multiple app_ops layer on top
of QUIC. The stream-interface will now call the mux snd_buf which is
just a proxy to the app_ops snd_buf function.

The architecture may be simplified in the structure to install the
app_ops on the stream_interface and avoid the detour via the mux layer
on the sending path.

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

index b93a8a5780fb4aa4b8c6cfe202ae06a5a3c7183d..c05c69c3008053a8fe1a3a163c82d7295f621a38 100644 (file)
@@ -239,6 +239,7 @@ struct qcc_app_ops {
        int (*init)(struct qcc *qcc);
        int (*attach_ruqs)(struct qcs *qcs, void *ctx);
        int (*decode_qcs)(struct qcs *qcs, void *ctx);
+       size_t (*snd_buf)(struct conn_stream *cs, struct buffer *buf, size_t count, int flags);
        int (*finalize)(void *ctx);
 };
 
index 332c5291a21514d0f8b229353268303f23462a55..7f3bd3c632f9fd4aefa629ec451c81868e19d2ad 100644 (file)
@@ -121,7 +121,5 @@ static inline void *qcs_new(struct qcc *qcc, uint64_t id)
                return bidi_qcs_new(qcc, id);
 }
 
-size_t qc_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags);
-
 #endif /* USE_QUIC */
 #endif /* _HAPROXY_MUX_QUIC_H */
index 352b8c2d03005037d6f059d0afdcdb523867155c..9be2a5b11c18f16b12a14c5ea26c717fb0eb0783 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -820,5 +820,6 @@ const struct qcc_app_ops h3_ops = {
        .init        = h3_init,
        .attach_ruqs = h3_attach_ruqs,
        .decode_qcs  = h3_decode_qcs,
+       .snd_buf     = h3_snd_buf,
        .finalize    = h3_finalize,
 };
index 4903352766351c03db03d77145917ee5335e8a00..d870a68e23b7e858720599b88638031d328249f3 100644 (file)
@@ -1852,6 +1852,12 @@ static int qc_show_fd(struct buffer *msg, struct connection *conn)
        return 0;
 }
 
+static size_t qc_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags)
+{
+       struct qcs *qcs = cs->ctx;
+       return qcs->qcc->app_ops->snd_buf(cs, buf, count, flags);
+}
+
 /****************************************/
 /* MUX initialization and instantiation */
 /***************************************/
@@ -1860,8 +1866,7 @@ static int qc_show_fd(struct buffer *msg, struct connection *conn)
 static const struct mux_ops qc_ops = {
        .init = qc_init,
        .wake = qc_wake,
-       //.snd_buf = qc_snd_buf,
-       .snd_buf = h3_snd_buf,
+       .snd_buf = qc_snd_buf,
        .rcv_buf = qc_rcv_buf,
        .subscribe = qc_subscribe,
        .unsubscribe = qc_unsubscribe,