]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2/traces: do not log h2s pointer for dummy streams
authorWilly Tarreau <w@1wt.eu>
Mon, 20 Feb 2023 15:57:47 +0000 (16:57 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 Feb 2023 16:22:03 +0000 (17:22 +0100)
Functions which are called with dummy streams pass it down the traces
and that leads to somewhat confusing "h2s=0x1234568(0,IDL)" for example
while the nature of the called function makes this stream useless at that
place. Better not report a random pointer, especially since it always
requires to look at the code before remembering how this should be
interpreted.

Now what we're doing is that the idle stream only prints "h2s=IDL" which
is shorter and doesn't report a pointer, closed stream do not report
anything since the stream ID 0 already implies it, and other ones are
reported normally.

This could be backported to 2.7 and 2.6 as it improves traces legibility.

src/mux_h2.c

index bc82cb3f8ea008a98894a67d0bfc1cceedac83ec..22a819975aa90e3f28e39a85ba487d25ddb396cb 100644 (file)
@@ -507,7 +507,10 @@ static void h2_trace(enum trace_level level, uint64_t mask, const struct trace_s
                if (h2s) {
                        if (h2s->id <= 0)
                                chunk_appendf(&trace_buf, " dsi=%d", h2c->dsi);
-                       chunk_appendf(&trace_buf, " h2s=%p(%d,%s)", h2s, h2s->id, h2s_st_to_str(h2s->st));
+                       if (h2s == h2_idle_stream)
+                               chunk_appendf(&trace_buf, " h2s=IDL");
+                       else if (h2s != h2_closed_stream)
+                               chunk_appendf(&trace_buf, " h2s=%p(%d,%s)", h2s, h2s->id, h2s_st_to_str(h2s->st));
                        if (h2s->id && h2s->errcode)
                                chunk_appendf(&trace_buf, " err=%s/%02x", h2_err_str(h2s->errcode), h2s->errcode);
                }