From: Willy Tarreau Date: Mon, 20 Feb 2023 15:57:47 +0000 (+0100) Subject: MINOR: mux-h2/traces: do not log h2s pointer for dummy streams X-Git-Tag: v2.8-dev5~158 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=f9f4499429e678ea648b5fe587662d44402c4ea6;p=haproxy-3.0.git 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. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index bc82cb3..22a8199 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); }