From 95029305d335215a9f576d064d2a10d7d895e6c0 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 23 Dec 2024 14:52:15 +0100 Subject: [PATCH] MINOR: tevt/mux-h1/mux-h2: Add termination events log when dumping mux info The termiantion events logs of the multiplexer connection and stream are now dumped when corresponding mux info are dumped. The termination event logs of the underlying connection is also dumped in the debug string. --- src/mux_h1.c | 23 +++++++++++++---------- src/mux_h2.c | 11 +++++++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index 22b694637..3c86a8547 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -5290,7 +5290,9 @@ static int h1_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *output) h1_dump_h1c_info(buf, h1s->h1c, NULL); if (dbg_ctx->arg.debug_flags & MUX_SCTL_DBG_STR_L_CONN) - chunk_appendf(buf, " conn.flg=%#08x", h1s->h1c->conn->flags); + chunk_appendf(buf, " conn.flg=%#08x conn.err_code=%u conn.evts=%s", + h1s->h1c->conn->flags, h1s->h1c->conn->err_code, + tevt_evts2str(h1s->h1c->conn->term_evts_log)); /* other layers not implemented */ dbg_ctx->ret.buf = *buf; @@ -5312,12 +5314,13 @@ static int h1_dump_h1c_info(struct buffer *msg, struct h1c *h1c, const char *pfx if (!h1c) return ret; - chunk_appendf(msg, " h1c.flg=0x%x .sub=%d .ibuf=%u@%p+%u/%u .obuf=%u@%p+%u/%u", + chunk_appendf(msg, " h1c.flg=0x%x .sub=%d .ibuf=%u@%p+%u/%u .obuf=%u@%p+%u/%u .evts=%s", h1c->flags, h1c->wait_event.events, (unsigned int)b_data(&h1c->ibuf), b_orig(&h1c->ibuf), (unsigned int)b_head_ofs(&h1c->ibuf), (unsigned int)b_size(&h1c->ibuf), (unsigned int)b_data(&h1c->obuf), b_orig(&h1c->obuf), - (unsigned int)b_head_ofs(&h1c->obuf), (unsigned int)b_size(&h1c->obuf)); + (unsigned int)b_head_ofs(&h1c->obuf), (unsigned int)b_size(&h1c->obuf), + tevt_evts2str(h1c->term_evts_log)); chunk_appendf(msg, " .task=%p", h1c->task); if (h1c->task) { @@ -5347,9 +5350,8 @@ static int h1_dump_h1s_info(struct buffer *msg, const struct h1s *h1s, const cha else method = "UNKNOWN"; - chunk_appendf(msg, " h1s=%p h1s.flg=0x%x .sd.flg=0x%x .req.state=%s .res.state=%s", - h1s, h1s->flags, se_fl_get(h1s->sd), - h1m_state_str(h1s->req.state), h1m_state_str(h1s->res.state)); + chunk_appendf(msg, " h1s=%p h1s.flg=0x%x .sd.flg=0x%x", h1s, h1s->flags, se_fl_get(h1s->sd)); + chunk_appendf(msg, " .req.state=%s .res.state=%s", h1m_state_str(h1s->req.state), h1m_state_str(h1s->res.state)); if (pfx) chunk_appendf(msg, "\n%s", pfx); @@ -5357,10 +5359,11 @@ static int h1_dump_h1s_info(struct buffer *msg, const struct h1s *h1s, const cha chunk_appendf(msg, " .meth=%s status=%d", method, h1s->status); - chunk_appendf(msg, " .sd.flg=0x%08x", se_fl_get(h1s->sd)); - if (!se_fl_test(h1s->sd, SE_FL_ORPHAN)) - chunk_appendf(msg, " .sc.flg=0x%08x .sc.app=%p", - h1s_sc(h1s)->flags, h1s_sc(h1s)->app); + chunk_appendf(msg, " .sd.flg=0x%08x .sd.evts=%s", se_fl_get(h1s->sd), tevt_evts2str(h1s->sd->term_evts_log)); + if (!se_fl_test(h1s->sd, SE_FL_ORPHAN)) { + chunk_appendf(msg, " .sc.flg=0x%08x .sc.app=%p .sc.evts=%s", + h1s_sc(h1s)->flags, h1s_sc(h1s)->app, tevt_evts2str(h1s_sc(h1s)->term_evts_log)); + } if (pfx && h1s->subs) chunk_appendf(msg, "\n%s", pfx); diff --git a/src/mux_h2.c b/src/mux_h2.c index 596b1220e..8c3805d64 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -5272,7 +5272,9 @@ static int h2_sctl(struct stconn *sc, enum mux_sctl_type mux_sctl, void *output) h2_dump_h2c_info(buf, h2s->h2c, NULL); if (dbg_ctx->arg.debug_flags & MUX_SCTL_DBG_STR_L_CONN) - chunk_appendf(buf, " conn.flg=%#08x", h2s->h2c->conn->flags); + chunk_appendf(buf, " conn.flg=%#08x conn.err_code=%u conn.evts=%s", + h2s->h2c->conn->flags, h2s->h2c->conn->err_code, + tevt_evts2str(h2s->h2c->conn->term_evts_log)); /* other layers not implemented */ dbg_ctx->ret.buf = *buf; @@ -8002,7 +8004,7 @@ static int h2_dump_h2s_info(struct buffer *msg, const struct h2s *h2s, const cha h2s_sc(h2s)->flags, h2s_sc(h2s)->app); chunk_appendf(msg, " .sd=%p", h2s->sd); - chunk_appendf(msg, "(.flg=0x%08x)", se_fl_get(h2s->sd)); + chunk_appendf(msg, "(.flg=0x%08x .evts=%s)", se_fl_get(h2s->sd), tevt_evts2str(h2s->sd->term_evts_log)); if (pfx) chunk_appendf(msg, "\n%s", pfx); @@ -8058,9 +8060,10 @@ static int h2_dump_h2c_info(struct buffer *msg, struct h2c *h2c, const char *pfx hmbuf = br_head(h2c->mbuf); tmbuf = br_tail(h2c->mbuf); chunk_appendf(msg, " h2c.st0=%s .err=%d .maxid=%d .lastid=%d .flg=0x%04x" - " .nbst=%u .nbsc=%u .nbrcv=%u .glitches=%d", + " .nbst=%u .nbsc=%u .nbrcv=%u .glitches=%d .evts=%s", h2c_st_to_str(h2c->st0), h2c->errcode, h2c->max_id, h2c->last_sid, h2c->flags, - h2c->nb_streams, h2c->nb_sc, h2c->receiving_streams, h2c->glitches); + h2c->nb_streams, h2c->nb_sc, h2c->receiving_streams, h2c->glitches, + tevt_evts2str(h2c->term_evts_log)); if (pfx) chunk_appendf(msg, "\n%s", pfx);