]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: display Tx stream info on "show quic"
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 1 Feb 2023 16:05:36 +0000 (17:05 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 9 Feb 2023 17:14:40 +0000 (18:14 +0100)
Complete "show quic" handler by displaying information about
quic_stream_desc entries. These structures are used to emit stream data
and store them until acknowledgment is received.

This should be backported up to 2.7.

src/quic_conn.c

index 94a7cfaff1a8c44b0525b38fb78e69e7769e904f..a7712800b0e00e9b7dcd63fdb925deead5157dd8 100644 (file)
@@ -7647,6 +7647,8 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
        struct stconn *sc = appctx_sc(appctx);
        struct quic_conn *qc;
        struct quic_enc_level *qel;
+       struct eb64_node *node;
+       struct qc_stream_desc *stream;
        char bufaddr[INET6_ADDRSTRLEN], bufport[6];
        int expire;
        unsigned char cid_len;
@@ -7678,6 +7680,7 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
 
        while (1) {
                int done = 0;
+               int i;
 
                if (ctx->bref.ref == &ha_thread_ctx[ctx->thr].quic_conns) {
                        done = 1;
@@ -7765,6 +7768,24 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
 
                chunk_appendf(&trash, "\n");
 
+               /* Streams */
+               node = eb64_first(&qc->streams_by_id);
+               i = 0;
+               while (node) {
+                       stream = eb64_entry(node, struct qc_stream_desc, by_id);
+                       node = eb64_next(node);
+
+                       chunk_appendf(&trash, "  | stream=%-8llu", (long long unsigned int)stream->by_id.key);
+                       chunk_appendf(&trash, " off=%-8lu ack=%-8lu", stream->buf_offset, stream->ack_offset);
+
+                       if (!(++i % 3)) {
+                               chunk_appendf(&trash, "\n");
+                               i = 0;
+                       }
+               }
+
+               chunk_appendf(&trash, "\n");
+
                if (applet_putchk(appctx, &trash) == -1) {
                        /* Register show_quic_ctx to quic_conn instance. */
                        LIST_APPEND(&qc->back_refs, &ctx->bref.users);