From f9f4499429e678ea648b5fe587662d44402c4ea6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 20 Feb 2023 16:57:47 +0100 Subject: [PATCH] MINOR: mux-h2/traces: do not log h2s pointer for dummy streams 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mux_h2.c b/src/mux_h2.c index bc82cb3f8e..22a819975a 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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); } -- 2.47.3