]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: activate qmux traces on stdout via macro
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 24 Mar 2022 16:14:52 +0000 (17:14 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 25 Mar 2022 13:51:14 +0000 (14:51 +0100)
This commit is similar to the following one :
  commit 118b2cbf8430a9513947c27a8403ff380e1dcaf2
  MINOR: quic: activate QUIC traces at compilation

If the macro ENABLE_QUIC_STDOUT_TRACES is defined, qmux traces are
outputted automatically on stdout. This is useful for the haproxy-qns
interop docker image.

src/mux_quic.c

index 5f3bda0e1ed10ed8f8efaf938becba803f73b7ea..025f91c609532f7c4679f71d941b05512f98d0f1 100644 (file)
@@ -8,6 +8,7 @@
 #include <haproxy/dynbuf.h>
 #include <haproxy/htx.h>
 #include <haproxy/pool.h>
+#include <haproxy/sink.h>
 #include <haproxy/ssl_sock-t.h>
 #include <haproxy/trace.h>
 #include <haproxy/xprt_quic.h>
@@ -1215,6 +1216,21 @@ static void qmux_trace(enum trace_level level, uint64_t mask,
        }
 }
 
+/* Function to automatically activate QUIC MUX traces on stdout.
+ * Activated via the compilation flag -DENABLE_QUIC_STDOUT_TRACES.
+ * Main use for now is in the docker image for QUIC interop testing.
+ */
+static void qmux_init_stdout_traces(void)
+{
+#ifdef ENABLE_QUIC_STDOUT_TRACES
+       trace_qmux.sink = sink_find("stdout");
+       trace_qmux.level = TRACE_LEVEL_DEVELOPER;
+       trace_qmux.state = TRACE_STATE_RUNNING;
+       trace_qmux.verbosity = QMUX_VERB_MINIMAL;
+#endif
+}
+INITCALL0(STG_INIT, qmux_init_stdout_traces);
+
 
 static const struct mux_ops qc_ops = {
        .init = qc_init,