mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-07 03:48:46 +00:00
MINOR: mux-h2: insert line breaks in "show sess all" output for legibility
h2s and h2c were extremely long in the "show sess all" output, around 300 chars each. This adds a few line breaks to improve legibility, there are now 3 lines for each, which are around the same length as the other ones while keeping a natural arrangement. E.g (lines highlighted with '>'): 0x7faad8144f80: [02/Sep/2022:15:49:40.171620] id=105283 proto=tcpv4 source=127.0.0.1:42942 flags=0x100c4a, conn_retries=0, conn_exp=<NEVER> conn_et=0x000 srv_conn=0x1f44b20, pend_pos=(nil) waiting=0 epoch=0 frontend=decrypt (id=2 mode=http), listener=? (id=3) addr=127.0.0.1:8001 backend=decrypt (id=2 mode=http) addr=127.0.0.1:18144 server=httpterm (id=1) addr=127.0.0.1:8000 task=0x7faad812b7c0 (state=0x00 nice=0 calls=2 rate=0 exp=4s tid=7(1/7) age=0s) txn=0x7faad81453e0 flags=0x43000 meth=1 status=200 req.st=MSG_DONE rsp.st=MSG_DATA req.f=0x4c rsp.f=0x0d scf=0x7faad81625d0 flags=0x00000080 state=EST endp=CONN,0x7faad811d380,0x02805001 sub=1 > h2s=0x7faad811d380 h2s.id=2113 .st=HCR .flg=0x207001 .rxbuf=0@(nil)+0/0 > .sc=0x7faad81625d0(.flg=0x00000080 .app=0x7faad8144f80) .sd=0x7faad8119dc0(.flg=0x02805001) > .subs=0x7faad81625e0(ev=1 tl=0x7faad86d6500 tl.calls=4 tl.ctx=0x7faad81625d0 tl.fct=sc_conn_io_cb) > h2c=0x7faad802c640 h2c.st0=FRH .err=0 .maxid=2157 .lastid=-1 .flg=0x0600 .nbst=1 .nbsc=1 > .fctl_cnt=0 .send_cnt=0 .tree_cnt=1 .orph_cnt=0 .sub=1 .dsi=2157 .dbuf=0@(nil)+0/0 > .msi=-1 .mbuf=[6..6|32],h=[0@(nil)+0/0],t=[0@(nil)+0/0] co0=0x7faae402efc0 ctrl=tcpv4 xprt=RAW mux=H2 data=STRM target=LISTENER:0x1f43c40 flags=0x00000300 fd=95 fd.state=121 updt=0 fd.tmask=0x80 scb=0x7faad8145370 flags=0x00000011 state=EST endp=CONN,0x7faad8115630,0x02840001 sub=1 co1=0x7faad86c0730 ctrl=tcpv4 xprt=RAW mux=H1 data=STRM target=SERVER:0x1f44b20 flags=0x00000300 fd=1656 fd.state=10121 updt=0 fd.tmask=0x80 req=0x7faad8144fa0 (f=0x49c40000 an=0x8000 pipe=0 tofwd=0 total=110) an_exp=<NEVER> rex=<NEVER> wex=<NEVER> buf=0x7faad8144fa8 data=(nil) o=0 p=0 i=0 size=0 htx=0xdd90a0 flags=0x0 size=0 data=0 used=0 wrap=NO extra=0 res=0x7faad8145000 (f=0x80040202 an=0x4000000 pipe=0 tofwd=-1 total=60365) an_exp=<NEVER> rex=<NEVER> wex=<NEVER> buf=0x7faad8145008 data=(nil) o=0 p=0 i=0 size=0 htx=0xdd90a0 flags=0x0 size=0 data=0 used=0 wrap=NO extra=0
This commit is contained in:
parent
bf4ec6f4a0
commit
7051f73efe
55
src/mux_h2.c
55
src/mux_h2.c
@ -6738,27 +6738,36 @@ static size_t h2_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, in
|
||||
}
|
||||
|
||||
/* appends some info about stream <h2s> to buffer <msg>, or does nothing if
|
||||
* <h2s> is NULL. Returns non-zero if the stream is considered suspicious.
|
||||
* <h2s> is NULL. Returns non-zero if the stream is considered suspicious. May
|
||||
* emit multiple lines, each new one being prefixed with <pfx>, if <pfx> is not
|
||||
* NULL, otherwise a single line is used.
|
||||
*/
|
||||
static int h2_dump_h2s_info(struct buffer *msg, const struct h2s *h2s)
|
||||
static int h2_dump_h2s_info(struct buffer *msg, const struct h2s *h2s, const char *pfx)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!h2s)
|
||||
return ret;
|
||||
|
||||
chunk_appendf(msg, " h2s.id=%d .st=%s .flg=0x%04x .rxbuf=%u@%p+%u/%u .sc=%p",
|
||||
chunk_appendf(msg, " h2s.id=%d .st=%s .flg=0x%04x .rxbuf=%u@%p+%u/%u",
|
||||
h2s->id, h2s_st_to_str(h2s->st), h2s->flags,
|
||||
(unsigned int)b_data(&h2s->rxbuf), b_orig(&h2s->rxbuf),
|
||||
(unsigned int)b_head_ofs(&h2s->rxbuf), (unsigned int)b_size(&h2s->rxbuf),
|
||||
h2s_sc(h2s));
|
||||
(unsigned int)b_head_ofs(&h2s->rxbuf), (unsigned int)b_size(&h2s->rxbuf));
|
||||
|
||||
if (pfx)
|
||||
chunk_appendf(msg, "\n%s", pfx);
|
||||
|
||||
chunk_appendf(msg, " .sc=%p", h2s_sc(h2s));
|
||||
if (h2s_sc(h2s))
|
||||
chunk_appendf(msg, "(.flg=0x%08x .app=%p)",
|
||||
h2s_sc(h2s)->flags, h2s_sc(h2s)->app);
|
||||
|
||||
chunk_appendf(msg, " sd=%p", h2s->sd);
|
||||
chunk_appendf(msg, " .sd=%p", h2s->sd);
|
||||
chunk_appendf(msg, "(.flg=0x%08x)", se_fl_get(h2s->sd));
|
||||
|
||||
if (pfx)
|
||||
chunk_appendf(msg, "\n%s", pfx);
|
||||
|
||||
chunk_appendf(msg, " .subs=%p", h2s->subs);
|
||||
if (h2s->subs) {
|
||||
chunk_appendf(msg, "(ev=%d tl=%p", h2s->subs->events, h2s->subs->tasklet);
|
||||
@ -6775,8 +6784,10 @@ static int h2_dump_h2s_info(struct buffer *msg, const struct h2s *h2s)
|
||||
|
||||
/* appends some info about connection <h2c> to buffer <msg>, or does nothing if
|
||||
* <h2c> is NULL. Returns non-zero if the connection is considered suspicious.
|
||||
* May emit multiple lines, each new one being prefixed with <pfx>, if <pfx> is
|
||||
* not NULL, otherwise a single line is used.
|
||||
*/
|
||||
static int h2_dump_h2c_info(struct buffer *msg, struct h2c *h2c)
|
||||
static int h2_dump_h2c_info(struct buffer *msg, struct h2c *h2c, const char *pfx)
|
||||
{
|
||||
const struct buffer *hmbuf, *tmbuf;
|
||||
const struct h2s *h2s = NULL;
|
||||
@ -6808,14 +6819,25 @@ static int h2_dump_h2c_info(struct buffer *msg, struct h2c *h2c)
|
||||
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 .nbcs=%u .fctl_cnt=%d .send_cnt=%d .tree_cnt=%d"
|
||||
" .orph_cnt=%d .sub=%d .dsi=%d .dbuf=%u@%p+%u/%u .msi=%d"
|
||||
" .mbuf=[%u..%u|%u],h=[%u@%p+%u/%u],t=[%u@%p+%u/%u]",
|
||||
" .nbst=%u .nbsc=%u",
|
||||
h2c_st_to_str(h2c->st0), h2c->errcode, h2c->max_id, h2c->last_sid, h2c->flags,
|
||||
h2c->nb_streams, h2c->nb_sc, fctl_cnt, send_cnt, tree_cnt, orph_cnt,
|
||||
h2c->nb_streams, h2c->nb_sc);
|
||||
|
||||
if (pfx)
|
||||
chunk_appendf(msg, "\n%s", pfx);
|
||||
|
||||
chunk_appendf(msg, " .fctl_cnt=%d .send_cnt=%d .tree_cnt=%d"
|
||||
" .orph_cnt=%d .sub=%d .dsi=%d .dbuf=%u@%p+%u/%u",
|
||||
fctl_cnt, send_cnt, tree_cnt, orph_cnt,
|
||||
h2c->wait_event.events, h2c->dsi,
|
||||
(unsigned int)b_data(&h2c->dbuf), b_orig(&h2c->dbuf),
|
||||
(unsigned int)b_head_ofs(&h2c->dbuf), (unsigned int)b_size(&h2c->dbuf),
|
||||
(unsigned int)b_head_ofs(&h2c->dbuf), (unsigned int)b_size(&h2c->dbuf));
|
||||
|
||||
if (pfx)
|
||||
chunk_appendf(msg, "\n%s", pfx);
|
||||
|
||||
chunk_appendf(msg, " .msi=%d"
|
||||
" .mbuf=[%u..%u|%u],h=[%u@%p+%u/%u],t=[%u@%p+%u/%u]",
|
||||
h2c->msi,
|
||||
br_head_idx(h2c->mbuf), br_tail_idx(h2c->mbuf), br_size(h2c->mbuf),
|
||||
(unsigned int)b_data(hmbuf), b_orig(hmbuf),
|
||||
@ -6823,6 +6845,7 @@ static int h2_dump_h2c_info(struct buffer *msg, struct h2c *h2c)
|
||||
(unsigned int)b_data(tmbuf), b_orig(tmbuf),
|
||||
(unsigned int)b_head_ofs(tmbuf), (unsigned int)b_size(tmbuf));
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -6837,13 +6860,13 @@ static int h2_show_fd(struct buffer *msg, struct connection *conn)
|
||||
if (!h2c)
|
||||
return ret;
|
||||
|
||||
ret |= h2_dump_h2c_info(msg, h2c);
|
||||
ret |= h2_dump_h2c_info(msg, h2c, NULL);
|
||||
|
||||
node = eb32_last(&h2c->streams_by_id);
|
||||
if (node) {
|
||||
h2s = container_of(node, struct h2s, by_id);
|
||||
chunk_appendf(msg, " last_h2s=%p", h2s);
|
||||
ret |= h2_dump_h2s_info(msg, h2s);
|
||||
ret |= h2_dump_h2s_info(msg, h2s, NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -6863,11 +6886,11 @@ static int h2_show_sd(struct buffer *msg, struct sedesc *sd, const char *pfx)
|
||||
return ret;
|
||||
|
||||
chunk_appendf(msg, " h2s=%p", h2s);
|
||||
ret |= h2_dump_h2s_info(msg, h2s);
|
||||
ret |= h2_dump_h2s_info(msg, h2s, pfx);
|
||||
if (pfx)
|
||||
chunk_appendf(msg, "\n%s", pfx);
|
||||
chunk_appendf(msg, " h2c=%p", h2s->h2c);
|
||||
ret |= h2_dump_h2c_info(msg, h2s->h2c);
|
||||
ret |= h2_dump_h2c_info(msg, h2s->h2c, pfx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user